#include <protocol_switcher.h>
Definition at line 69 of file protocol_switcher.h.
◆ config_type
◆ protocol_switcher()
Definition at line 88 of file protocol_switcher.h.
88 :m_http_handler(psnd_hndlr, config.m_http_config, conn_context), m_levin_handler(psnd_hndlr, config.m_levin_config, conn_context), pcurrent_handler(NULL)
89 {}
◆ ~protocol_switcher()
| virtual epee::net_utils::protocol_switcher::~protocol_switcher |
( |
| ) |
|
|
inlinevirtual |
◆ after_init_connection()
| bool epee::net_utils::protocol_switcher::after_init_connection |
( |
| ) |
|
|
inline |
◆ handle_recv()
| bool epee::net_utils::protocol_switcher::handle_recv |
( |
const void * | ptr, |
|
|
size_t | cb ) |
|
virtual |
Definition at line 91 of file protocol_switcher.h.
92 {
93 if(pcurrent_handler)
94 return pcurrent_handler->handle_recv(ptr, cb);
95 else
96 {
97 m_cached_buff.append((const char*)ptr, cb);
98 if(m_cached_buff.size() <
sizeof(
uint64_t))
99 return true;
100
102 {
103 pcurrent_handler = &m_levin_handler;
104 return pcurrent_handler->handle_recv(m_cached_buff.data(), m_cached_buff.size());
105 }
106 if(m_cached_buff.substr(0, 4) == "GET " || m_cached_buff.substr(0, 4) == "POST")
107 {
108 pcurrent_handler = &m_http_handler;
109 return pcurrent_handler->handle_recv(m_cached_buff.data(), m_cached_buff.size());
110 }else
111 {
112 LOG_ERROR(
"Wrong protocol accepted on port...");
113 return false;
114 }
115 }
116
117 return true;
118 }
unsigned __int64 uint64_t
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/protocol_switcher.h