[RFC 17/40] P2P/wpa_s: add notification for P2P state changes

Jouni Malinen j
Thu Feb 24 12:17:19 PST 2011

On Wed, Jan 05, 2011 at 08:53:13PM +0100, Johannes Berg wrote:

>  	p2p->state = new_state;
> +
> +	p2p->cfg->state_changed(p2p->cfg->cb_ctx, new_state);

> diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
> +	 * This callback is used to inform that state machine progressed
> +	 */
> +	void (*state_changed)(void *ctx, int state);

What would the recipient of this callback do? Please note that the enum
p2p_state is private information within the P2P module and the callback
function would have no way of mapping the state value to anything
useful. Especially exposing this through D-Bus interface is quite
questionable. These values can be changed whenever there is a design
change within the P2P module and I do not want to get stuck having to
maintain these internal values the same because they get exposed to
other applications. If this type of state tracking is really needed, it
will need to use a set of values that are defined in src/p2p/p2p.h
instead of p2p_i.h (and just moving enum p2p_state into p2p.h is not
the answer here).

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list