Electroneum
Loading...
Searching...
No Matches
epee::net_utils::munin::munin_node_server_connection_handler Class Reference

#include <munin_connection_handler.h>

Collaboration diagram for epee::net_utils::munin::munin_node_server_connection_handler:

Public Types

typedef node_server_config config_type
typedef connection_context_base connection_context

Public Member Functions

 munin_node_server_connection_handler (i_service_endpoint *psnd_hndlr, config_type &config, const connection_context_base &context)
virtual ~munin_node_server_connection_handler ()
bool release_protocol ()
bool after_init_connection ()
virtual bool thread_init ()
virtual bool thread_deinit ()
void handle_qued_callback ()
virtual bool handle_recv (const void *ptr, size_t cb)

Protected Attributes

i_service_endpointm_psnd_hndlr

Detailed Description

Definition at line 99 of file munin_connection_handler.h.

Member Typedef Documentation

◆ config_type

◆ connection_context

Constructor & Destructor Documentation

◆ munin_node_server_connection_handler()

epee::net_utils::munin::munin_node_server_connection_handler::munin_node_server_connection_handler ( i_service_endpoint * psnd_hndlr,
config_type & config,
const connection_context_base & context )
inline

Definition at line 105 of file munin_connection_handler.h.

105 :m_psnd_hndlr(psnd_hndlr),
106 m_machine_state(http_state_retriving_comand_line),
107 m_config(config)
108 {
109 init();
110 }
TProtocol::config_type m_config

◆ ~munin_node_server_connection_handler()

virtual epee::net_utils::munin::munin_node_server_connection_handler::~munin_node_server_connection_handler ( )
inlinevirtual

Definition at line 111 of file munin_connection_handler.h.

112 {
113
114 }

Member Function Documentation

◆ after_init_connection()

bool epee::net_utils::munin::munin_node_server_connection_handler::after_init_connection ( )
inline

Definition at line 120 of file munin_connection_handler.h.

121 {
122 std::string hello_str = "# munin node at ";
123 hello_str += m_host_name + "\n";
124 send_hook(hello_str);
125 return true;
126 }

◆ handle_qued_callback()

void epee::net_utils::munin::munin_node_server_connection_handler::handle_qued_callback ( )
inline

Definition at line 138 of file munin_connection_handler.h.

139 {
140
141 }

◆ handle_recv()

virtual bool epee::net_utils::munin::munin_node_server_connection_handler::handle_recv ( const void * ptr,
size_t cb )
inlinevirtual

Definition at line 143 of file munin_connection_handler.h.

144 {
145
146 const char* pbuff = (const char*)ptr;
147 std::string recvd_buff(pbuff, cb);
148 LOG_PRINT("munin_recv: \n" << recvd_buff, LOG_LEVEL_3);
149
150 m_cache += recvd_buff;
151
152 bool stop_handling = false;
153 while(!stop_handling)
154 {
155 switch(m_machine_state)
156 {
157 case http_state_retriving_comand_line:
158 {
159
160 std::string::size_type fpos = m_cache.find('\n');
161 if(std::string::npos != fpos )
162 {
163 bool res = handle_command(m_cache);
164 if(!res)
165 return false;
166 m_cache.erase(0, fpos+1);
167 continue;
168 }
169 stop_handling = true;
170 }
171 break;
172 case http_state_error:
173 stop_handling = true;
174 return false;
175 default:
176 LOG_ERROR("Error in munin state machine! Unknown state=" << m_machine_state);
177 stop_handling = true;
178 m_machine_state = http_state_error;
179 return false;
180 }
181
182 }
183
184 return true;
185 }
const char * res
#define LOG_ERROR(x)
Definition misc_log_ex.h:98

◆ release_protocol()

bool epee::net_utils::munin::munin_node_server_connection_handler::release_protocol ( )
inline

Definition at line 116 of file munin_connection_handler.h.

117 {
118 return true;
119 }

◆ thread_deinit()

virtual bool epee::net_utils::munin::munin_node_server_connection_handler::thread_deinit ( )
inlinevirtual

Definition at line 133 of file munin_connection_handler.h.

134 {
135 return true;
136 }

◆ thread_init()

virtual bool epee::net_utils::munin::munin_node_server_connection_handler::thread_init ( )
inlinevirtual

Definition at line 128 of file munin_connection_handler.h.

129 {
130 return true;
131 }

Member Data Documentation

◆ m_psnd_hndlr

i_service_endpoint* epee::net_utils::munin::munin_node_server_connection_handler::m_psnd_hndlr
protected

Definition at line 325 of file munin_connection_handler.h.


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