|
libcaf
0.14.4
|
Contains classes and functions used for network abstraction. More...
Classes | |
| class | acceptor |
| An acceptor is responsible for accepting incoming connections. 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_multiplexer |
| A wrapper for the boost::asio multiplexer. More... | |
| class | default_socket |
| Low-level socket type used as default. More... | |
| class | event_handler |
| A socket IO event handler. More... | |
| class | interfaces |
| Utility class bundling access to network interface names and addresses. More... | |
| class | manager |
| A manager configures an IO device and provides callbacks for various IO operations. More... | |
| class | multiplexer |
| Low-level backend for IO multiplexing. More... | |
| class | stream |
| A stream capable of both reading and writing. More... | |
| class | stream_manager |
| A stream manager configures an IO stream and provides callbacks for incoming data as well as for error handling. More... | |
Typedefs | |
| using | io_backend = boost::asio::io_service |
| Low-level backend for IO multiplexing. | |
| using | default_socket = boost::asio::ip::tcp::socket |
| Low-level socket type used as default. | |
| using | default_socket_acceptor = boost::asio::ip::tcp::acceptor |
| Low-level socket type used as default. | |
| using | native_socket = typename default_socket::native_handle_type |
| Platform-specific native socket type. | |
| using | setsockopt_ptr = const 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 | address_listing = std::map< protocol, std::vector< std::string >> |
| using | interfaces_map = std::map< std::string, address_listing > |
| using | multiplexer_ptr = std::unique_ptr< multiplexer > |
Enumerations | |
| enum | operation { read, write, propagate_error } |
| Identifies network IO operations, i.e., read or write. | |
| enum | protocol : uint32_t { ethernet, ipv4, ipv6 } |
Functions | |
| asio_multiplexer & | get_multiplexer_singleton () |
| template<class T > | |
| connection_handle | conn_hdl_from_socket (T &sock) |
| template<class T > | |
| accept_handle | accept_hdl_from_socket (T &sock) |
| default_socket | new_tcp_connection (io_backend &backend, const std::string &host, uint16_t port) |
| void | ip_bind (default_socket_acceptor &fd, uint16_t port, const char *addr=nullptr, bool reuse_addr=true) |
| 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... | |
| 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. | |
| void | tcp_nodelay (native_socket fd, bool new_value) |
Enables or disables Nagle's algorithm on fd. More... | |
| void | allow_sigpipe (native_socket fs, bool new_value) |
Enables or disables SIGPIPE events from fd. | |
| void | handle_write_result (ssize_t result) |
Throws network_error if result is invalid. | |
| void | handle_read_result (ssize_t result) |
Throws network_error if result is invalid. | |
| bool | 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... | |
| bool | 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... | |
| template<class T > | |
| connection_handle | conn_hdl_from_socket (const T &sock) |
| template<class T > | |
| accept_handle | accept_hdl_from_socket (const T &sock) |
| native_socket | new_tcp_connection_impl (const std::string &, uint16_t, maybe< protocol > preferred=none) |
| default_socket | new_tcp_connection (const std::string &host, uint16_t port) |
| std::pair< native_socket, uint16_t > | new_tcp_acceptor_impl (uint16_t port, const char *addr, bool reuse_addr) |
| std::pair< default_socket_acceptor, uint16_t > | new_tcp_acceptor (uint16_t port, const char *addr=nullptr, bool reuse_addr=false) |
| int64_t | int64_from_native_socket (native_socket sock) |
| constexpr const char * | to_string (operation op) |
| constexpr const char * | to_string (protocol value) |
Variables | |
| constexpr int | ec_out_of_memory = ENOMEM |
| constexpr int | ec_interrupted_syscall = EINTR |
| constexpr short | input_mask = POLLIN | POLLPRI |
| constexpr short | error_mask = POLLRDHUP | POLLERR | POLLHUP | POLLNVAL |
| constexpr short | output_mask = POLLOUT |
| constexpr native_socket | invalid_native_socket = -1 |
Contains classes and functions used for network abstraction.
| 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_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).
| 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_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).
1.8.9.1