3#include <coroio/base.hpp>
4#include <coroio/socket.hpp>
5#include <coroio/poller.hpp>
6#include <coroio/arena.hpp>
52 void Read(
int fd,
void* buf,
int size, std::coroutine_handle<> handle);
61 void Write(
int fd,
const void* buf,
int size, std::coroutine_handle<> handle);
70 void Recv(
int fd,
void* buf,
int size, std::coroutine_handle<> handle);
79 void Send(
int fd,
const void* buf,
int size, std::coroutine_handle<> handle);
88 void Accept(
int fd,
struct sockaddr* addr, socklen_t* len, std::coroutine_handle<> handle);
97 void Connect(
int fd,
const sockaddr* addr, socklen_t len, std::coroutine_handle<> handle);
125 OVERLAPPED overlapped;
127 struct sockaddr* addr =
nullptr;
128 socklen_t* len =
nullptr;
132 memset(&overlapped, 0,
sizeof(overlapped));
143 TArenaAllocator<TIO> Allocator_;
144 std::vector<OVERLAPPED_ENTRY> Entries_;
145 std::queue<int> Results_;
IOCP-based poller for asynchronous I/O on Windows.
Definition iocp.hpp:35
void Register(int fd)
Registers a file descriptor with the IOCP.
void Recv(int fd, void *buf, int size, std::coroutine_handle<> handle)
Posts an asynchronous receive operation.
void Cancel(int fd)
Cancels all pending operations on the specified file descriptor.
void Accept(int fd, struct sockaddr *addr, socklen_t *len, std::coroutine_handle<> handle)
Posts an asynchronous accept operation.
void Send(int fd, const void *buf, int size, std::coroutine_handle<> handle)
Posts an asynchronous send operation.
void Poll()
Polls for IOCP events.
void Read(int fd, void *buf, int size, std::coroutine_handle<> handle)
Posts an asynchronous read operation.
void Connect(int fd, const sockaddr *addr, socklen_t len, std::coroutine_handle<> handle)
Posts an asynchronous connect operation.
int Result()
Retrieves the result of the last completed IOCP operation.
void Write(int fd, const void *buf, int size, std::coroutine_handle<> handle)
Posts an asynchronous write operation.
Base class for pollers managing asynchronous I/O events and timers.
Definition poller.hpp:52
Asynchronous file handle driven by the poller's implementation.
Definition socket.hpp:742
Socket type driven by the poller's implementation.
Definition socket.hpp:519