WebSocket++
0.8.3-dev
C++ websocket client/server library
|
28 #ifndef WEBSOCKETPP_TRANSPORT_STUB_CON_HPP
29 #define WEBSOCKETPP_TRANSPORT_STUB_CON_HPP
31 #include <websocketpp/transport/stub/base.hpp>
33 #include <websocketpp/transport/base/connection.hpp>
35 #include <websocketpp/logger/levels.hpp>
37 #include <websocketpp/common/connection_hdl.hpp>
38 #include <websocketpp/common/memory.hpp>
39 #include <websocketpp/common/platforms.hpp>
54 template <
typename config>
55 class connection :
public lib::enable_shared_from_this< connection<config> > {
58 typedef connection<config>
type;
60 typedef lib::shared_ptr<type> ptr;
73 typedef lib::shared_ptr<timer> timer_ptr;
75 explicit connection(
bool is_server,
const lib::shared_ptr<alog_type> & alog,
const lib::shared_ptr<elog_type> & elog)
76 : m_alog(alog), m_elog(elog)
78 m_alog->write(log::alevel::devel,
"stub con transport constructor");
83 return type::shared_from_this();
146 return "unknown (stub transport)";
154 return connection_hdl();
177 void init(init_handler handler) {
178 m_alog->write(log::alevel::devel,
"stub connection init");
179 handler(make_error_code(error::not_implemented));
207 read_handler handler)
209 m_alog->write(log::alevel::devel,
"stub_con async_read_at_least");
210 handler(make_error_code(error::not_implemented), 0);
225 void async_write(
char const * buf, size_t len, write_handler handler) {
226 m_alog->write(log::alevel::devel,
"stub_con async_write");
227 handler(make_error_code(error::not_implemented));
242 m_alog->write(log::alevel::devel,
"stub_con async_write buffer list");
243 handler(make_error_code(error::not_implemented));
265 return lib::error_code();
273 handler(lib::error_code());
277 lib::shared_ptr<alog_type> m_alog;
278 lib::shared_ptr<elog_type> m_elog;
void async_read_at_least(size_t num_bytes, char *buf, size_t len, read_handler handler)
Initiate an async_read for at least num_bytes bytes into buf.
void init(init_handler handler)
Initialize the connection transport.
std::string get_remote_endpoint() const
Get human readable remote endpoint address.
connection< config > type
Type of this connection transport component.
void set_handle(connection_hdl hdl)
Set Connection Handle.
ptr get_shared()
Get a shared pointer to this component.
void set_secure(bool value)
Set whether or not this connection is secure.
Stub transport policy that has no input or output.
static std::vector< int > const versions_supported(helper, helper+4)
Container that stores the list of protocol versions supported.
lib::function< void()> dispatch_handler
The type and signature of the callback passed to the dispatch method.
void async_write(std::vector< buffer > const &bufs, write_handler handler)
Asyncronous Transport Write (scatter-gather)
config::concurrency_type concurrency_type
transport concurrency policy
config::alog_type alog_type
Type of this transport's access logging policy.
connection_hdl get_handle() const
Get the connection handle.
void set_uri(uri_ptr)
Set uri hook.
void async_write(char const *buf, size_t len, write_handler handler)
Asyncronous Transport Write.
config::elog_type elog_type
Type of this transport's error logging policy.
void set_remote_endpoint(std::string value)
Set human readable remote endpoint address.
bool is_secure() const
Tests whether or not the underlying transport is secure.
void async_shutdown(shutdown_handler handler)
Perform cleanup on socket shutdown_handler.
lib::error_code dispatch(dispatch_handler handler)
Call given handler back within the transport's event system (if present)
timer_ptr set_timer(long duration, timer_handler handler)
Call back a function after a period of time.