*  I discovered yesterday that in the particular case of winsock, that
overlapped io support is required, and (supposedly) has been implemented in
CE and is available via the WSA versions of those methods (e.g.
WSAGetOverlappedResult).  This is really good news because it possibly means
that all the socket.c work will not have to be reworked at all.  Hopefully!

So I think that only the five various tun_* and *_tun methods need to be
implemented to declare this 'feature complete' and then the exciting phase
of testing/fixing begins.

The Windows version of OpenVPN currently wants overlapped I/O to be supported by the OS. The reason why overlapped I/O was originally used (rather than unix-style select or poll) is so that the event loop could treat TAP device events the same as network socket events, and handle network and TAP events within a single event loop.

The root of the problem is that Windows supports two incompatible (as far as I know) I/O wait event spaces: there is the SOCKET type which can be used as an argument to select() and then there's the HANDLE (returned by CreateEvent) which is used as an argument to WaitForSingleObject/WaitForMultipleObjects. Currently the Windows version of OpenVPN uses the HANDLE space which unfortunately makes the I/O code more complex than would be the case under unix.

However if we could figure out a way to allow select() to poll on the TAP device handle as well as network sockets, then we could do away with Windows overlapped I/O -- that would move us into the SOCKET event space which is much more reasonable to deal with, and compatible with unix event I/O semantics (such as select()).

James


Reply via email to