author | max <max> | 2002-11-23 20:33:08 (UTC) |
---|---|---|
committer | max <max> | 2002-11-23 20:33:08 (UTC) |
commit | f673a2924c8d3495a99e0eba7073a3419dd937bf (patch) (unidiff) | |
tree | fdd5e641fef00d8e087bbec5a741a24ec2f80f62 | |
parent | 2f11392ab9292df21a6e1374800954a6b405ee9b (diff) | |
download | opie-f673a2924c8d3495a99e0eba7073a3419dd937bf.zip opie-f673a2924c8d3495a99e0eba7073a3419dd937bf.tar.gz opie-f673a2924c8d3495a99e0eba7073a3419dd937bf.tar.bz2 |
Sniffer changed to pcap_next
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/sniffer.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/sniffer.cc b/noncore/net/wellenreiter/daemon/source/sniffer.cc index 65c8579..be64d67 100644 --- a/noncore/net/wellenreiter/daemon/source/sniffer.cc +++ b/noncore/net/wellenreiter/daemon/source/sniffer.cc | |||
@@ -26,4 +26,6 @@ int start_sniffing (char * device) | |||
26 | 26 | ||
27 | pcap_t *handletopcap; | 27 | pcap_t *handletopcap; /* The handle to the libpcap */ |
28 | char errbuf[PCAP_ERRBUF_SIZE]; | 28 | char errbuf[PCAP_ERRBUF_SIZE]; /* The errorbuffer of libpacap */ |
29 | struct pcap_pkthdr header; /* The packet header from pcap*/ | ||
30 | const u_char *packet; /* The actual packet content*/ | ||
29 | 31 | ||
@@ -36,3 +38,12 @@ int start_sniffing (char * device) | |||
36 | /*start scanning */ | 38 | /*start scanning */ |
37 | pcap_loop(handletopcap,-1,process_packets,NULL); | 39 | //pcap_loop(handletopcap,-1,process_packets,NULL); |
40 | /* Loope endless */ | ||
41 | while(1) | ||
42 | { | ||
43 | /* Grab one single packet */ | ||
44 | packet = pcap_next(handletopcap, &header); | ||
45 | |||
46 | /* process the packet */ | ||
47 | process_packets(NULL,&header,*&packet); | ||
48 | } | ||
38 | 49 | ||
@@ -100,3 +111,2 @@ void process_packets(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_ch | |||
100 | { | 111 | { |
101 | printf ("\n\tOn network : %s",pinfoptr->ssid); | ||
102 | if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) | 112 | if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) |