1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-17 11:00:59 -05:00

Grow some nasty warts on the side of winhandl.c, in preparation for

a serial port backend:
 - In order to do simultaneous reading and writing on the same
   HANDLE, you must enable overlapped access and pass an OVERLAPPED
   structure to each ReadFile and WriteFile call. This would make
   sense if it were an optional thing I could do if I wanted to do
   the reading and writing in the same thread, but making it
   mandatory even if I'm doing them in _different_ threads is just
   annoying and arbitrary.
 - Serial ports occasionally return length 0 from ReadFile, for no
   particularly good reason. Fortunately serial ports also don't
   have a real EOF condition to speak of, so ignoring EOFs is
   actually a viable response in spite of sounding utterly gross.
Hence, handle_{input,output}_new() now accept a flags parameter,
which includes a flag to enable the OVERLAPPED bureaucracy and a
flag to cause EOFs to be ignored on input handles. The current
clients of winhandl.c do not use either of these.

[originally from svn r6813]
This commit is contained in:
Simon Tatham
2006-08-27 10:00:36 +00:00
parent 3dc4063f69
commit 17bc654532
4 changed files with 55 additions and 12 deletions

View File

@ -408,13 +408,15 @@ void init_ucs(Config *, struct unicode_data *);
/*
* Exports from winhandl.c.
*/
#define HANDLE_FLAG_OVERLAPPED 1
#define HANDLE_FLAG_IGNOREEOF 2
struct handle;
typedef int (*handle_inputfn_t)(struct handle *h, void *data, int len);
typedef void (*handle_outputfn_t)(struct handle *h, int new_backlog);
struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata,
void *privdata);
void *privdata, int flags);
struct handle *handle_output_new(HANDLE handle, handle_outputfn_t sentdata,
void *privdata);
void *privdata, int flags);
int handle_write(struct handle *h, const void *data, int len);
HANDLE *handle_get_events(int *nevents);
void handle_free(struct handle *h);