29 #ifndef _PROTOCOL_SWITCHER_H_ 30 #define _PROTOCOL_SWITCHER_H_ 33 #include "http_server.h" 50 virtual bool handle_recv(
const void* ptr,
size_t cb)=0;
61 bool handle_recv(
const void* ptr,
size_t cb)
63 return m_hadler.handle_recv(ptr, cb);
77 virtual bool handle_recv(
const void* ptr,
size_t cb);
97 m_cached_buff.append((
const char*)ptr, cb);
98 if(m_cached_buff.size() <
sizeof(
uint64_t))
103 pcurrent_handler = &m_levin_handler;
104 return pcurrent_handler->
handle_recv(m_cached_buff.data(), m_cached_buff.size());
106 if(m_cached_buff.substr(0, 4) ==
"GET " || m_cached_buff.substr(0, 4) ==
"POST")
108 pcurrent_handler = &m_http_handler;
109 return pcurrent_handler->
handle_recv(m_cached_buff.data(), m_cached_buff.size());
112 LOG_ERROR(
"Wrong protocol accepted on port...");
121 #endif //_PROTOCOL_SWITCHER_H_
t_protocol_handler(i_service_endpoint *psnd_hndlr, typename t_type::config_type &config, const connection_context &conn_context)
bool after_init_connection()
virtual bool handle_recv(const void *ptr, size_t cb)=0
virtual ~protocol_switcher()
unsigned __int64 uint64_t
levin::protocol_handler::config_type m_levin_config
http::http_custom_handler::config_type m_http_config
protocol_switcher(net_utils::i_service_endpoint *psnd_hndlr, config_type &config, const net_utils::connection_context_base &conn_context)
protocl_switcher_config config_type
virtual bool handle_recv(const void *ptr, size_t cb)