-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.hh | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh index 6ec5b95..b85b7b7 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | |||
@@ -1,32 +1,36 @@ | |||
1 | /* $Id$ */ | 1 | /* $Id$ */ |
2 | 2 | ||
3 | #ifndef CARDMODE_HH | 3 | #ifndef CARDMODE_HH |
4 | #define CARDMODE_HH | 4 | #define CARDMODE_HH |
5 | 5 | ||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <sys/types.h> | 9 | #include <sys/types.h> |
10 | #include <sys/time.h> | 10 | #include <sys/time.h> |
11 | #include <sys/socket.h> | 11 | #include <sys/socket.h> |
12 | #include <netinet/in.h> | 12 | #include <netinet/in.h> |
13 | |||
14 | extern "C" | ||
15 | { | ||
13 | #include <net/bpf.h> | 16 | #include <net/bpf.h> |
14 | #include <pcap.h> | 17 | #include <pcap.h> |
18 | } | ||
15 | 19 | ||
16 | /* Defines, used for the card setup */ | 20 | /* Defines, used for the card setup */ |
17 | #define DEFAULT_PATH "/proc/driver/aironet/%s/Config" | 21 | #define DEFAULT_PATH "/proc/driver/aironet/%s/Config" |
18 | #define CARD_TYPE_CISCO1 | 22 | #define CARD_TYPE_CISCO1 |
19 | #define CARD_TYPE_NG 2 | 23 | #define CARD_TYPE_NG 2 |
20 | #define CARD_TYPE_HOSTAP3 | 24 | #define CARD_TYPE_HOSTAP3 |
21 | 25 | ||
22 | /* only for now, until we have the daemon running */ | 26 | /* only for now, until we have the daemon running */ |
23 | /*the config file should provide these information */ | 27 | /*the config file should provide these information */ |
24 | #define CARD_TYPE CARD_TYPE_HOSTAP | 28 | #define CARD_TYPE CARD_TYPE_HOSTAP |
25 | #define SBIN_PATH "/sbin/ifconfig %s promisc up" | 29 | #define SBIN_PATH "/sbin/ifconfig %s promisc up" |
26 | #define WLANCTL_PATH "/sbin/wlanctl-ng" | 30 | #define WLANCTL_PATH "/sbin/wlanctl-ng" |
27 | 31 | ||
28 | /* Prototypes */ | 32 | /* Prototypes */ |
29 | int card_into_monitormode (pcap_t **, char *, int); | 33 | int card_into_monitormode (pcap_t **, char *, int); |
30 | int card_set_promisc_up (const char *); | 34 | int card_set_promisc_up (const char *); |
31 | 35 | ||
32 | #endif /* CARDMODE_HH */ | 36 | #endif /* CARDMODE_HH */ |
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh index 713b383..c7108ac 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh | |||
@@ -1,66 +1,70 @@ | |||
1 | /* $Id$ */ | 1 | /* $Id$ */ |
2 | 2 | ||
3 | #ifndef SNIFF_HH | 3 | #ifndef SNIFF_HH |
4 | #define SNIFF_HH | 4 | #define SNIFF_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 <errno.h> | 9 | #include <errno.h> |
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
11 | #include <sys/time.h> | 11 | #include <sys/time.h> |
12 | #include <sys/socket.h> | 12 | #include <sys/socket.h> |
13 | #include <netinet/in.h> | 13 | #include <netinet/in.h> |
14 | #include <arpa/inet.h> | 14 | #include <arpa/inet.h> |
15 | |||
16 | extern "C" | ||
17 | { | ||
15 | #include <net/bpf.h> | 18 | #include <net/bpf.h> |
16 | #include <pcap.h> | 19 | #include <pcap.h> |
20 | } | ||
17 | 21 | ||
18 | #define NONBROADCASTING "non-broadcasting" | 22 | #define NONBROADCASTING "non-broadcasting" |
19 | 23 | ||
20 | /* holds all the interresting data */ | 24 | /* holds all the interresting data */ |
21 | struct packetinfo | 25 | struct packetinfo |
22 | { | 26 | { |
23 | int isvalid; | 27 | int isvalid; |
24 | int pktlen; | 28 | int pktlen; |
25 | int fctype; | 29 | int fctype; |
26 | int fcsubtype; | 30 | int fcsubtype; |
27 | int fc_wep; | 31 | int fc_wep; |
28 | int cap_WEP; | 32 | int cap_WEP; |
29 | int cap_IBSS; | 33 | int cap_IBSS; |
30 | int cap_ESS; | 34 | int cap_ESS; |
31 | int channel; | 35 | int channel; |
32 | char bssid[sizeof("00:00:00:00:00:00") + 1]; | 36 | char bssid[sizeof("00:00:00:00:00:00") + 1]; |
33 | char desthwaddr[sizeof("00:00:00:00:00:00") + 1]; | 37 | char desthwaddr[sizeof("00:00:00:00:00:00") + 1]; |
34 | char sndhwaddr[sizeof("00:00:00:00:00:00") + 1]; | 38 | char sndhwaddr[sizeof("00:00:00:00:00:00") + 1]; |
35 | char ssid[128]; | 39 | char ssid[128]; |
36 | int ssid_len; | 40 | int ssid_len; |
37 | }; | 41 | }; |
38 | 42 | ||
39 | void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int); | 43 | void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int); |
40 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); | 44 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); |
41 | void etheraddr_string(register const u_char *ep,char * text); | 45 | void etheraddr_string(register const u_char *ep,char * text); |
42 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); | 46 | int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); |
43 | 47 | ||
44 | int GetHeaderLength(u_int16_t fc); | 48 | int GetHeaderLength(u_int16_t fc); |
45 | 49 | ||
46 | /* | 50 | /* |
47 | * True if "l" bytes of "var" were captured. | 51 | * True if "l" bytes of "var" were captured. |
48 | * | 52 | * |
49 | * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large | 53 | * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large |
50 | * that "snapend - (l)" underflows. | 54 | * that "snapend - (l)" underflows. |
51 | * | 55 | * |
52 | * The check is for <= rather than < because "l" might be 0. | 56 | * The check is for <= rather than < because "l" might be 0. |
53 | */ | 57 | */ |
54 | #define TTEST2(var, l) (snapend - (l) <= snapend && \ | 58 | #define TTEST2(var, l) (snapend - (l) <= snapend && \ |
55 | (const u_char *)&(var) <= snapend - (l)) | 59 | (const u_char *)&(var) <= snapend - (l)) |
56 | 60 | ||
57 | /* True if "var" was captured */ | 61 | /* True if "var" was captured */ |
58 | #define TTEST(var) TTEST2(var, sizeof(var)) | 62 | #define TTEST(var) TTEST2(var, sizeof(var)) |
59 | 63 | ||
60 | /* Bail if "l" bytes of "var" were not captured */ | 64 | /* Bail if "l" bytes of "var" were not captured */ |
61 | #define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc | 65 | #define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc |
62 | 66 | ||
63 | /* Bail if "var" was not captured */ | 67 | /* Bail if "var" was not captured */ |
64 | #define TCHECK(var) TCHECK2(var, sizeof(var)) | 68 | #define TCHECK(var) TCHECK2(var, sizeof(var)) |
65 | 69 | ||
66 | #endif /* SNIFF_HH */ | 70 | #endif /* SNIFF_HH */ |