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