libcaf
0.15.5
|
Contains classes and functions used for network abstraction. More...
Classes | |
class | acceptor |
An acceptor is responsible for accepting incoming connections. More... | |
class | acceptor_impl |
A concrete acceptor with a technology-dependent policy. More... | |
class | acceptor_manager |
An acceptor manager configures an acceptor and provides callbacks for incoming connections as well as for error handling. More... | |
class | asio_acceptor |
An acceptor is responsible for accepting incoming connections. More... | |
class | asio_multiplexer |
A wrapper for the boost::asio multiplexer. More... | |
class | asio_stream |
A stream capable of both reading and writing. More... | |
class | datagram_handler_impl |
A concrete datagram_handler with a technology-dependent policy. More... | |
class | datagram_manager |
A datagram manager provides callbacks for outgoing datagrams as well as for error handling. More... | |
class | datagram_servant_impl |
Default datagram servant implementation. More... | |
class | doorman_impl |
Default doorman implementation. More... | |
class | event_handler |
A socket I/O event handler. More... | |
class | interfaces |
Utility class bundling access to network interface names and addresses. More... | |
struct | ip_endpoint |
A hashable wrapper for a sockaddr storage. More... | |
class | manager |
A manager configures an I/O device and provides callbacks for various I/O operations. More... | |
class | multiplexer |
Low-level backend for IO multiplexing. More... | |
class | pipe_reader |
An event handler for the internal event pipe. More... | |
struct | protocol |
Bundles protocol information for network and transport layer communication. More... | |
class | receive_buffer |
A container that does not call constructors and destructors for its values. More... | |
class | scribe_impl |
Default scribe implementation. More... | |
class | stream |
A stream capable of both reading and writing. More... | |
class | stream_impl |
A concrete stream with a technology-dependent policy for sending and receiving data from a socket. More... | |
class | stream_manager |
A stream manager configures an IO stream and provides callbacks for incoming data as well as for error handling. More... | |
struct | tcp_policy |
Policy object for wrapping default TCP operations. More... | |
struct | udp_policy |
Policy object for wrapping default UDP operations. More... | |
Typedefs | |
using | error_code = boost::system::error_code |
Low-level error code. | |
using | io_service = boost::asio::io_service |
Low-level backend for IO multiplexing. | |
using | asio_tcp_socket = boost::asio::ip::tcp::socket |
Low-level socket type used as default. | |
using | asio_tcp_socket_acceptor = boost::asio::ip::tcp::acceptor |
Low-level socket type used as default. | |
using | setsockopt_ptr = const void * |
using | getsockopt_ptr = void * |
using | socket_send_ptr = const void * |
using | socket_recv_ptr = void * |
using | multiplexer_data = pollfd |
using | multiplexer_poll_shadow_data = std::vector< event_handler * > |
using | native_socket_acceptor = native_socket |
Platform-specific native acceptor socket type. | |
using | read_some_fun = decltype(read_some) * |
Function signature of read_some . | |
using | write_some_fun = decltype(write_some) * |
Function signature of wite_some . | |
using | try_accept_fun = decltype(try_accept) * |
Function signature of try_accept . | |
using | read_datagram_fun = decltype(read_datagram) * |
Function signature of read_datagram. | |
using | write_datagram_fun = decltype(write_datagram) * |
Function signature of write_datagram. | |
using | address_listing = std::map< protocol::network, std::vector< std::string > > |
using | interfaces_map = std::map< std::string, address_listing > |
using | multiplexer_ptr = std::unique_ptr< multiplexer > |
using | native_socket = int |
Enumerations | |
enum | rw_state { rw_state::success, rw_state::failure, rw_state::indeterminate } |
Denotes the returned state of read and write operations on sockets. More... | |
enum | operation { read, write, propagate_error } |
Identifies network IO operations, i.e., read or write. | |
Functions | |
template<class T > | |
connection_handle | conn_hdl_from_socket (T &sock) |
template<class T > | |
accept_handle | accept_hdl_from_socket (T &sock) |
expected< asio_tcp_socket > | new_tcp_connection (io_service &ios, const std::string &host, uint16_t port) |
error | ip_bind (asio_tcp_socket_acceptor &fd, uint16_t port, const char *addr, bool reuse_addr) |
void | closesocket (int fd) |
int | last_socket_error () |
bool | would_block_or_temporarily_unavailable (int errcode) |
std::string | last_socket_error_as_string () |
Returns the last socket error as human-readable string. | |
std::pair< native_socket, native_socket > | create_pipe () |
Creates two connected sockets. More... | |
expected< void > | nonblocking (native_socket fd, bool new_value) |
Sets fd to nonblocking if set_nonblocking == true or to blocking if set_nonblocking == false throws network_error on error. | |
expected< void > | tcp_nodelay (native_socket fd, bool new_value) |
Enables or disables Nagle's algorithm on fd . More... | |
expected< void > | allow_sigpipe (native_socket fd, bool new_value) |
Enables or disables SIGPIPE events from fd . | |
expected< void > | allow_udp_connreset (native_socket fd, bool new_value) |
Enables or disables SIO_UDP_CONNRESET error on fd . | |
expected< int > | send_buffer_size (native_socket fd) |
Get the socket buffer size for fd . | |
expected< void > | send_buffer_size (native_socket fd, int new_value) |
Set the socket buffer size for fd . | |
bool | is_error (ssize_t res, bool is_nonblock) |
Convenience functions for checking the result of recv or send . | |
rw_state | read_some (size_t &result, native_socket fd, void *buf, size_t len) |
Reads up to len bytes from fd, writing the received data to buf . More... | |
rw_state | write_some (size_t &result, native_socket fd, const void *buf, size_t len) |
Writes up to len bytes from buf to fd . More... | |
bool | try_accept (native_socket &result, native_socket fd) |
Tries to accept a new connection from fd . More... | |
bool | read_datagram (size_t &result, native_socket fd, void *buf, size_t buf_len, ip_endpoint &ep) |
Write a datagram containing buf_len bytes to fd addressed at the endpoint in sa with size sa_len . More... | |
bool | write_datagram (size_t &result, native_socket fd, void *buf, size_t buf_len, const ip_endpoint &ep) |
Reveice a datagram of up to len bytes. More... | |
expected< uint16_t > | local_port_of_fd (native_socket fd) |
Returns the locally assigned port of fd . | |
expected< std::string > | local_addr_of_fd (native_socket fd) |
Returns the locally assigned address of fd . | |
expected< uint16_t > | remote_port_of_fd (native_socket fd) |
Returns the port used by the remote host of fd . | |
expected< std::string > | remote_addr_of_fd (native_socket fd) |
Returns the remote host address of fd . | |
connection_handle | conn_hdl_from_socket (native_socket fd) |
accept_handle | accept_hdl_from_socket (native_socket fd) |
expected< native_socket > | new_tcp_connection (const std::string &host, uint16_t port, optional< protocol::network > preferred=none) |
expected< native_socket > | new_tcp_acceptor_impl (uint16_t port, const char *addr, bool reuse_addr) |
expected< std::pair< native_socket, ip_endpoint > > | new_remote_udp_endpoint_impl (const std::string &host, uint16_t port, optional< protocol::network > preferred=none) |
expected< std::pair< native_socket, protocol::network > > | new_local_udp_endpoint_impl (uint16_t port, const char *addr, bool reuse_addr=false, optional< protocol::network > preferred=none) |
bool | operator== (const ip_endpoint &lhs, const ip_endpoint &rhs) |
std::string | to_string (const ip_endpoint &ep) |
std::string | host (const ip_endpoint &ep) |
uint16_t | port (const ip_endpoint &ep) |
uint32_t | family (const ip_endpoint &ep) |
error | load_endpoint (ip_endpoint &ep, uint32_t &f, std::string &h, uint16_t &p, size_t &l) |
error | save_endpoint (ip_endpoint &ep, uint32_t &f, std::string &h, uint16_t &p, size_t &l) |
template<class Inspector > | |
Inspector::result_type | inspect (Inspector &fun, ip_endpoint &ep) |
int64_t | int64_from_native_socket (native_socket sock) |
std::string | to_string (operation op) |
Contains classes and functions used for network abstraction.
|
strong |
std::pair<native_socket, native_socket> caf::io::network::create_pipe | ( | ) |
Creates two connected sockets.
The former is the read handle and the latter is the write handle.
bool caf::io::network::read_datagram | ( | size_t & | result, |
native_socket | fd, | ||
void * | buf, | ||
size_t | buf_len, | ||
ip_endpoint & | ep | ||
) |
Write a datagram containing buf_len
bytes to fd
addressed at the endpoint in sa
with size sa_len
.
Returns true as long as no IO error occurs. The number of written bytes is stored in result
and the sender is stored in ep
.
rw_state caf::io::network::read_some | ( | size_t & | result, |
native_socket | fd, | ||
void * | buf, | ||
size_t | len | ||
) |
Reads up to len
bytes from fd,
writing the received data to buf
.
Returns true
as long as fd
is readable and false
if the socket has been closed or an IO error occured. The number of read bytes is stored in result
(can be 0).
expected<void> caf::io::network::tcp_nodelay | ( | native_socket | fd, |
bool | new_value | ||
) |
Enables or disables Nagle's algorithm on fd
.
network_error |
bool caf::io::network::try_accept | ( | native_socket & | result, |
native_socket | fd | ||
) |
Tries to accept a new connection from fd
.
On success, the new connection is stored in result
. Returns true as long as
bool caf::io::network::write_datagram | ( | size_t & | result, |
native_socket | fd, | ||
void * | buf, | ||
size_t | buf_len, | ||
const ip_endpoint & | ep | ||
) |
Reveice a datagram of up to len
bytes.
Larger datagrams are truncated. Up to sender_len
bytes of the receiver address is written into sender_addr
. Returns true
if no IO error occurred. The number of received bytes is stored in result
(can be 0).
rw_state caf::io::network::write_some | ( | size_t & | result, |
native_socket | fd, | ||
const void * | buf, | ||
size_t | len | ||
) |
Writes up to len
bytes from buf
to fd
.
Returns true
as long as fd
is readable and false
if the socket has been closed or an IO error occured. The number of written bytes is stored in result
(can be 0).