C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::net Namespace Reference

Contains all classes and functions related to network protocols. More...

Namespaces

namespace  dsl
 Contains building blocks to assemble protocol stacks in a declarative way.
 
namespace  http
 Contains an implementation for HTTP.
 
namespace  lp
 Contains an implementation for message exchange over length-prefix framing.
 
namespace  octet_stream
 Contains classes and utilities for transports that operate on raw octets.
 
namespace  prometheus
 Contains a scraper for exposing metrics from an actor system to Prometheus.
 
namespace  ssl
 Contains wrappers for convenient access to SSL.
 
namespace  web_socket
 Contains an implementation for message exchange over the WebSocket protocol.
 

Classes

class  actor_shell
 Enables socket managers to communicate with actors using dynamically typed messaging. More...
 
class  actor_shell_ptr
 An "owning" pointer to an actor shell in the sense that it calls quit() on the shell when going out of scope. More...
 
struct  datagram_socket
 A datagram-oriented network communication endpoint. More...
 
class  generic_lower_layer
 Bundles protocol-independent, generic member functions for (almost all) lower layers. More...
 
class  generic_upper_layer
 Bundles protocol-independent, generic member functions for (almost all) upper layers. More...
 
class  middleman
 Provides a network backend for running protocol stacks. More...
 
class  multiplexer
 Multiplexes any number of socket_manager objects with a socket. More...
 
struct  network_socket
 A bidirectional network communication endpoint. More...
 
struct  pipe_socket
 A unidirectional communication endpoint for inter-process communication. More...
 
struct  receive_policy
 Configures how many bytes an octet stream transport receives before calling consume on its upper layer. More...
 
struct  socket
 An internal endpoint for sending or receiving data. More...
 
class  socket_event_layer
 The lowest layer in a protocol stack. More...
 
class  socket_guard
 Closes the guarded socket when destroyed. More...
 
class  socket_manager
 Manages the lifetime of a single socket and handles any I/O events on it. More...
 
struct  stream_socket
 A connection-oriented network communication endpoint for bidirectional byte streams. More...
 
struct  tcp_accept_socket
 Represents a TCP acceptor in listening mode. More...
 
struct  tcp_stream_socket
 Represents a TCP connection. More...
 
class  this_host
 Groups functions for managing the host system. More...
 
class  typed_actor_shell< T1, T2, Ts... >
 Enables socket managers to communicate with actors using statically typed messaging. More...
 
class  typed_actor_shell< TraitOrSignature >
 Enables socket managers to communicate with actors using statically typed messaging. More...
 
class  typed_actor_shell_ptr< T1, T2, Ts... >
 An "owning" pointer to an actor shell in the sense that it calls quit() on the shell when going out of scope. More...
 
class  typed_actor_shell_ptr< TraitOrSignature >
 An "owning" pointer to an actor shell in the sense that it calls quit() on the shell when going out of scope. More...
 
struct  udp_datagram_socket
 A datagram-oriented network communication endpoint for bidirectional byte transmission. More...
 

Typedefs

using setsockopt_ptr = const void*
 
using getsockopt_ptr = void*
 
using socket_send_ptr = const void*
 
using socket_recv_ptr = void*
 
using socket_size_type = unsigned
 
template<class ItemType , class... Ts>
using accept_event
 A single event from an acceptor.
 
template<class ItemType , class... Ts>
using acceptor_resource = async::consumer_resource<accept_event<ItemType, Ts...>>
 A consumer resource for events from an acceptor.
 
using multiplexer_ptr = intrusive_ptr<multiplexer>
 
using socket_manager_ptr = intrusive_ptr<socket_manager>
 
using text_buffer = std::vector<char>
 
template<class Handle >
using actor_shell_ptr_t = typename actor_shell_ptr_oracle<Handle>::type
 

Functions

template<class Socket >
expected< Socket > checked_socket (Socket fd)
 Lifts Socket to an expected<Socket> and sets an error if fd is invalid.
 
error allow_connreset (datagram_socket x, bool)
 
std::variant< size_t, seccheck_datagram_socket_io_res (std::make_signed_t< size_t > res)
 
CAF_NET_EXPORT void intrusive_ptr_add_ref (socket_manager *ptr) noexcept
 
CAF_NET_EXPORT void intrusive_ptr_release (socket_manager *ptr) noexcept
 
template<class Handle = caf::actor>
actor_shell_ptr_t< Handle > make_actor_shell (socket_manager *mgr)
 Creates a new actor_shell and registers it at the actor system.
 
error allow_sigpipe (network_socket x, bool new_value)
 
error allow_udp_connreset (network_socket x, bool)
 
expected< size_t > send_buffer_size (network_socket x)
 
error send_buffer_size (network_socket x, size_t capacity)
 
expected< std::string > local_addr (network_socket x)
 
expected< uint16_t > local_port (network_socket x)
 
expected< std::string > remote_addr (network_socket x)
 
expected< uint16_t > remote_port (network_socket x)
 
expected< std::pair< pipe_socket, pipe_socket > > make_pipe ()
 
ptrdiff_t write (pipe_socket x, const_byte_span buf)
 
ptrdiff_t read (pipe_socket x, byte_span buf)
 
void close (socket fd)
 
std::errc last_socket_error ()
 
bool last_socket_error_is_temporary ()
 
std::string last_socket_error_as_string ()
 
bool would_block_or_temporarily_unavailable (int errcode)
 
bool probe (socket x)
 
error child_process_inherit (socket x, bool new_value)
 
error nonblocking (socket x, bool new_value)
 
error shutdown_read (socket x)
 
error shutdown_write (socket x)
 
template<class To , class From >
To socket_cast (From x)
 Converts between different socket types.
 
constexpr bool valid (socket x) noexcept
 Checks whether x contains a valid ID.
 
socket_id get_socket_id (socket fd) noexcept
 Returns the socket ID of fd.
 
template<class Socket >
socket_guard< Socket > make_socket_guard (Socket sock)
 
bool valid (const ssl::connection &conn)
 Checks whether conn contains a valid socket.
 
ptrdiff_t read (ssl::connection &conn, byte_span buf)
 Tries to fill buf with data from the managed socket of conn.
 
ptrdiff_t write (ssl::connection &conn, const_byte_span buf)
 Tries to write bytes from buf to the managed socket of conn.
 
socket_id get_socket_id (const ssl::connection &conn) noexcept
 Returns the socket ID of conn.
 
expected< std::pair< stream_socket, stream_socket > > make_stream_socket_pair ()
 
error keepalive (stream_socket x, bool new_value)
 
error nodelay (stream_socket x, bool new_value)
 
ptrdiff_t read (stream_socket x, byte_span buf)
 
ptrdiff_t write (stream_socket x, const_byte_span buf)
 
ptrdiff_t write (stream_socket x, std::initializer_list< const_byte_span > bufs)
 
expected< tcp_accept_socketmake_tcp_accept_socket (ip_endpoint node, bool reuse_addr)
 
expected< tcp_accept_socketmake_tcp_accept_socket (const uri::authority_type &node, bool reuse_addr)
 
expected< tcp_accept_socketmake_tcp_accept_socket (uint16_t port, std::string addr, bool reuse_addr)
 
expected< tcp_stream_socketaccept (tcp_accept_socket x)
 
expected< tcp_stream_socketmake_connected_tcp_stream_socket (ip_endpoint node, timespan timeout)
 
expected< tcp_stream_socketmake_connected_tcp_stream_socket (const uri::authority_type &node, timespan timeout)
 
expected< tcp_stream_socketmake_connected_tcp_stream_socket (std::string host, uint16_t port, timespan timeout)
 
expected< udp_datagram_socketmake_udp_datagram_socket (ip_endpoint ep, bool reuse_addr)
 
ptrdiff_t read (udp_datagram_socket x, byte_span buf, ip_endpoint *src)
 
ptrdiff_t write (udp_datagram_socket x, const_byte_span buf, ip_endpoint ep)
 

Variables

static constexpr auto check_socket = [](auto fd) { return checked_socket(fd); }
 A function object that calls checked_socket.
 
constexpr auto invalid_socket = socket{invalid_socket_id}
 Denotes the invalid socket.
 
constexpr socket_id invalid_socket_id = -1
 Identifies the invalid socket.
 
constexpr int no_sigpipe_io_flag = MSG_NOSIGNAL
 

Detailed Description

Contains all classes and functions related to network protocols.

Typedef Documentation

◆ accept_event

template<class ItemType , class... Ts>
using caf::net::accept_event
Initial value:
Grants access to a buffer to the first producer that calls open.
Definition spsc_buffer.hpp:450
A copy-on-write tuple implementation.
Definition fwd.hpp:61

A single event from an acceptor.

Contains a producer and a consumer resource for writing to and reading from the accepted connection.

◆ acceptor_resource

template<class ItemType , class... Ts>
using caf::net::acceptor_resource = async::consumer_resource<accept_event<ItemType, Ts...>>

A consumer resource for events from an acceptor.

Each event contains a producer and a consumer resource for writing to and reading from the accepted connection.