Describes a single asynchronous operation submitted to the Proactor.
More...
#include <io_operation.hpp>
|
| enum class | State : uint8_t { Idle
, Submitted
, Cancelling
} |
| | operation lifecycle state. More...
|
| |
| enum class | Opcode : uint8_t {
Accept
, Connect
, Read
, Write
,
ReadFixed
, WriteFixed
, RecvMsg
, SendMsg
,
Recv
, Send
} |
| | operation code. More...
|
| |
|
| int | fd () const noexcept |
| | return the file descriptor associated with this operation.
|
| |
|
| static IoOperation | makeAccept (int fd, sockaddr *addr, socklen_t *addrlen, int flags, CompletionHandler *handler) noexcept |
| | build an accept operation.
|
| |
| static IoOperation | makeConnect (int fd, const sockaddr *addr, socklen_t addrlen, CompletionHandler *handler) noexcept |
| | build a connect operation.
|
| |
| static IoOperation | makeRead (int fd, void *buf, uint32_t len, CompletionHandler *handler, bool linked=false) noexcept |
| | build a regular read operation.
|
| |
| static IoOperation | makeWrite (int fd, const void *buf, uint32_t len, CompletionHandler *handler, bool linked=false) noexcept |
| | build a regular write operation.
|
| |
| static IoOperation | makeReadFixed (int fd, void *buf, uint32_t len, uint16_t index, CompletionHandler *handler, bool linked=false) noexcept |
| | build a fixed-buffer read operation.
|
| |
| static IoOperation | makeWriteFixed (int fd, const void *buf, uint32_t len, uint16_t index, CompletionHandler *handler, bool linked=false) noexcept |
| | build a fixed-buffer write operation.
|
| |
| static IoOperation | makeRecvmsg (int fd, msghdr *msg, int flags, CompletionHandler *handler, bool linked=false) noexcept |
| | build a receive-message operation.
|
| |
| static IoOperation | makeSendmsg (int fd, const msghdr *msg, int flags, CompletionHandler *handler, bool linked=false) noexcept |
| | build a send-message operation.
|
| |
| static IoOperation | makeRecv (int fd, void *buf, uint32_t len, int flags, CompletionHandler *handler, bool linked=false) noexcept |
| | build a receive operation.
|
| |
| static IoOperation | makeSend (int fd, const void *buf, uint32_t len, int flags, CompletionHandler *handler, bool linked=false) noexcept |
| | build a send operation.
|
| |
|
| uint8_t | code = 0 |
| | operation code.
|
| |
| State | state = State::Idle |
| | operation state.
|
| |
| uint32_t | index = 0 |
| | index of this operation in the proactor pending ops (io_uring only).
|
| |
| bool | linked = false |
| | link this SQE to the next one (next executes only if this succeeds, io_uring only).
|
| |
| CompletionHandler * | handler = nullptr |
| | handler to dispatch to on completion.
|
| |
| Data | data = {} |
| | operation code specific payload.
|
| |
Describes a single asynchronous operation submitted to the Proactor.
◆ Opcode
operation code.
| Enumerator |
|---|
| Accept | accept an incoming connection.
|
| Connect | initiate an outgoing connection.
|
| Read | read from a file descriptor.
|
| Write | write to a file descriptor.
|
| ReadFixed | read using a registered buffer.
|
| WriteFixed | write using a registered buffer.
|
| RecvMsg | receive a message with ancillary data.
|
| SendMsg | send a message with ancillary data.
|
| Recv | receive data from a socket.
|
| Send | send data on a socket.
|
◆ State
operation lifecycle state.
| Enumerator |
|---|
| Idle | operation is not in flight.
|
| Submitted | operation has been submitted and is awaiting completion.
|
| Cancelling | operation has been canceled and is awaiting completion.
|
◆ fd()
| int IoOperation::fd |
( |
| ) |
const |
|
noexcept |
return the file descriptor associated with this operation.
- Returns
- file descriptor, or -1 if opcode is unknown.
◆ makeAccept()
build an accept operation.
- Parameters
-
| fd | listening socket file descriptor. |
| addr | peer address. |
| addrlen | peer address length. |
| flags | accept flags. |
| handler | handler to notify on completion. |
- Returns
- initialized IoOperation.
◆ makeConnect()
build a connect operation.
- Parameters
-
| fd | socket file descriptor. |
| addr | remote address. |
| addrlen | remote address length. |
| handler | handler to notify on completion. |
- Returns
- initialized IoOperation.
◆ makeRead()
build a regular read operation.
- Parameters
-
| fd | file descriptor to read from. |
| buf | destination buffer. |
| len | number of bytes to read. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeReadFixed()
| IoOperation IoOperation::makeReadFixed |
( |
int | fd, |
|
|
void * | buf, |
|
|
uint32_t | len, |
|
|
uint16_t | index, |
|
|
CompletionHandler * | handler, |
|
|
bool | linked = false ) |
|
staticnoexcept |
build a fixed-buffer read operation.
- Parameters
-
| fd | file descriptor to read from. |
| buf | destination buffer. |
| len | number of bytes to read. |
| index | registered buffer index. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeRecv()
build a receive operation.
- Parameters
-
| fd | socket file descriptor. |
| buf | destination buffer. |
| len | number of bytes to receive. |
| flags | recv flags. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeRecvmsg()
build a receive-message operation.
- Parameters
-
| fd | socket file descriptor. |
| msg | message header. |
| flags | recv flags. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeSend()
build a send operation.
- Parameters
-
| fd | socket file descriptor. |
| buf | source buffer. |
| len | number of bytes to send. |
| flags | send flags. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeSendmsg()
build a send-message operation.
- Parameters
-
| fd | socket file descriptor. |
| msg | message header. |
| flags | send flags. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeWrite()
build a regular write operation.
- Parameters
-
| fd | file descriptor to write to. |
| buf | source buffer. |
| len | number of bytes to write. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ makeWriteFixed()
| IoOperation IoOperation::makeWriteFixed |
( |
int | fd, |
|
|
const void * | buf, |
|
|
uint32_t | len, |
|
|
uint16_t | index, |
|
|
CompletionHandler * | handler, |
|
|
bool | linked = false ) |
|
staticnoexcept |
build a fixed-buffer write operation.
- Parameters
-
| fd | file descriptor to write to. |
| buf | source buffer. |
| len | number of bytes to write. |
| index | registered buffer index. |
| handler | handler to notify on completion. |
| linked | link this SQE to the next one (io_uring only). |
- Returns
- initialized IoOperation.
◆ code
| uint8_t join::IoOperation::code = 0 |
◆ data
| Data join::IoOperation::data = {} |
operation code specific payload.
◆ handler
handler to dispatch to on completion.
◆ index
| uint32_t join::IoOperation::index = 0 |
index of this operation in the proactor pending ops (io_uring only).
◆ linked
| bool join::IoOperation::linked = false |
link this SQE to the next one (next executes only if this succeeds, io_uring only).
◆ state
The documentation for this struct was generated from the following files: