void *privdata; /* for client to remember who they are */
};
-typedef enum { INPUT, OUTPUT, FOREIGN } HandleType;
+typedef enum { HT_INPUT, HT_OUTPUT, HT_FOREIGN } HandleType;
/* ----------------------------------------------------------------------
* Input threads.
struct handle *h = snew(struct handle);
DWORD in_threadid; /* required for Win9x */
- h->type = INPUT;
+ h->type = HT_INPUT;
h->u.i.h = handle;
h->u.i.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL);
h->u.i.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL);
struct handle *h = snew(struct handle);
DWORD out_threadid; /* required for Win9x */
- h->type = OUTPUT;
+ h->type = HT_OUTPUT;
h->u.o.h = handle;
h->u.o.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL);
h->u.o.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL);
{
struct handle *h = snew(struct handle);
- h->type = FOREIGN;
+ h->type = HT_FOREIGN;
h->u.f.h = INVALID_HANDLE_VALUE;
h->u.f.ev_to_main = event;
h->u.f.ev_from_main = INVALID_HANDLE_VALUE;
int handle_write(struct handle *h, const void *data, int len)
{
- assert(h->type == OUTPUT);
+ assert(h->type == HT_OUTPUT);
assert(h->u.o.outgoingeof == EOF_NO);
bufchain_add(&h->u.o.queued_data, data, len);
handle_try_output(&h->u.o);
* bidirectional handle if we're still interested in its incoming
* direction!
*/
- assert(h->type == OUTPUT);
+ assert(h->type == HT_OUTPUT);
if (!h->u.o.outgoingeof == EOF_NO) {
h->u.o.outgoingeof = EOF_PENDING;
handle_try_output(&h->u.o);
static void handle_destroy(struct handle *h)
{
- if (h->type == OUTPUT)
+ if (h->type == HT_OUTPUT)
bufchain_clear(&h->u.o.queued_data);
CloseHandle(h->u.g.ev_from_main);
CloseHandle(h->u.g.ev_to_main);
switch (h->type) {
int backlog;
- case INPUT:
+ case HT_INPUT:
h->u.i.busy = FALSE;
/*
}
break;
- case OUTPUT:
+ case HT_OUTPUT:
h->u.o.busy = FALSE;
/*
}
break;
- case FOREIGN:
+ case HT_FOREIGN:
/* Just call the callback. */
h->u.f.callback(h->u.f.ctx);
break;
void handle_unthrottle(struct handle *h, int backlog)
{
- assert(h->type == INPUT);
+ assert(h->type == HT_INPUT);
handle_throttle(&h->u.i, backlog);
}
int handle_backlog(struct handle *h)
{
- assert(h->type == OUTPUT);
+ assert(h->type == HT_OUTPUT);
return bufchain_size(&h->u.o.queued_data);
}