Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Network I/O. More...
Classes | |
class | BasicPort |
Base class for ports. More... | |
class | ICloseHandler |
Close handler interface. More... | |
class | IConn |
Connection interface. More... | |
class | IConnAcceptor |
Connection acceptor interface. More... | |
class | IConnHandler |
Connection event handler interface. More... | |
class | INetworkTaskCompleter |
Network task completion handler. More... | |
class | IResolverRequestHandler |
Resolver request result handler interface. More... | |
class | ITerminateHandler |
Termination handler interface. More... | |
class | NetworkLoop |
Network event loop thread. More... | |
class | NetworkTask |
Base class for network loop tasks. More... | |
class | Resolver |
Hostname resolver. More... | |
struct | ResolverRequest |
Resolver request. More... | |
struct | TcpConnectionConfig |
TCP connection parameters. More... | |
struct | TcpClientConfig |
TCP connection parameters. More... | |
class | TcpConnectionPort |
TCP connection port. More... | |
struct | TcpServerConfig |
TCP server parameters. More... | |
class | TcpServerPort |
TCP server. More... | |
struct | UdpConfig |
UDP port parameters. More... | |
class | UdpPort |
UDP sender/receiver port. More... | |
struct | SocketOpts |
Socket options. More... | |
Typedefs | |
typedef int | SocketHandle |
Platform-specific socket handle. More... | |
Enumerations | |
enum | AsyncOperationStatus { AsyncOp_Started , AsyncOp_Completed } |
Asynchronous operation status. More... | |
enum | TcpConnectionType { TcpConn_Client , TcpConn_Server } |
TCP connection type. More... | |
enum | TerminationMode { Term_Normal , Term_Failure } |
Connection termination mode. More... | |
enum | SocketType { SocketType_Tcp , SocketType_Udp } |
Socket type. More... | |
enum | SocketError { SockErr_WouldBlock = -1 , SockErr_StreamEnd = -2 , SockErr_Failure = -3 } |
I/O error codes. More... | |
Functions | |
const char * | termination_mode_to_str (TerminationMode mode) |
Get string representation of termination mode. More... | |
ROC_ATTR_NODISCARD bool | socket_create (address::AddrFamily family, SocketType type, SocketHandle &new_sock) |
Create non-blocking socket. More... | |
ROC_ATTR_NODISCARD bool | socket_accept (SocketHandle sock, SocketHandle &new_sock, address::SocketAddr &remote_address) |
Accept incoming connection. More... | |
ROC_ATTR_NODISCARD bool | socket_setup (SocketHandle sock, const SocketOpts &options) |
Set socket options. More... | |
ROC_ATTR_NODISCARD bool | socket_bind (SocketHandle sock, address::SocketAddr &local_address) |
Bind socket to local address. More... | |
ROC_ATTR_NODISCARD bool | socket_listen (SocketHandle sock, size_t backlog) |
Start listening for incoming connections. More... | |
ROC_ATTR_NODISCARD bool | socket_begin_connect (SocketHandle sock, const address::SocketAddr &remote_address, bool &completed_immediately) |
Initiate connecting to remote peer. More... | |
ROC_ATTR_NODISCARD bool | socket_end_connect (SocketHandle sock) |
Finish connecting to remote peer. More... | |
ROC_ATTR_NODISCARD ssize_t | socket_try_recv (SocketHandle sock, void *buf, size_t bufsz) |
Try to read bytes from socket without blocking. More... | |
ROC_ATTR_NODISCARD ssize_t | socket_try_send (SocketHandle sock, const void *buf, size_t bufsz) |
Try to write bytes to socket without blocking. More... | |
ROC_ATTR_NODISCARD ssize_t | socket_try_send_to (SocketHandle sock, const void *buf, size_t bufsz, const address::SocketAddr &remote_address) |
Try to send datagram via socket to given address, without blocking. More... | |
ROC_ATTR_NODISCARD bool | socket_shutdown (SocketHandle sock) |
Gracefully shutdown connection. More... | |
ROC_ATTR_NODISCARD bool | socket_close (SocketHandle sock) |
Close socket. More... | |
ROC_ATTR_NODISCARD bool | socket_close_with_reset (SocketHandle sock) |
Close socket and send reset to remote peer. Remote peer will get error when reading from connection. More... | |
Variables | |
const SocketHandle | SocketInvalid = -1 |
Invalid socket handle. More... | |
Network I/O.
typedef int roc::netio::SocketHandle |
Platform-specific socket handle.
Definition at line 51 of file socket_ops.h.
Asynchronous operation status.
Enumerator | |
---|---|
AsyncOp_Started | Operation is initiated and running. |
AsyncOp_Completed | Operation is completed. |
Definition at line 19 of file operation_status.h.
I/O error codes.
Enumerator | |
---|---|
SockErr_WouldBlock | Operation can't be performed without blocking, try later. |
SockErr_StreamEnd | End of stream, no more data. |
SockErr_Failure | Failure. |
Definition at line 39 of file socket_ops.h.
Socket type.
Enumerator | |
---|---|
SocketType_Tcp | TCP socket. |
SocketType_Udp | UDP socket. |
Definition at line 23 of file socket_ops.h.
TCP connection type.
Enumerator | |
---|---|
TcpConn_Client | Local peer is client, remote peer is server. |
TcpConn_Server | Local peer is server, remote peer is client. |
Definition at line 49 of file tcp_connection_port.h.
Connection termination mode.
Definition at line 19 of file termination_mode.h.
ROC_ATTR_NODISCARD bool roc::netio::socket_accept | ( | SocketHandle | sock, |
SocketHandle & | new_sock, | ||
address::SocketAddr & | remote_address | ||
) |
Accept incoming connection.
ROC_ATTR_NODISCARD bool roc::netio::socket_begin_connect | ( | SocketHandle | sock, |
const address::SocketAddr & | remote_address, | ||
bool & | completed_immediately | ||
) |
Initiate connecting to remote peer.
completed_immediately
to true if connection was established immediately and there is no need to wait for it. ROC_ATTR_NODISCARD bool roc::netio::socket_bind | ( | SocketHandle | sock, |
address::SocketAddr & | local_address | ||
) |
Bind socket to local address.
ROC_ATTR_NODISCARD bool roc::netio::socket_close | ( | SocketHandle | sock | ) |
Close socket.
ROC_ATTR_NODISCARD bool roc::netio::socket_close_with_reset | ( | SocketHandle | sock | ) |
Close socket and send reset to remote peer. Remote peer will get error when reading from connection.
ROC_ATTR_NODISCARD bool roc::netio::socket_create | ( | address::AddrFamily | family, |
SocketType | type, | ||
SocketHandle & | new_sock | ||
) |
Create non-blocking socket.
ROC_ATTR_NODISCARD bool roc::netio::socket_end_connect | ( | SocketHandle | sock | ) |
Finish connecting to remote peer.
ROC_ATTR_NODISCARD bool roc::netio::socket_listen | ( | SocketHandle | sock, |
size_t | backlog | ||
) |
Start listening for incoming connections.
ROC_ATTR_NODISCARD bool roc::netio::socket_setup | ( | SocketHandle | sock, |
const SocketOpts & | options | ||
) |
Set socket options.
ROC_ATTR_NODISCARD bool roc::netio::socket_shutdown | ( | SocketHandle | sock | ) |
Gracefully shutdown connection.
ROC_ATTR_NODISCARD ssize_t roc::netio::socket_try_recv | ( | SocketHandle | sock, |
void * | buf, | ||
size_t | bufsz | ||
) |
Try to read bytes from socket without blocking.
ROC_ATTR_NODISCARD ssize_t roc::netio::socket_try_send | ( | SocketHandle | sock, |
const void * | buf, | ||
size_t | bufsz | ||
) |
Try to write bytes to socket without blocking.
ROC_ATTR_NODISCARD ssize_t roc::netio::socket_try_send_to | ( | SocketHandle | sock, |
const void * | buf, | ||
size_t | bufsz, | ||
const address::SocketAddr & | remote_address | ||
) |
Try to send datagram via socket to given address, without blocking.
const char* roc::netio::termination_mode_to_str | ( | TerminationMode | mode | ) |
Get string representation of termination mode.
const SocketHandle roc::netio::SocketInvalid = -1 |
Invalid socket handle.
Definition at line 54 of file socket_ops.h.