FreeRDP-WebConnect WebSockets gateway  1.0.0.167
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
wshandler.hpp
1 /* vim: set et ts=4 sw=4 cindent:
2  *
3  * FreeRDP-WebConnect,
4  * A gateway for seamless access to your RDP-Sessions in any HTML5-compliant browser.
5  *
6  * Copyright 2012 Fritz Elfert <wsgate@fritz-elfert.de>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef WSHANDLER_H
21 #define WSHANDLER_H
22 
23 #include <string>
24 #include "wsgate.hpp"
25 
26 namespace wspp {
27  class wsendpoint;
28 
29  using wsgate::log;
30 
40  class wshandler {
41  public:
46  void send_text(const std::string & data);
47 
52  void send_binary(const std::string & data);
53 
55  wshandler() : m_endpoint(0) {}
56 
58  virtual ~wshandler() {}
59 
60  private:
61  virtual void on_message(std::string header, std::string data) = 0;
62  virtual void on_close() = 0;
63  virtual bool on_ping(const std::string & data) = 0;
64  virtual void on_pong(const std::string & data) = 0;
65  virtual void do_response(const std::string & data) = 0;
66 
67  // void send(const std::string& payload, frame::opcode::value op);
68 
69  wshandler(const wspp::wshandler&);
70  wshandler& operator=(const wspp::wshandler&);
71 
72  wsendpoint *m_endpoint;
73  friend class wsendpoint;
74  };
75 
76 }
77 
78 #endif