Wpa_supplicant : Be notified of a state change

Kel Modderman kelrin
Fri Aug 18 15:26:22 PDT 2006


On Friday 18 August 2006 23:29, Vincent Maurin wrote:
> Hi,
>
> I use wpa supplicant as a library in a Visual Studio project. I
> establishe association and connection successfully.
> I can access to the wpa state with the wpa_supplicant_get_state function.
>
> My code look like this :
>
> wpa_supplicant_associate(...)
> while (state != associated)
> {
>     sleep serveral seconds ....
> }
> echo ("I'm associated !")
>
> It's very bad. I want to do something like this :
>
> event_associated ()
> {
>     echo("I'm associated !")
> }
>
> wpa_supplicant_register_event_associated (event_associated);
> wpa_supplicant_associate()
> ...
>
> I have searched in the code, but I don't find anything already done.
> Is a function register_event_associated implemented in wpa_supplicant or
> I have to do it myself ?

Maybe take a look at wpa_cli_action in wpa_cli.c

It listens to action signals sent to the ctrl_interface, the most interesting 
being CONNECTED and DISCONNECTED.

Thanks, Kel.




More information about the Hostap mailing list