Wired

Jouni Malinen jkmaline at cc.hut.fi
Sun Jun 6 13:15:36 EDT 2004


On Sun, Jun 06, 2004 at 10:58:42AM +0200, Gunter Burchardt wrote:

> I would like to introduce a pointer to driver_info like this:
> 
> hostapd.h:
> struct driver_info {
>     void *data; /* driver specific data */ 
>     void (*set_sta_authorized)(struct hostapd_data *hapd,
>                    struct sta_info *sta, int authorized);

> driver.h:
> #define DRIVER_DATA(hapd) ((struct hostap_driver_data
> *)(hapd->driver->data))

This is otherwise ok, but I would try to avoid derefering hapd pointer
within the driver handler functions to make it somewhat more modular. In
other words, the registered driver functions would take an additional
argument, e.g., void *priv, and if not needed, hapd pointer could be
removed completely from most if not all calls. That DRIVER_DATA macro
could then be replaced by the handler function doing

struct hostap_driver_data *drv = priv;

Actually, the hapd pointer could be removed from all calls and if it is
needed somewhere until a cleaner solution is ready, the private driver
data structure could include hapd pointer from the hostapd_driver_init()
(or matching) function.

> Each driver can store driver specific data in this pointer. Its the
> first step to enable hostapd to use other drivers. But I'm not happy
> about the typecast. Do you have a better idea? 

This seems to be the best way to do it and I'm ok with it.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the HostAP mailing list