Electroneum
Loading...
Searching...
No Matches
epee::net_utils::boosted_tcp_server< t_protocol_handler > Class Template Reference

#include <abstract_tcp_server2.h>

Inheritance diagram for epee::net_utils::boosted_tcp_server< t_protocol_handler >:
Collaboration diagram for epee::net_utils::boosted_tcp_server< t_protocol_handler >:

Classes

struct  idle_callback_conext_base
struct  idle_callback_conext

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_service &external_io_service, 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", 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", 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_service 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_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_protocol_handler::config_type & get_config_object ()
int get_binded_port ()
long get_connections_count () const
boost::asio::io_service & get_io_service ()
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)

Public Attributes

std::map< std::string, t_connection_typeserver_type_map

Detailed Description

template<class t_protocol_handler>
class epee::net_utils::boosted_tcp_server< t_protocol_handler >

Definition at line 207 of file abstract_tcp_server2.h.

Member Typedef Documentation

◆ connection_ptr

template<class t_protocol_handler>
typedef boost::shared_ptr<connection<t_protocol_handler> > epee::net_utils::boosted_tcp_server< t_protocol_handler >::connection_ptr

Definition at line 218 of file abstract_tcp_server2.h.

◆ t_connection_context

template<class t_protocol_handler>
typedef t_protocol_handler::connection_context epee::net_utils::boosted_tcp_server< t_protocol_handler >::t_connection_context

Definition at line 219 of file abstract_tcp_server2.h.

Constructor & Destructor Documentation

◆ boosted_tcp_server() [1/2]

template<class t_protocol_handler>
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.

◆ boosted_tcp_server() [2/2]

template<class t_protocol_handler>
epee::net_utils::boosted_tcp_server< t_protocol_handler >::boosted_tcp_server ( boost::asio::io_service & external_io_service,
t_connection_type connection_type )
explicit

◆ ~boosted_tcp_server()

Member Function Documentation

◆ add_connection()

◆ add_idle_handler()

template<class t_protocol_handler>
template<class t_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::add_idle_handler ( t_handler t_callback,
uint64_t timeout_ms )
inline

◆ async_call()

template<class t_protocol_handler>
template<class t_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::async_call ( t_handler t_callback)
inline

Definition at line 332 of file abstract_tcp_server2.h.

333 {
334 io_service_.post(t_callback);
335 return true;
336 }

◆ connect()

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::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 )

◆ connect_async()

template<class t_protocol_handler>
template<class t_callback>
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 )

◆ create_server_type_map()

template<class t_protocol_handler>
void epee::net_utils::boosted_tcp_server< t_protocol_handler >::create_server_type_map ( )

◆ deinit_server()

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::deinit_server ( )
inline

Definition at line 248 of file abstract_tcp_server2.h.

248{return true;}

◆ get_binded_port()

template<class t_protocol_handler>
int epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_binded_port ( )
inline

Definition at line 271 of file abstract_tcp_server2.h.

271{return m_port;}

◆ get_config_object()

template<class t_protocol_handler>
t_protocol_handler::config_type & epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_config_object ( )
inline

Definition at line 265 of file abstract_tcp_server2.h.

266 {
267 assert(m_state != nullptr); // always set in constructor
268 return m_state->config;
269 }
Here is the caller graph for this function:

◆ get_connections_count()

template<class t_protocol_handler>
long epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_connections_count ( ) const
inline

Definition at line 273 of file abstract_tcp_server2.h.

274 {
275 assert(m_state != nullptr); // always set in constructor
276 auto connections_count = m_state->sock_count > 0 ? (m_state->sock_count - 1) : 0; // Socket count minus listening socket
277 return connections_count;
278 }

◆ get_io_service()

template<class t_protocol_handler>
boost::asio::io_service & epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_io_service ( )
inline

Definition at line 280 of file abstract_tcp_server2.h.

280{return io_service_;}

◆ get_stop_signal()

template<class t_protocol_handler>
const std::atomic< bool > & epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_stop_signal ( ) const
inlinenoexcept

Definition at line 244 of file abstract_tcp_server2.h.

244{ return m_stop_signal_sent; }

◆ get_threads_count()

template<class t_protocol_handler>
size_t epee::net_utils::boosted_tcp_server< t_protocol_handler >::get_threads_count ( )
inline

Definition at line 250 of file abstract_tcp_server2.h.

250{return m_threads_count;}

◆ global_timer_handler()

template<class t_protocol_handler>
template<class t_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::global_timer_handler ( boost::shared_ptr< idle_callback_conext< t_handler > > ptr)
inline

Definition at line 321 of file abstract_tcp_server2.h.

322 {
323 //if handler return false - he don't want to be called anymore
324 if(!ptr->call_handler())
325 return true;
326 ptr->m_timer.expires_from_now(boost::posix_time::milliseconds(ptr->m_period));
328 return true;
329 }
Here is the caller graph for this function:

◆ init_server() [1/2]

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::init_server ( const std::string port,
const std::string & address = "0.0.0.0",
ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect )

◆ init_server() [2/2]

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::init_server ( uint32_t port,
const std::string address = "0.0.0.0",
ssl_options_t ssl_options = ssl_support_t::e_ssl_support_autodetect )
Here is the caller graph for this function:

◆ is_stop_signal_sent()

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::is_stop_signal_sent ( ) const
inlinenoexcept

Definition at line 242 of file abstract_tcp_server2.h.

242{ return m_stop_signal_sent; };

◆ run_server()

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::run_server ( size_t threads_count,
bool wait = true,
const boost::thread::attributes & attrs = boost::thread::attributes() )

Run the server's io_service loop.

Here is the caller graph for this function:

◆ send_stop_signal()

template<class t_protocol_handler>
void epee::net_utils::boosted_tcp_server< t_protocol_handler >::send_stop_signal ( )

Stop the server.

◆ set_connection_filter()

template<class t_protocol_handler>
void epee::net_utils::boosted_tcp_server< t_protocol_handler >::set_connection_filter ( i_connection_filter * pfilter)

◆ set_default_remote()

Definition at line 254 of file abstract_tcp_server2.h.

255 {
256 default_remote = std::move(remote);
257 }

◆ set_threads_prefix()

template<class t_protocol_handler>
void epee::net_utils::boosted_tcp_server< t_protocol_handler >::set_threads_prefix ( const std::string & prefix_name)

◆ timed_wait_server_stop()

template<class t_protocol_handler>
bool epee::net_utils::boosted_tcp_server< t_protocol_handler >::timed_wait_server_stop ( uint64_t wait_mseconds)

wait for service workers stop

◆ try_connect()

template<class t_protocol_handler>
try_connect_result_t epee::net_utils::boosted_tcp_server< t_protocol_handler >::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 )

Member Data Documentation

◆ server_type_map

template<class t_protocol_handler>
std::map<std::string, t_connection_type> epee::net_utils::boosted_tcp_server< t_protocol_handler >::server_type_map

Definition at line 227 of file abstract_tcp_server2.h.


The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/contrib/epee/include/net/abstract_tcp_server2.h