/* build situation general: - libboost_system SSL: - libcrypto - libssl */ #include #include #include #include #include class server_handler { virtual void on_action() = 0; }; typedef boost::shared_ptr server_handler_ptr; class client_handler { virtual void on_action() = 0; }; typedef boost::shared_ptr client_handler_ptr; namespace connection { template class security_policy> class connection : public security_policy< connection > { public: //typedef role< connection > role_type; typedef security_policy< connection > security_policy_type; //typedef typename role_type::handler_ptr handler_ptr; connection(endpoint_type& e) : security_policy_type(e),m_endpoint(e) { std::cout << "setup connection" << std::endl; } void websocket_handshake() { std::cout << "Websocket Handshake" << std::endl; this->websocket_messages(); } void websocket_messages() { std::cout << "Websocket Messages" << std::endl; } protected: endpoint_type& m_endpoint; }; // Connection roles template class server { public: typedef server_handler_ptr handler_ptr; server (handler_ptr h) : m_handler(h) { std::cout << "setup server connection role" << std::endl; } void public_api() { std::cout << "connection::server::public_api()" << std::endl; } protected: void protected_api() { std::cout << "connection::server::protected_api()" << std::endl; } private: void private_api() { std::cout << "connection::server::private_api()" << std::endl; } handler_ptr m_handler; }; template class client { public: typedef client_handler_ptr handler_ptr; client (handler_ptr h) : m_handler(h) { std::cout << "setup client connection role" << std::endl; } void public_api() { std::cout << "connection::client::public_api()" << std::endl; } protected: void protected_api() { std::cout << "connection::client::protected_api()" << std::endl; } private: void private_api() { std::cout << "connection::client::private_api()" << std::endl; } handler_ptr m_handler; }; } namespace endpoint { // test template struct endpoint_traits; class endpoint_base { protected: boost::asio::io_service m_io_service; }; template