[patch] Add eloop support for write & error socket callbacks

Jouni Malinen jkmaline
Tue Mar 21 19:16:06 PST 2006


On Tue, Mar 21, 2006 at 06:21:25PM -0500, Dan Williams wrote:

> Patch attached, against current 0.4 HEAD.  Write and error callbacks are
> needed for DBUS support, which I plan to add in the next month or so for
> a DBUS-enabled control interface.

Thanks! The implementation itself looks fine, but I need to think about
the interface bit more closely from the view point of non-UNIX systems
that may not have select() or even BSD sockets.. The proposed changes
would make this interface very similar to select() features and that may
not be the best choice for this.

> I'd rather have done one function for registering read, write, and error
> callbacks and use an enum or something to figure out which type, but
> that breaks source compatibility for the rest of the code and that
> sucks.  This patch should work without changes to any part other than
> eloop.

Indeed.. I would not accept this if all places using eloop would need to
be changed. However, it should be possible to add a new function for
doing the registration as long as the existing API is implemented as a
wrapper on top of this new interface. This would allow new code to use
the new function while the old code would still work as-is.

Using a single function for this and maybe even changing the callback
functions to include an extra parameter, event type, could be a cleaner
solution for this. There would be only one eloop_sock_table and it would
have bitmask of which events (read/write/error) are registered to be
received.

-- 
Jouni Malinen                                            PGP id EFC895FA




More information about the Hostap mailing list