Electroneum
levin_abstract_invoke2.h File Reference
#include "portable_storage_template_helper.h"
#include <boost/utility/value_init.hpp>
#include <functional>
#include "span.h"
#include "net/levin_base.h"
Include dependency graph for levin_abstract_invoke2.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 epee
 
 epee::net_utils
 

Macros

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "net"
 
#define CHAIN_LEVIN_INVOKE_MAP2(context_type)
 
#define CHAIN_LEVIN_NOTIFY_MAP2(context_type)
 
#define CHAIN_LEVIN_INVOKE_MAP()
 
#define CHAIN_LEVIN_NOTIFY_MAP()
 
#define CHAIN_LEVIN_NOTIFY_STUB()
 
#define BEGIN_INVOKE_MAP2(owner_type)
 
#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out)
 
#define HANDLE_INVOKE_T2(COMMAND, func)
 
#define HANDLE_NOTIFY2(command_id, func, type_name_in)
 
#define HANDLE_NOTIFY_T2(NOTIFY, func)
 
#define CHAIN_INVOKE_MAP2(func)
 
#define CHAIN_INVOKE_MAP_TO_OBJ2(obj)
 
#define CHAIN_INVOKE_MAP_TO_OBJ_FORCE_CONTEXT(obj, context_type)
 
#define END_INVOKE_MAP2()
 

Functions

template<class t_arg , class t_result , class t_transport >
bool epee::net_utils::invoke_remote_command2 (int command, const t_arg &out_struct, t_result &result_struct, t_transport &transport)
 
template<class t_arg , class t_transport >
bool epee::net_utils::notify_remote_command2 (int command, const t_arg &out_struct, t_transport &transport)
 
template<class t_arg , class t_result , class t_transport >
bool epee::net_utils::invoke_remote_command2 (boost::uuids::uuid conn_id, int command, const t_arg &out_struct, t_result &result_struct, t_transport &transport)
 
template<class t_result , class t_arg , class callback_t , class t_transport >
bool epee::net_utils::async_invoke_remote_command2 (boost::uuids::uuid conn_id, int command, const t_arg &out_struct, t_transport &transport, const callback_t &cb, size_t inv_timeout=LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
 
template<class t_arg , class t_transport >
bool epee::net_utils::notify_remote_command2 (boost::uuids::uuid conn_id, int command, const t_arg &out_struct, t_transport &transport)
 
template<class t_owner , class t_in_type , class t_out_type , class t_context , class callback_t >
int epee::net_utils::buff_to_t_adapter (int command, const epee::span< const uint8_t > in_buff, std::string &buff_out, callback_t cb, t_context &context)
 
template<class t_owner , class t_in_type , class t_context , class callback_t >
int epee::net_utils::buff_to_t_adapter (t_owner *powner, int command, const epee::span< const uint8_t > in_buff, callback_t cb, t_context &context)
 

Macro Definition Documentation

◆ BEGIN_INVOKE_MAP2

#define BEGIN_INVOKE_MAP2 (   owner_type)
Value:
template <class t_context> int handle_invoke_map(bool is_notify, int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, t_context& context, bool& handled) \
{ \
typedef owner_type internal_owner_type_name;
::std::string string
Definition: gtest-port.h:1097
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 254 of file levin_abstract_invoke2.h.

◆ CHAIN_INVOKE_MAP2

#define CHAIN_INVOKE_MAP2 (   func)
Value:
{ \
int res = func(is_notify, command, in_buff, buff_out, context, handled); \
if(handled) \
return res; \
}
const char * res
Definition: hmac_keccak.cpp:41
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 277 of file levin_abstract_invoke2.h.

◆ CHAIN_INVOKE_MAP_TO_OBJ2

#define CHAIN_INVOKE_MAP_TO_OBJ2 (   obj)
Value:
{ \
int res = obj.handle_invoke_map(is_notify, command, in_buff, buff_out, context, handled); \
if(handled) \
return res; \
}
const char * res
Definition: hmac_keccak.cpp:41
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 284 of file levin_abstract_invoke2.h.

◆ CHAIN_INVOKE_MAP_TO_OBJ_FORCE_CONTEXT

#define CHAIN_INVOKE_MAP_TO_OBJ_FORCE_CONTEXT (   obj,
  context_type 
)
Value:
{ \
int res = obj.handle_invoke_map(is_notify, command, in_buff, buff_out, static_cast<context_type>(context), handled); \
if(handled) return res; \
}
const char * res
Definition: hmac_keccak.cpp:41
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 291 of file levin_abstract_invoke2.h.

◆ CHAIN_LEVIN_INVOKE_MAP

#define CHAIN_LEVIN_INVOKE_MAP ( )
Value:
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, epee::net_utils::connection_context_base& context) \
{ \
bool handled = false; \
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
}
::std::string string
Definition: gtest-port.h:1097
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 234 of file levin_abstract_invoke2.h.

◆ CHAIN_LEVIN_INVOKE_MAP2

#define CHAIN_LEVIN_INVOKE_MAP2 (   context_type)
Value:
int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, context_type& context) \
{ \
bool handled = false; \
return handle_invoke_map(false, command, in_buff, buff_out, context, handled); \
}
::std::string string
Definition: gtest-port.h:1097
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 219 of file levin_abstract_invoke2.h.

◆ CHAIN_LEVIN_NOTIFY_MAP

#define CHAIN_LEVIN_NOTIFY_MAP ( )
Value:
{ \
bool handled = false; std::string fake_str;\
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
}
::std::string string
Definition: gtest-port.h:1097
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 241 of file levin_abstract_invoke2.h.

◆ CHAIN_LEVIN_NOTIFY_MAP2

#define CHAIN_LEVIN_NOTIFY_MAP2 (   context_type)
Value:
int notify(int command, const epee::span<const uint8_t> in_buff, context_type& context) \
{ \
bool handled = false; std::string fake_str;\
return handle_invoke_map(true, command, in_buff, fake_str, context, handled); \
}
::std::string string
Definition: gtest-port.h:1097
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 226 of file levin_abstract_invoke2.h.

◆ CHAIN_LEVIN_NOTIFY_STUB

#define CHAIN_LEVIN_NOTIFY_STUB ( )
Value:
{ \
return -1; \
}
Non-owning sequence of data. Does not deep copy.
Definition: span.h:56
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 248 of file levin_abstract_invoke2.h.

◆ ELECTRONEUM_DEFAULT_LOG_CATEGORY

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "net"

Definition at line 36 of file levin_abstract_invoke2.h.

◆ END_INVOKE_MAP2

#define END_INVOKE_MAP2 ( )
Value:
LOG_ERROR("Unknown command:" << command); \
}
#define LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED
Definition: levin_base.h:99
#define LOG_ERROR(x)
Definition: misc_log_ex.h:98

Definition at line 298 of file levin_abstract_invoke2.h.

◆ HANDLE_INVOKE2

#define HANDLE_INVOKE2 (   command_id,
  func,
  type_name_in,
  typename_out 
)
Value:
if(!is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 259 of file levin_abstract_invoke2.h.

◆ HANDLE_INVOKE_T2

#define HANDLE_INVOKE_T2 (   COMMAND,
  func 
)
Value:
if(!is_notify && COMMAND::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 263 of file levin_abstract_invoke2.h.

◆ HANDLE_NOTIFY2

#define HANDLE_NOTIFY2 (   command_id,
  func,
  type_name_in 
)
Value:
if(is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 268 of file levin_abstract_invoke2.h.

◆ HANDLE_NOTIFY_T2

#define HANDLE_NOTIFY_T2 (   NOTIFY,
  func 
)
Value:
if(is_notify && NOTIFY::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98

Definition at line 272 of file levin_abstract_invoke2.h.