PATCH: read driver data
Gunter Burchardt
gbur
Tue Jul 20 01:29:58 PDT 2004
Hello Jouni
I saw you opened version 0.3.0 of hostapd. I would like to bring my
wired authenticator stuff to hostapd. But at the moment the diff is a
bit to huge. To make it more easy I have some things on my todo:
1. driver independent function pointers
* read of driver data (this patch)
* remove_sta
* flush
2. driver driven initialisation of hostapd
Which parts of hostapd must be started/initialised. Some driver
didn't neet 802.11 management ...
3. bring other drivers to hostapd
* wired
regards
gunter
-------------- next part --------------
diff -Nur hostap/hostapd/accounting.c hostap.new/hostapd/accounting.c
--- hostap/hostapd/accounting.c 2004-07-18 21:42:23.000000000 +0200
+++ hostap.new/hostapd/accounting.c 2004-07-20 09:36:47.000000000 +0200
@@ -168,8 +168,13 @@
struct sta_info *sta,
struct hostap_sta_driver_data *data)
{
- if (hostapd_read_sta_driver_data(hapd->driver.data, data, sta->addr))
+ if (hapd->driver.read_sta_data) {
+ if (hapd->driver.read_sta_data(hapd->driver.data, data,
+ sta->addr))
+ return -1;
+ }else{
return -1;
+ }
if (sta->last_rx_bytes > data->rx_bytes)
sta->acct_input_gigawords++;
diff -Nur hostap/hostapd/driver.c hostap.new/hostapd/driver.c
--- hostap/hostapd/driver.c 2004-07-18 21:09:49.000000000 +0200
+++ hostap.new/hostapd/driver.c 2004-07-20 09:37:23.000000000 +0200
@@ -298,9 +298,9 @@
}
-int hostapd_read_sta_driver_data(void *priv,
- struct hostap_sta_driver_data *data,
- u8 *addr)
+static int hostapd_read_sta_driver_data(void *priv,
+ struct hostap_sta_driver_data *data,
+ u8 *addr)
{
struct hostap_driver_data *drv = priv;
char buf[1024], line[128], *pos;
@@ -617,6 +617,7 @@
hapd->driver.set_sta_authorized = hostapd_set_sta_authorized;
hapd->driver.send_eapol = hostapd_send_eapol;
hapd->driver.send_mgmt_frame = hostapd_send_mgmt_frame;
+ hapd->driver.read_sta_data = hostapd_read_sta_driver_data;
return 0;
}
@@ -629,6 +630,7 @@
hapd->driver.set_sta_authorized = NULL;
hapd->driver.send_eapol = NULL;
hapd->driver.send_mgmt_frame = NULL;
+ hapd->driver.read_sta_data = NULL;
(void) hostapd_set_iface_flags(drv, 0);
(void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_HOSTAPD, 0);
diff -Nur hostap/hostapd/driver.h hostap.new/hostapd/driver.h
--- hostap/hostapd/driver.h 2004-06-20 18:22:24.000000000 +0200
+++ hostap.new/hostapd/driver.h 2004-07-20 09:38:06.000000000 +0200
@@ -1,10 +1,6 @@
#ifndef DRIVER_H
#define DRIVER_H
-struct hostap_sta_driver_data {
- unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
-};
-
struct hostap_driver_data {
struct hostapd_data *hapd;
@@ -26,9 +22,6 @@
int hostapd_get_seqnum(void *priv, u8 *addr, int idx, u8 *seq);
void remove_sta(void *priv, u8 *addr);
int hostapd_flush(void *priv);
-int hostapd_read_sta_driver_data(void *priv,
- struct hostap_sta_driver_data *data,
- u8 *addr);
int hostapd_set_generic_elem(void *priv,
const char *elem, size_t elem_len);
int hostapd_wireless_event_init(void *priv);
diff -Nur hostap/hostapd/hostapd.h hostap.new/hostapd/hostapd.h
--- hostap/hostapd/hostapd.h 2004-06-20 18:22:24.000000000 +0200
+++ hostap.new/hostapd/hostapd.h 2004-07-20 09:21:05.000000000 +0200
@@ -29,6 +29,10 @@
*/
} __attribute__ ((packed));
+struct hostap_sta_driver_data {
+ unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
+};
+
#define IEEE80211_DA_FROMDS addr1
#define IEEE80211_BSSID_FROMDS addr2
#define IEEE80211_SA_FROMDS addr3
@@ -49,6 +53,8 @@
struct driver_info {
void *data; /* driver specific data - each driver can store data for
* its own use in this pointer */
+ int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
+ u8 *addr);
int (*send_mgmt_frame)(void *priv, const void *msg, size_t len,
int flags);
int (*send_eapol)(void *driver, u8 *addr, u8 *data, size_t data_len,
More information about the Hostap
mailing list