28 #ifndef WEBSOCKETPP_TRANSPORT_IOSTREAM_HPP 29 #define WEBSOCKETPP_TRANSPORT_IOSTREAM_HPP 31 #include <websocketpp/transport/base/endpoint.hpp> 32 #include <websocketpp/transport/iostream/connection.hpp> 34 #include <websocketpp/uri.hpp> 35 #include <websocketpp/logger/levels.hpp> 37 #include <websocketpp/common/memory.hpp> 41 namespace websocketpp {
45 template <
typename config>
49 typedef endpoint type;
51 typedef lib::shared_ptr<type> ptr;
54 typedef typename config::concurrency_type concurrency_type;
56 typedef typename config::elog_type elog_type;
58 typedef typename config::alog_type alog_type;
62 typedef iostream::connection<config> transport_con_type;
65 typedef typename transport_con_type::ptr transport_con_ptr;
68 explicit endpoint() : m_output_stream(NULL), m_is_secure(
false)
80 void register_ostream(std::ostream * o) {
81 m_alog->write(log::alevel::devel,
"register_ostream");
102 void set_secure(
bool value) {
116 bool is_secure()
const {
134 void set_write_handler(write_handler h) {
154 void set_shutdown_handler(shutdown_handler h) {
155 m_shutdown_handler = h;
171 void init_logging(lib::shared_ptr<alog_type> a, lib::shared_ptr<elog_type> e) {
183 void async_connect(transport_con_ptr, uri_ptr, connect_handler cb) {
184 cb(lib::error_code());
197 lib::error_code init(transport_con_ptr tcon) {
198 tcon->register_ostream(m_output_stream);
199 if (m_shutdown_handler) {
200 tcon->set_shutdown_handler(m_shutdown_handler);
202 if (m_write_handler) {
203 tcon->set_write_handler(m_write_handler);
205 return lib::error_code();
208 std::ostream * m_output_stream;
209 shutdown_handler m_shutdown_handler;
210 write_handler m_write_handler;
212 lib::shared_ptr<elog_type> m_elog;
213 lib::shared_ptr<alog_type> m_alog;