|
join 1.0
lightweight network framework library
|
asynchronous stream acceptor class. More...
#include <async_acceptor.hpp>


Public Types | |
| using | Acceptor = BasicStreamAcceptor<Protocol> |
| using | Endpoint = typename Protocol::Endpoint |
| using | Socket = typename Protocol::Socket |
| using | AsyncAccept = BasicAsyncAccept<Protocol, Proactor> |
| using | AcceptHandler = typename AsyncAccept::Accept |
Public Member Functions | |
| BasicAsyncStreamAcceptor (Proactor &proactor=ProactorThread::proactor()) | |
| create the acceptor instance. | |
| BasicAsyncStreamAcceptor (const BasicAsyncStreamAcceptor &other)=delete | |
| copy constructor. | |
| BasicAsyncStreamAcceptor & | operator= (const BasicAsyncStreamAcceptor &other)=delete |
| copy assignment operator. | |
| BasicAsyncStreamAcceptor (BasicAsyncStreamAcceptor &&other)=delete | |
| move constructor. | |
| BasicAsyncStreamAcceptor & | operator= (BasicAsyncStreamAcceptor &&other)=delete |
| move assignment operator. | |
| ~BasicAsyncStreamAcceptor () | |
| destroy the acceptor instance. | |
| int | create (const Endpoint &endpoint, int flags=SOCK_CLOEXEC|SOCK_NONBLOCK) noexcept |
| create acceptor. | |
| void | close () noexcept |
| close acceptor, cancelling the acceptation in flight. | |
| ssize_t | asyncAccept (AcceptHandler handler, int flags=SOCK_NONBLOCK|SOCK_CLOEXEC, bool flush=true) noexcept |
| start an asynchronous acceptation. | |
| ssize_t | asyncAcceptMulti (AcceptHandler handler, int flags=SOCK_NONBLOCK|SOCK_CLOEXEC, bool flush=true) noexcept |
| start an asynchronous multishot acceptation, staying armed until cancelled or failed. | |
| int | cancel () noexcept |
| cancel the acceptation in flight, if any. | |
| Endpoint | localEndpoint () const |
| determine the local endpoint associated with this acceptor. | |
| bool | opened () const noexcept |
| check if the acceptor is opened. | |
| int | family () const noexcept |
| get address family. | |
| int | type () const noexcept |
| get the acceptor communication semantic. | |
| int | protocol () const noexcept |
| get acceptor protocol. | |
| int | handle () const noexcept |
| get acceptor native handle. | |
Public Member Functions inherited from join::CompletionHandler | |
| CompletionHandler ()=default | |
| create instance. | |
| CompletionHandler (const CompletionHandler &other)=default | |
| copy constructor. | |
| CompletionHandler & | operator= (const CompletionHandler &other)=default |
| copy assignment operator. | |
| CompletionHandler (CompletionHandler &&other)=default | |
| move constructor. | |
| CompletionHandler & | operator= (CompletionHandler &&other)=default |
| move assignment operator. | |
| virtual | ~CompletionHandler ()=default |
| destroy instance. | |
Protected Member Functions | |
| void | onComplete (IoOperation &op, int result) override |
| method called when an operation completes. | |
| void | onCancel (IoOperation &op, int result) override |
| method called when an operation is cancelled. | |
| virtual void | dispatch (IoOperation &op, const std::error_code &code, size_t size) noexcept |
| invoke the completion handler of the given operation. | |
| void | completeAccept (AsyncAccept *accept, const std::error_code &code, size_t handle) noexcept |
| invoke the accept completion handler. | |
| bool | armOp () noexcept |
| reserve the accept operation for submission. | |
| void | disarmOp (IoOperation::State expected) noexcept |
| release the accept operation reservation. | |
| bool | inFlight (const IoOperation &op) const noexcept |
| check if an operation is in flight. | |
| bool | pending (const IoOperation &op) const noexcept |
| check if an operation is in flight or completing. | |
Protected Member Functions inherited from join::CompletionHandler | |
asynchronous stream acceptor class.
| using join::BasicAsyncStreamAcceptor< Protocol, Proactor >::AcceptHandler = typename AsyncAccept::Accept |
| using join::BasicAsyncStreamAcceptor< Protocol, Proactor >::Acceptor = BasicStreamAcceptor<Protocol> |
| using join::BasicAsyncStreamAcceptor< Protocol, Proactor >::AsyncAccept = BasicAsyncAccept<Protocol, Proactor> |
| using join::BasicAsyncStreamAcceptor< Protocol, Proactor >::Endpoint = typename Protocol::Endpoint |
| using join::BasicAsyncStreamAcceptor< Protocol, Proactor >::Socket = typename Protocol::Socket |
|
inlineexplicit |
create the acceptor instance.
| proactor | proactor driving the operations. |
|
delete |
copy constructor.
| other | other object to copy. |
|
delete |
move constructor.
| other | other object to move. |
|
inline |
destroy the acceptor instance.
|
inlineprotectednoexcept |
reserve the accept operation for submission.
|
inlinenoexcept |
start an asynchronous acceptation.
| handler | handler invoked on completion. |
| flags | accepted socket creation flags. |
| flush | flush the submission queue. |
|
inlinenoexcept |
start an asynchronous multishot acceptation, staying armed until cancelled or failed.
| handler | handler invoked on each acceptation, the last call reporting more as false. |
| flags | accepted socket creation flags. |
| flush | flush the submission queue. |
|
inlinenoexcept |
cancel the acceptation in flight, if any.
|
inlinenoexcept |
close acceptor, cancelling the acceptation in flight.
|
inlineprotectednoexcept |
invoke the accept completion handler.
| accept | completed accept operation. |
| code | error code reported by the kernel. |
| handle | accepted file descriptor. |
|
inlinenoexcept |
create acceptor.
| endpoint | endpoint to assign to the acceptor. |
| flags | acceptor socket creation flags. |
|
inlineprotectednoexcept |
release the accept operation reservation.
| expected | state the operation is expected to be in. |
|
inlineprotectedvirtualnoexcept |
invoke the completion handler of the given operation.
| op | completed operation. |
| code | error code reported by the kernel. |
| size | accepted file descriptor, 0 when the operation failed or was cancelled. |
|
inlinenoexcept |
get address family.
|
inlinenoexcept |
get acceptor native handle.
|
inlineprotectednoexcept |
check if an operation is in flight.
| op | operation to check. |
|
inline |
determine the local endpoint associated with this acceptor.
|
inlineoverrideprotectedvirtual |
method called when an operation is cancelled.
| op | cancelled operation. |
| result | negative errno. |
Reimplemented from join::CompletionHandler.
|
inlineoverrideprotectedvirtual |
method called when an operation completes.
| op | completed operation. |
| result | accepted file descriptor, or negative errno. |
Reimplemented from join::CompletionHandler.
|
inlinenoexcept |
check if the acceptor is opened.
|
delete |
move assignment operator.
| other | other object to assign. |
|
delete |
copy assignment operator.
| other | other object to assign. |
|
inlineprotectednoexcept |
check if an operation is in flight or completing.
| op | operation to check. |
|
inlinenoexcept |
get acceptor protocol.
|
inlinenoexcept |
get the acceptor communication semantic.