29 #ifndef _PROTOCOL_SWITCHER_H_
30 #define _PROTOCOL_SWITCHER_H_
33 #include "http_server.h"
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...");
protocl_switcher_config config_type
protocol_switcher(net_utils::i_service_endpoint *psnd_hndlr, config_type &config, const net_utils::connection_context_base &conn_context)
virtual bool handle_recv(const void *ptr, size_t cb)
bool after_init_connection()
virtual ~protocol_switcher()
t_protocol_handler(i_service_endpoint *psnd_hndlr, typename t_type::config_type &config, const connection_context &conn_context)
unsigned __int64 uint64_t
virtual bool handle_recv(const void *ptr, size_t cb)=0
http::http_custom_handler::config_type m_http_config
levin::protocol_handler::config_type m_levin_config