Non-remote control of wpa_supplicant

Jouni Malinen j at
Sat Nov 17 19:49:14 EST 2007

On Tue, Nov 13, 2007 at 10:27:07AM -0800, Ted Merrill wrote:

> The wpa_ctrl feature allows control of wpa_supplicant from another 
> process/program.  For control within the same process/program, calls can be 
> made "directly" to the needed subroutines.
> But one thing that is missing is that there is general way to monitor state 
> changes from within the same process except perhaps by periodic polling.
> I've added the following to my local copy (in wpa_supplicant_i.h):

This looks like a good addition.

> /**
>  * struct wpa_supplicant_cb - State change callback
>  *
>  * Callback function is called AFTER the state is marked as changed.
>  * Information from the callback struct should be obtained via
>  * the access functions (below).
>  */
> struct wpa_supplicant_cb {
>         struct wpa_supplicant_cb *next;
>         struct wpa_supplicant_cb *prev;
>         void (*cb_func)(struct wpa_supplicant_cb *cb);
>         struct wpa_supplicant *wpa_s;
>         void *cookie;   /* passed to cb */
> };

I normally use callback functions that take a void* context argument
which, I would assume, this cookie value is for. Is there any particular
reason for passing struct wpa_supplicant_cb to the callback? The
next/prev pointers look internal to the list implementation and it might
be clearner to just pass in wpa_s and cookie as the cb_func arguments
(cookie could be registered with _cb_create, so no need for a separate
_cb_cookie_set functions).

Jouni Malinen                                            PGP id EFC895FA

More information about the HostAP mailing list