Electroneum
Loading...
Searching...
No Matches
epee::levin::async_protocol_handler_config< t_connection_context > Class Template Reference

#include <levin_protocol_handler_async.h>

Public Types

typedef t_connection_context connection_context

Public Member Functions

int invoke (int command, const epee::span< const uint8_t > in_buff, std::string &buff_out, boost::uuids::uuid connection_id)
template<class callback_t>
int invoke_async (int command, const epee::span< const uint8_t > in_buff, boost::uuids::uuid connection_id, const callback_t &cb, size_t timeout=LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
int notify (int command, const epee::span< const uint8_t > in_buff, boost::uuids::uuid connection_id)
bool close (boost::uuids::uuid connection_id)
bool update_connection_context (const t_connection_context &contxt)
bool request_callback (boost::uuids::uuid connection_id)
template<class callback_t>
bool foreach_connection (const callback_t &cb)
template<class callback_t>
bool for_connection (const boost::uuids::uuid &connection_id, const callback_t &cb)
size_t get_connections_count ()
void set_handler (levin_commands_handler< t_connection_context > *handler, void(*destroy)(levin_commands_handler< t_connection_context > *)=NULL)
 async_protocol_handler_config ()
 ~async_protocol_handler_config ()
void del_out_connections (size_t count)
void del_in_connections (size_t count)

Public Attributes

uint64_t m_max_packet_size
uint64_t m_invoke_timeout

Friends

class async_protocol_handler< t_connection_context >

Detailed Description

template<class t_connection_context>
class epee::levin::async_protocol_handler_config< t_connection_context >

Definition at line 65 of file levin_protocol_handler_async.h.

Member Typedef Documentation

◆ connection_context

template<class t_connection_context>
typedef t_connection_context epee::levin::async_protocol_handler_config< t_connection_context >::connection_context

Definition at line 85 of file levin_protocol_handler_async.h.

Constructor & Destructor Documentation

◆ async_protocol_handler_config()

template<class t_connection_context>
epee::levin::async_protocol_handler_config< t_connection_context >::async_protocol_handler_config ( )
inline

◆ ~async_protocol_handler_config()

template<class t_connection_context>
epee::levin::async_protocol_handler_config< t_connection_context >::~async_protocol_handler_config ( )
inline

Definition at line 106 of file levin_protocol_handler_async.h.

106{ set_handler(NULL, NULL); }
void set_handler(levin_commands_handler< t_connection_context > *handler, void(*destroy)(levin_commands_handler< t_connection_context > *)=NULL)

Member Function Documentation

◆ close()

template<class t_connection_context>
bool epee::levin::async_protocol_handler_config< t_connection_context >::close ( boost::uuids::uuid connection_id)

Definition at line 902 of file levin_protocol_handler_async.h.

903{
904 CRITICAL_REGION_LOCAL(m_connects_lock);
906 return 0 != aph ? aph->close() : false;
907}
#define CRITICAL_REGION_LOCAL(x)
Definition syncobj.h:228
Here is the call graph for this function:
Here is the caller graph for this function:

◆ del_in_connections()

template<class t_connection_context>
void epee::levin::async_protocol_handler_config< t_connection_context >::del_in_connections ( size_t count)

Definition at line 803 of file levin_protocol_handler_async.h.

804{
805 delete_connections(count, true);
806}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ del_out_connections()

template<class t_connection_context>
void epee::levin::async_protocol_handler_config< t_connection_context >::del_out_connections ( size_t count)

Definition at line 797 of file levin_protocol_handler_async.h.

798{
799 delete_connections(count, false);
800}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ for_connection()

template<class t_connection_context>
template<class callback_t>
bool epee::levin::async_protocol_handler_config< t_connection_context >::for_connection ( const boost::uuids::uuid & connection_id,
const callback_t & cb )

Definition at line 866 of file levin_protocol_handler_async.h.

867{
868 CRITICAL_REGION_LOCAL(m_connects_lock);
870 if (!aph)
871 return false;
872 if(!cb(aph->get_context_ref()))
873 return false;
874 return true;
875}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ foreach_connection()

template<class t_connection_context>
template<class callback_t>
bool epee::levin::async_protocol_handler_config< t_connection_context >::foreach_connection ( const callback_t & cb)

Definition at line 853 of file levin_protocol_handler_async.h.

854{
855 CRITICAL_REGION_LOCAL(m_connects_lock);
856 for(auto& c: m_connects)
857 {
859 if(!cb(aph->get_context_ref()))
860 return false;
861 }
862 return true;
863}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_connections_count()

template<class t_connection_context>
size_t epee::levin::async_protocol_handler_config< t_connection_context >::get_connections_count ( )

Definition at line 878 of file levin_protocol_handler_async.h.

879{
880 CRITICAL_REGION_LOCAL(m_connects_lock);
881 return m_connects.size();
882}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invoke()

template<class t_connection_context>
int epee::levin::async_protocol_handler_config< t_connection_context >::invoke ( int command,
const epee::span< const uint8_t > in_buff,
std::string & buff_out,
boost::uuids::uuid connection_id )

Definition at line 837 of file levin_protocol_handler_async.h.

838{
840 int r = find_and_lock_connection(connection_id, aph);
841 return LEVIN_OK == r ? aph->invoke(command, in_buff, buff_out) : r;
842}
int invoke(int command, const epee::span< const uint8_t > in_buff, std::string &buff_out, boost::uuids::uuid connection_id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invoke_async()

template<class t_connection_context>
template<class callback_t>
int epee::levin::async_protocol_handler_config< t_connection_context >::invoke_async ( int command,
const epee::span< const uint8_t > in_buff,
boost::uuids::uuid connection_id,
const callback_t & cb,
size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED )

Definition at line 845 of file levin_protocol_handler_async.h.

846{
848 int r = find_and_lock_connection(connection_id, aph);
849 return LEVIN_OK == r ? aph->async_invoke(command, in_buff, cb, timeout) : r;
850}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ notify()

template<class t_connection_context>
int epee::levin::async_protocol_handler_config< t_connection_context >::notify ( int command,
const epee::span< const uint8_t > in_buff,
boost::uuids::uuid connection_id )

Definition at line 894 of file levin_protocol_handler_async.h.

895{
897 int r = find_and_lock_connection(connection_id, aph);
898 return LEVIN_OK == r ? aph->notify(command, in_buff) : r;
899}
int notify(int command, const epee::span< const uint8_t > in_buff, boost::uuids::uuid connection_id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_callback()

template<class t_connection_context>
bool epee::levin::async_protocol_handler_config< t_connection_context >::request_callback ( boost::uuids::uuid connection_id)

Definition at line 921 of file levin_protocol_handler_async.h.

922{
924 int r = find_and_lock_connection(connection_id, aph);
925 if(LEVIN_OK == r)
926 {
928 return true;
929 }
930 else
931 {
932 return false;
933 }
934}
bool request_callback(boost::uuids::uuid connection_id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_handler()

template<class t_connection_context>
void epee::levin::async_protocol_handler_config< t_connection_context >::set_handler ( levin_commands_handler< t_connection_context > * handler,
void(* destroy )(levin_commands_handler< t_connection_context > *) = NULL )

Definition at line 885 of file levin_protocol_handler_async.h.

886{
887 if (m_pcommands_handler && m_pcommands_handler_destroy)
888 (*m_pcommands_handler_destroy)(m_pcommands_handler);
889 m_pcommands_handler = handler;
890 m_pcommands_handler_destroy = destroy;
891}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_connection_context()

template<class t_connection_context>
bool epee::levin::async_protocol_handler_config< t_connection_context >::update_connection_context ( const t_connection_context & contxt)

Definition at line 910 of file levin_protocol_handler_async.h.

911{
912 CRITICAL_REGION_LOCAL(m_connects_lock);
913 async_protocol_handler<t_connection_context>* aph = find_connection(contxt.m_connection_id);
914 if(0 == aph)
915 return false;
917 return true;
918}
bool update_connection_context(const t_connection_context &contxt)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ async_protocol_handler< t_connection_context >

template<class t_connection_context>
friend class async_protocol_handler< t_connection_context >
friend

Definition at line 75 of file levin_protocol_handler_async.h.

Member Data Documentation

◆ m_invoke_timeout

template<class t_connection_context>
uint64_t epee::levin::async_protocol_handler_config< t_connection_context >::m_invoke_timeout

Definition at line 87 of file levin_protocol_handler_async.h.

◆ m_max_packet_size

template<class t_connection_context>
uint64_t epee::levin::async_protocol_handler_config< t_connection_context >::m_max_packet_size

Definition at line 86 of file levin_protocol_handler_async.h.


The documentation for this class was generated from the following file: