|
Monero
|
#include <net_helper.h>

Classes | |
| struct | handler_obj |
Public Types | |
| using | connect_func = boost::unique_future<boost::asio::ip::tcp::socket>(const std::string&, const std::string&, boost::asio::steady_timer&) |
Public Member Functions | |
| blocked_mode_client () | |
| ~blocked_mode_client () | |
| void | set_ssl (ssl_options_t ssl_options) |
| bool | connect (const std::string &addr, int port, std::chrono::milliseconds timeout) |
| try_connect_result_t | try_connect (const std::string &addr, const std::string &port, std::chrono::milliseconds timeout) |
| bool | connect (const std::string &addr, const std::string &port, std::chrono::milliseconds timeout) |
| void | set_connector (std::function< connect_func > connector) |
| Change the connection routine (proxy, etc.). | |
| bool | disconnect () |
| bool | send (const boost::string_ref buff, std::chrono::milliseconds timeout) |
| bool | send (const void *data, size_t sz) |
| bool | is_connected (bool *ssl=NULL) |
| bool | recv (std::string &buff, std::chrono::milliseconds timeout) |
| bool | recv_n (std::string &buff, int64_t sz, std::chrono::milliseconds timeout) |
| bool | shutdown () |
| boost::asio::io_context & | get_io_service () |
| boost::asio::ip::tcp::socket & | get_socket () |
| uint64_t | get_bytes_sent () const |
| uint64_t | get_bytes_received () const |
Protected Member Functions | |
| bool | write (const void *data, size_t sz, boost::system::error_code &ec) |
| void | async_write (const void *data, size_t sz, boost::system::error_code &ec) |
| void | async_read (char *buff, size_t sz, boost::asio::detail::transfer_at_least_t transfer_at_least, handler_obj &hndlr) |
Protected Attributes | |
| boost::asio::io_context | m_io_service |
| boost::asio::ssl::context | m_ctx |
| std::shared_ptr< boost::asio::ssl::stream< boost::asio::ip::tcp::socket > > | m_ssl_socket |
| std::function< connect_func > | m_connector |
| ssl_options_t | m_ssl_options |
| bool | m_initialized |
| bool | m_connected |
| boost::asio::steady_timer | m_deadline |
| std::atomic< bool > | m_shutdowned |
| std::atomic< uint64_t > | m_bytes_sent |
| std::atomic< uint64_t > | m_bytes_received |
Private Types | |
| enum | try_connect_result_t { CONNECT_SUCCESS , CONNECT_FAILURE , CONNECT_NO_SSL } |
Private Member Functions | |
| void | check_deadline () |
| void | shutdown_ssl () |
| using epee::net_utils::blocked_mode_client::connect_func = boost::unique_future<boost::asio::ip::tcp::socket>(const std::string&, const std::string&, boost::asio::steady_timer&) |
The first/second parameters are host/port respectively. The third parameter is for setting the timeout callback - the timer is already set by the caller, the callee only needs to set the behavior.
Additional asynchronous operations should be queued using the io_service from the timer. The implementation should assume multi-threaded I/O processing.
If the callee cannot start an asynchronous operation, an exception should be thrown to signal an immediate failure.
The return value is a future to a connected socket. Asynchronous failures should use the set_exception method.
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Change the connection routine (proxy, etc.).
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |