afd: clean up header, move some definitions

This commit is contained in:
Bert Belder 2017-09-03 22:55:54 +02:00
parent d7d3a80bdd
commit 7de1d61227
2 changed files with 16 additions and 24 deletions

View File

@ -1,7 +1,17 @@
#include "afd.h"
#include "error.h"
#include "nt.h"
#include "win.h"
#define FILE_DEVICE_NETWORK 0x00000012
#define METHOD_BUFFERED 0
#define AFD_POLL 9
#define _AFD_CONTROL_CODE(operation, method) \
((FILE_DEVICE_NETWORK) << 12 | (operation << 2) | method)
#define IOCTL_AFD_POLL _AFD_CONTROL_CODE(AFD_POLL, METHOD_BUFFERED)
int afd_poll(SOCKET socket, AFD_POLL_INFO* info, OVERLAPPED* overlapped) {
IO_STATUS_BLOCK iosb;
IO_STATUS_BLOCK* iosb_ptr;

View File

@ -1,22 +1,14 @@
#ifndef EPOLL_AFD_H_
#define EPOLL_AFD_H_
#include "nt.h"
#include "ntstatus.h"
#include "win.h"
#ifndef FILE_DEVICE_NETWORK
#define FILE_DEVICE_NETWORK 0x00000012
#endif
#ifndef METHOD_BUFFERED
#define METHOD_BUFFERED 0
#endif
/* clang-format off */
#define AFD_NO_FAST_IO 0x00000001
#define AFD_OVERLAPPED 0x00000002
#define AFD_IMMEDIATE 0x00000004
#define AFD_NO_FAST_IO 0x00000001
#define AFD_OVERLAPPED 0x00000002
#define AFD_IMMEDIATE 0x00000004
#define AFD_POLL_RECEIVE_BIT 0
#define AFD_POLL_RECEIVE (1 << AFD_POLL_RECEIVE_BIT)
@ -40,21 +32,11 @@
#define AFD_POLL_QOS (1 << AFD_POLL_QOS_BIT)
#define AFD_POLL_GROUP_QOS_BIT 10
#define AFD_POLL_GROUP_QOS (1 << AFD_POLL_GROUP_QOS_BIT)
#define AFD_NUM_POLL_EVENTS 11
#define AFD_POLL_ALL ((1 << AFD_NUM_POLL_EVENTS) - 1)
/* clang-format on */
#define FSCTL_AFD_BASE FILE_DEVICE_NETWORK
#define _AFD_CONTROL_CODE(operation, method) \
((FSCTL_AFD_BASE) << 12 | (operation << 2) | method)
#define AFD_POLL 9
#define IOCTL_AFD_POLL _AFD_CONTROL_CODE(AFD_POLL, METHOD_BUFFERED)
typedef struct _AFD_POLL_HANDLE_INFO {
HANDLE Handle;
ULONG Events;
@ -68,6 +50,8 @@ typedef struct _AFD_POLL_INFO {
AFD_POLL_HANDLE_INFO Handles[1];
} AFD_POLL_INFO, *PAFD_POLL_INFO;
int afd_poll(SOCKET socket, AFD_POLL_INFO* info, OVERLAPPED* overlapped);
static const GUID AFD_PROVIDER_IDS[] = {
{0xe70f1aa0,
0xab8b,
@ -82,6 +66,4 @@ static const GUID AFD_PROVIDER_IDS[] = {
0x43e4,
{0xb7, 0xbd, 0x18, 0x1f, 0x20, 0x89, 0x79, 0x2a}}};
int afd_poll(SOCKET socket, AFD_POLL_INFO* info, OVERLAPPED* overlapped);
#endif /* EPOLL_AFD_H_ */