Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/sniffer.hh') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/sniffer.hh | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/sniffer.hh b/noncore/net/wellenreiter/daemon/source/sniffer.hh index d262353..7e1e3be 100644 --- a/noncore/net/wellenreiter/daemon/source/sniffer.hh +++ b/noncore/net/wellenreiter/daemon/source/sniffer.hh | |||
@@ -4,57 +4,51 @@ | |||
4 | #define SNIFFER_HH | 4 | #define SNIFFER_HH |
5 | 5 | ||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <pcap.h> | 9 | #include <pcap.h> |
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <sys/socket.h> | 11 | #include <sys/socket.h> |
12 | #include <netinet/in.h> | 12 | #include <netinet/in.h> |
13 | #include <arpa/inet.h> | 13 | #include <arpa/inet.h> |
14 | #include <net/bpf.h> | 14 | #include <net/bpf.h> |
15 | 15 | ||
16 | |||
17 | #define NONBROADCASTING "non-broadcasting" | 16 | #define NONBROADCASTING "non-broadcasting" |
18 | 17 | ||
19 | |||
20 | /* holds all the interresting data */ | 18 | /* holds all the interresting data */ |
21 | struct packetinfo | 19 | struct packetinfo |
22 | { | 20 | { |
23 | int isvalid; | 21 | int isvalid; |
24 | int pktlen; | 22 | int pktlen; |
25 | int fctype; | 23 | int fctype; |
26 | int fcsubtype; | 24 | int fcsubtype; |
27 | int fc_wep; | 25 | int fc_wep; |
28 | int cap_WEP; | 26 | int cap_WEP; |
29 | int cap_IBSS; | 27 | int cap_IBSS; |
30 | int cap_ESS; | 28 | int cap_ESS; |
31 | int channel; | 29 | int channel; |
32 | char bssid[sizeof("00:00:00:00:00:00")]; | 30 | char bssid[sizeof("00:00:00:00:00:00")]; |
33 | char desthwaddr[sizeof("00:00:00:00:00:00")]; | 31 | char desthwaddr[sizeof("00:00:00:00:00:00")]; |
34 | char sndhwaddr[sizeof("00:00:00:00:00:00")]; | 32 | char sndhwaddr[sizeof("00:00:00:00:00:00")]; |
35 | char *ssid; | 33 | char *ssid; |
36 | int ssid_len; | 34 | int ssid_len; |
37 | }; | 35 | }; |
38 | 36 | ||
39 | |||
40 | /* Prototypes */ | ||
41 | int sniffer(void); | ||
42 | int start_sniffing (char * device); | ||
43 | void process_packets(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_char* packet); | 37 | void process_packets(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_char* packet); |
44 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); | 38 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); |
45 | void etheraddr_string(register const u_char *ep,char * text); | 39 | void etheraddr_string(register const u_char *ep,char * text); |
46 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); | 40 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); |
47 | 41 | ||
48 | static int GetHeaderLength(u_int16_t fc); | 42 | int GetHeaderLength(u_int16_t fc); |
49 | 43 | ||
50 | /* | 44 | /* |
51 | * True if "l" bytes of "var" were captured. | 45 | * True if "l" bytes of "var" were captured. |
52 | * | 46 | * |
53 | * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large | 47 | * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large |
54 | * that "snapend - (l)" underflows. | 48 | * that "snapend - (l)" underflows. |
55 | * | 49 | * |
56 | * The check is for <= rather than < because "l" might be 0. | 50 | * The check is for <= rather than < because "l" might be 0. |
57 | */ | 51 | */ |
58 | #define TTEST2(var, l) (snapend - (l) <= snapend && \ | 52 | #define TTEST2(var, l) (snapend - (l) <= snapend && \ |
59 | (const u_char *)&(var) <= snapend - (l)) | 53 | (const u_char *)&(var) <= snapend - (l)) |
60 | 54 | ||