1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Centralise implementations of Windows do_select().

Windows Plink and PSFTP had very similar implementations, and now they
share one that lives in a new file winselcli.c. I've similarly moved
GUI PuTTY's implementation out of window.c into winselgui.c, where
other GUI programs wanting to do networking will be able to access
that too.

In the spirit of centralisation, I've also taken the opportunity to
make both functions use the reasonably complete winsock_error_string()
rather than (for some historical reason) each inlining a minimal
version that reports most errors as 'unknown'.
This commit is contained in:
Simon Tatham
2020-01-01 11:10:22 +00:00
parent ae1148267d
commit b89d17fbca
7 changed files with 147 additions and 99 deletions

View File

@ -319,6 +319,8 @@ bool socket_writable(SOCKET skt);
void socket_reselect_all(void);
/* Make a SockAddr which just holds a named pipe address. */
SockAddr *sk_namedpipe_addr(const char *pipename);
/* Turn a WinSock error code into a string. */
const char *winsock_error_string(int error);
/*
* winnet.c dynamically loads WinSock 2 or WinSock 1 depending on
@ -347,11 +349,22 @@ DECL_WINDOWS_FUNCTION(GLOBAL, int, select,
#endif
/*
* Provided by each client of winnet.c, and called by winnet.c to turn
* on or off WSA*Select for a given socket.
* Implemented differently depending on the client of winnet.c, and
* called by winnet.c to turn on or off WSA*Select for a given socket.
*/
char *do_select(SOCKET skt, bool enable);
/*
* Exports from winselgui.c and winselcli.c, each of which provides an
* implementation of do_select.
*/
void winselgui_set_hwnd(HWND hwnd);
void winselgui_clear_hwnd(void);
void winselcli_setup(void);
SOCKET winselcli_unique_socket(void);
extern HANDLE winselcli_event;
/*
* Network-subsystem-related functions provided in other Windows modules.
*/