|
Monero
|
#include <abstract_tcp_server2.h>


Classes | |
| struct | idle_callback_conext_base |
| struct | idle_callback_conext |
| struct | worker |
| The io_context used to perform asynchronous operations. More... | |
Public Types | |
| typedef boost::shared_ptr< connection< t_protocol_handler > > | connection_ptr |
| typedef t_protocol_handler::connection_context | t_connection_context |
Public Member Functions | |
| boosted_tcp_server (t_connection_type connection_type) | |
| boosted_tcp_server (boost::asio::io_context &external_io_context, t_connection_type connection_type) | |
| ~boosted_tcp_server () | |
| void | create_server_type_map () |
| bool | init_server (uint32_t port, const std::string &address="0.0.0.0", uint32_t port_ipv6=0, const std::string &address_ipv6="::", bool use_ipv6=false, bool require_ipv4=true, ssl_options_t ssl_options=ssl_support_t::e_ssl_support_autodetect) |
| bool | init_server (const std::string port, const std::string &address="0.0.0.0", const std::string port_ipv6="", const std::string address_ipv6="::", bool use_ipv6=false, bool require_ipv4=true, ssl_options_t ssl_options=ssl_support_t::e_ssl_support_autodetect) |
| bool | run_server (size_t threads_count, bool wait=true, const boost::thread::attributes &attrs=boost::thread::attributes()) |
| Run the server's io_context loop. | |
| bool | timed_wait_server_stop (uint64_t wait_mseconds) |
| wait for service workers stop | |
| void | send_stop_signal () |
| Stop the server. | |
| bool | is_stop_signal_sent () const noexcept |
| const std::atomic< bool > & | get_stop_signal () const noexcept |
| void | set_threads_prefix (const std::string &prefix_name) |
| bool | deinit_server () |
| size_t | get_threads_count () |
| void | set_connection_filter (i_connection_filter *pfilter) |
| void | set_connection_limit (i_connection_limit *plimit) |
| void | set_response_soft_limit (std::size_t limit) |
| void | set_default_remote (epee::net_utils::network_address remote) |
| bool | add_connection (t_connection_context &out, boost::asio::ip::tcp::socket &&sock, network_address real_remote, epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect) |
| try_connect_result_t | try_connect (connection_ptr new_connection_l, const std::string &adr, const std::string &port, boost::asio::ip::tcp::socket &sock_, const boost::asio::ip::tcp::endpoint &remote_endpoint, const std::string &bind_ip, uint32_t conn_timeout, epee::net_utils::ssl_support_t ssl_support) |
| bool | connect (const std::string &adr, const std::string &port, uint32_t conn_timeot, t_connection_context &cn, const std::string &bind_ip="0.0.0.0", epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect) |
| template<class t_callback> | |
| bool | connect_async (const std::string &adr, const std::string &port, uint32_t conn_timeot, const t_callback &cb, const std::string &bind_ip="0.0.0.0", epee::net_utils::ssl_support_t ssl_support=epee::net_utils::ssl_support_t::e_ssl_support_autodetect, t_connection_context &&initial=t_connection_context{}) |
| boost::asio::ssl::context & | get_ssl_context () noexcept |
| t_protocol_handler::config_type & | get_config_object () |
| std::shared_ptr< typename t_protocol_handler::config_type > | get_config_shared () |
| int | get_binded_port () |
| int | get_binded_port_ipv6 () |
| long | get_connections_count () const |
| boost::asio::io_context & | get_io_context () |
| template<class t_handler> | |
| bool | add_idle_handler (t_handler t_callback, uint64_t timeout_ms) |
| template<class t_handler> | |
| bool | global_timer_handler (boost::shared_ptr< idle_callback_conext< t_handler > > ptr) |
| template<class t_handler> | |
| bool | async_call (t_handler &&t_callback) |
| template<class t_callback> | |
| bool | connect_async (const std::string &adr, const std::string &port, uint32_t conn_timeout, const t_callback &cb, const std::string &bind_ip, epee::net_utils::ssl_support_t ssl_support, t_connection_context &&initial) |
Public Attributes | |
| std::map< std::string, t_connection_type > | server_type_map |
Private Types | |
| enum | try_connect_result_t { CONNECT_SUCCESS , CONNECT_FAILURE , CONNECT_NO_SSL } |
Private Member Functions | |
| bool | worker_thread () |
| Run the server's io_context loop. | |
| void | handle_accept_ipv4 (const boost::system::error_code &e) |
| Handle completion of an asynchronous accept operation. | |
| void | handle_accept_ipv6 (const boost::system::error_code &e) |
| void | handle_accept (const boost::system::error_code &e, bool ipv6=false) |
| bool | is_thread_worker () |
Private Attributes | |
| const std::shared_ptr< typename connection< t_protocol_handler >::shared_state > | m_state |
| std::unique_ptr< worker > | m_io_context_local_instance |
| boost::asio::io_context & | io_context_ |
| boost::asio::ip::tcp::acceptor | acceptor_ |
| Acceptor used to listen for incoming connections. | |
| boost::asio::ip::tcp::acceptor | acceptor_ipv6 |
| epee::net_utils::network_address | default_remote |
| std::atomic< bool > | m_stop_signal_sent |
| uint32_t | m_port |
| uint32_t | m_port_ipv6 |
| std::string | m_address |
| std::string | m_address_ipv6 |
| bool | m_use_ipv6 |
| bool | m_require_ipv4 |
| std::string | m_thread_name_prefix |
| size_t | m_threads_count |
| std::vector< boost::shared_ptr< boost::thread > > | m_threads |
| boost::thread::id | m_main_thread_id |
| critical_section | m_threads_lock |
| std::atomic< uint32_t > | m_thread_index |
| t_connection_type | m_connection_type |
| connection_ptr | new_connection_ |
| The next connection to be accepted. | |
| connection_ptr | new_connection_ipv6 |
| boost::mutex | connections_mutex |
| std::set< connection_ptr > | connections_ |
| typedef boost::shared_ptr<connection<t_protocol_handler> > epee::net_utils::boosted_tcp_server< t_protocol_handler >::connection_ptr |
| typedef t_protocol_handler::connection_context epee::net_utils::boosted_tcp_server< t_protocol_handler >::t_connection_context |
|
private |
| epee::net_utils::boosted_tcp_server< t_protocol_handler >::boosted_tcp_server | ( | t_connection_type | connection_type | ) |
Construct the server to listen on the specified TCP address and port, and serve up files from the given directory.
|
explicit |
| epee::net_utils::boosted_tcp_server< t_protocol_handler >::~boosted_tcp_server | ( | ) |
| bool epee::boosted_tcp_server::add_connection | ( | t_connection_context & | out, |
| boost::asio::ip::tcp::socket && | sock, | ||
| network_address | real_remote, | ||
| epee::net_utils::ssl_support_t | ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect ) |
|
inline |
|
inline |
| bool epee::boosted_tcp_server::connect | ( | const std::string & | adr, |
| const std::string & | port, | ||
| uint32_t | conn_timeot, | ||
| t_connection_context & | cn, | ||
| const std::string & | bind_ip = "0.0.0.0", | ||
| epee::net_utils::ssl_support_t | ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect ) |
| bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::connect_async | ( | const std::string & | adr, |
| const std::string & | port, | ||
| uint32_t | conn_timeot, | ||
| const t_callback & | cb, | ||
| const std::string & | bind_ip = "0.0.0.0", | ||
| epee::net_utils::ssl_support_t | ssl_support = epee::net_utils::ssl_support_t::e_ssl_support_autodetect, | ||
| t_connection_context && | initial = t_connection_context{} ) |
| bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::connect_async | ( | const std::string & | adr, |
| const std::string & | port, | ||
| uint32_t | conn_timeout, | ||
| const t_callback & | cb, | ||
| const std::string & | bind_ip, | ||
| epee::net_utils::ssl_support_t | ssl_support, | ||
| t_connection_context && | initial ) |
| void epee::net_utils::boosted_tcp_server< t_protocol_handler >::create_server_type_map | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
private |
|
private |
Handle completion of an asynchronous accept operation.
|
private |
| bool epee::boosted_tcp_server::init_server | ( | const std::string | port, |
| const std::string & | address = "0.0.0.0", | ||
| const std::string | port_ipv6 = "", | ||
| const std::string | address_ipv6 = "::", | ||
| bool | use_ipv6 = false, | ||
| bool | require_ipv4 = true, | ||
| ssl_options_t | ssl_options = ssl_support_t::e_ssl_support_autodetect ) |
| bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::init_server | ( | uint32_t | port, |
| const std::string & | address = "0.0.0.0", | ||
| uint32_t | port_ipv6 = 0, | ||
| const std::string & | address_ipv6 = "::", | ||
| bool | use_ipv6 = false, | ||
| bool | require_ipv4 = true, | ||
| ssl_options_t | ssl_options = ssl_support_t::e_ssl_support_autodetect ) |
|
inlinenoexcept |
|
private |
| bool epee::boosted_tcp_server::run_server | ( | size_t | threads_count, |
| bool | wait = true, | ||
| const boost::thread::attributes & | attrs = boost::thread::attributes() ) |
Run the server's io_context loop.
| void epee::boosted_tcp_server::send_stop_signal | ( | ) |
Stop the server.
| void epee::boosted_tcp_server::set_connection_filter | ( | i_connection_filter * | pfilter | ) |
| void epee::boosted_tcp_server::set_connection_limit | ( | i_connection_limit * | plimit | ) |
|
inline |
| void epee::boosted_tcp_server::set_response_soft_limit | ( | std::size_t | limit | ) |
| void epee::boosted_tcp_server::set_threads_prefix | ( | const std::string & | prefix_name | ) |
| bool epee::boosted_tcp_server::timed_wait_server_stop | ( | uint64_t | wait_mseconds | ) |
wait for service workers stop
| boosted_tcp_server< t_protocol_handler >::try_connect_result_t epee::boosted_tcp_server::try_connect | ( | connection_ptr | new_connection_l, |
| const std::string & | adr, | ||
| const std::string & | port, | ||
| boost::asio::ip::tcp::socket & | sock_, | ||
| const boost::asio::ip::tcp::endpoint & | remote_endpoint, | ||
| const std::string & | bind_ip, | ||
| uint32_t | conn_timeout, | ||
| epee::net_utils::ssl_support_t | ssl_support ) |
|
private |
Run the server's io_context loop.
|
private |
Acceptor used to listen for incoming connections.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The next connection to be accepted.
|
private |
| std::map<std::string, t_connection_type> epee::net_utils::boosted_tcp_server< t_protocol_handler >::server_type_map |