Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh index 4a95956..b35dddd 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh | |||
@@ -26,23 +26,68 @@ extern "C" | |||
26 | #include <net/bpf.h> | 26 | #include <net/bpf.h> |
27 | #include <pcap.h> | 27 | #include <pcap.h> |
28 | } | 28 | } |
29 | 29 | ||
30 | /* Defines, used for the card setup */ | 30 | /* Defines, used for the card setup */ |
31 | #define DEFAULT_PATH "/proc/driver/aironet/%s/Config" | 31 | #define DEFAULT_PATH "/proc/driver/aironet/%s/Config" |
32 | #define CISCO_STATUS "/proc/driver/aironet/%s/Status" | 32 | #define CISCO_STATUS "/proc/driver/aironet/%s/Status" |
33 | #define CARD_TYPE_CISCO 1 | 33 | #define CARD_TYPE_CISCO 1 |
34 | #define CARD_TYPE_NG 2 | 34 | #define CARD_TYPE_NG 2 |
35 | #define CARD_TYPE_HOSTAP3 | 35 | #define CARD_TYPE_HOSTAP3 |
36 | #define CARD_TYPE_ORINOCCO 4 | 36 | #define CARD_TYPE_ORINOCCO 4 |
37 | 37 | ||
38 | /* Some usefull constants for frequencies */ | ||
39 | #define KILO 1e3 | ||
40 | #define MEGA 1e6 | ||
41 | #define GIGA 1e9 | ||
42 | |||
43 | |||
38 | /* only for now, until we have the daemon running */ | 44 | /* only for now, until we have the daemon running */ |
39 | /*the config file should provide these information */ | 45 | /*the config file should provide these information */ |
40 | #define CARD_TYPE CARD_TYPE_HOSTAP | 46 | #define CARD_TYPE CARD_TYPE_HOSTAP |
41 | 47 | ||
42 | /* Prototypes */ | 48 | /* Prototypes */ |
43 | int card_check_rfmon_datalink (char *device); | 49 | int card_check_rfmon_datalink (const char *device); |
44 | int card_into_monitormode (pcap_t **, char *, int); | 50 | int card_into_monitormode (pcap_t **, const char *, int); |
45 | int card_set_promisc_up (const char *); | 51 | int card_set_promisc_up (const char *); |
46 | int card_set_channel (const char *device, int channel,int cardtype); | 52 | int card_set_channel (const char *device, int channel,int cardtype); |
53 | int iw_get_range_info(int skfd, const char * ifname, struct iw_range * range); | ||
54 | double iw_freq2float(iw_freq * in); | ||
55 | void iw_float2freq(double in, iw_freq *out); | ||
56 | int card_detect_channels (char * device); | ||
57 | |||
58 | |||
59 | /*------------------------------------------------------------------*/ | ||
60 | /* | ||
61 | * Wrapper to push some Wireless Parameter in the driver | ||
62 | */ | ||
63 | static inline int | ||
64 | iw_set_ext(int skfd, /* Socket to the kernel */ | ||
65 | char * ifname, /* Device name */ | ||
66 | int request,/* WE ID */ | ||
67 | struct iwreq * pwrq) /* Fixed part of the request */ | ||
68 | { | ||
69 | /* Set device name */ | ||
70 | strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | ||
71 | /* Do the request */ | ||
72 | return(ioctl(skfd, request, pwrq)); | ||
73 | } | ||
74 | |||
75 | /*------------------------------------------------------------------*/ | ||
76 | /* | ||
77 | * Wrapper to extract some Wireless Parameter out of the driver | ||
78 | */ | ||
79 | static inline int | ||
80 | iw_get_ext(int skfd, /* Socket to the kernel */ | ||
81 | char * ifname, /* Device name */ | ||
82 | int request,/* WE ID */ | ||
83 | struct iwreq * pwrq) /* Fixed part of the request */ | ||
84 | { | ||
85 | /* Set device name */ | ||
86 | strncpy(pwrq->ifr_name, ifname, IFNAMSIZ); | ||
87 | /* Do the request */ | ||
88 | return(ioctl(skfd, request, pwrq)); | ||
89 | } | ||
90 | |||
91 | |||
47 | 92 | ||
48 | #endif /* CARDMODE_HH */ | 93 | #endif /* CARDMODE_HH */ |