2011-03-23 12:56:06 +00:00
|
|
|
|
2011-03-30 03:03:56 +00:00
|
|
|
#include <winsock2.h>
|
|
|
|
|
#include <mswsock.h>
|
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
2011-03-23 12:56:06 +00:00
|
|
|
|
|
|
|
|
/**
|
2011-04-07 09:02:54 +00:00
|
|
|
* It should be possible to cast oio_buf[] to WSABUF[]
|
2011-03-30 03:03:56 +00:00
|
|
|
* see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
|
2011-03-23 12:56:06 +00:00
|
|
|
*/
|
2011-04-07 09:02:54 +00:00
|
|
|
typedef struct oio_buf {
|
2011-03-30 03:03:56 +00:00
|
|
|
ULONG len;
|
|
|
|
|
char* base;
|
2011-04-07 09:02:54 +00:00
|
|
|
} oio_buf;
|
2011-03-28 08:55:29 +00:00
|
|
|
|
2011-04-07 09:02:54 +00:00
|
|
|
struct oio_req_s {
|
|
|
|
|
struct oio_req_shared_s;
|
2011-03-28 08:55:29 +00:00
|
|
|
OVERLAPPED overlapped;
|
2011-03-30 05:19:17 +00:00
|
|
|
int flags;
|
2011-04-07 02:51:59 +00:00
|
|
|
};
|
2011-03-30 03:03:56 +00:00
|
|
|
|
|
|
|
|
typedef struct {
|
2011-04-07 09:02:54 +00:00
|
|
|
oio_req req;
|
2011-04-07 02:51:59 +00:00
|
|
|
SOCKET socket;
|
|
|
|
|
|
|
|
|
|
/* AcceptEx specifies that the buffer must be big enough to at least hold */
|
|
|
|
|
/* two socket addresses plus 32 bytes. */
|
|
|
|
|
char buffer[sizeof(struct sockaddr_storage) * 2 + 32];
|
2011-04-07 09:02:54 +00:00
|
|
|
} oio_accept_data;
|
2011-04-07 02:51:59 +00:00
|
|
|
|
2011-04-07 09:02:54 +00:00
|
|
|
struct oio_handle_s {
|
|
|
|
|
struct oio_handle_shared_s;
|
2011-03-30 03:03:56 +00:00
|
|
|
union {
|
|
|
|
|
SOCKET socket;
|
|
|
|
|
HANDLE handle;
|
|
|
|
|
};
|
2011-04-07 09:02:54 +00:00
|
|
|
oio_accept_data *accept_data;
|
2011-04-04 23:41:53 +00:00
|
|
|
unsigned int flags;
|
|
|
|
|
unsigned int reqs_pending;
|
2011-04-07 09:02:54 +00:00
|
|
|
oio_err error;
|
2011-04-07 02:51:59 +00:00
|
|
|
};
|