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

Johannes Berg johannes at sipsolutions.net
Thu Feb 24 15:48:36 EST 2011


On Thu, 2011-02-24 at 22:17 +0200, Jouni Malinen wrote:
> 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).

It seems that it's only used to know when something finished, i.e. going
back to IDLE. I'll ask around and simplify this or get rid of it.

johannes



More information about the HostAP mailing list