FreeRDP-WebConnect WebSockets gateway  1.0.0.167
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
myrawsocket.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 _MYRAWSOCKET_H_
21 #define _MYRAWSOCKET_H_
22 
23 #include "RDP.hpp"
24 
25 namespace wsgate {
26 
27  class WsGate;
28  class RDP;
29 
31  typedef boost::shared_ptr<wspp::wsendpoint> conn_ptr;
33  typedef boost::shared_ptr<wspp::wshandler> handler_ptr;
35  typedef boost::shared_ptr<RDP> rdp_ptr;
37  typedef boost::tuple<conn_ptr, handler_ptr, rdp_ptr> conn_tuple;
39  typedef std::map<EHSConnection *, conn_tuple> conn_map;
40 
46  {
47  public:
52  MyRawSocketHandler(WsGate *parent);
53 
62  virtual bool OnData(EHSConnection *conn, std::string data);
63 
70  virtual void OnConnect(EHSConnection *conn);
71 
78  virtual void OnDisconnect(EHSConnection *conn);
79 
90  bool Prepare(EHSConnection *conn, const std::string host,
91  const std::string user, const std::string pass,
92  const WsRdpParams &params);
93 
101  void OnMessage(EHSConnection *conn, const std::string & data);
102 
103  private:
105  MyRawSocketHandler& operator=(const MyRawSocketHandler&);
106 
107  WsGate *m_parent;
108  conn_map m_cmap;
109  };
110 
111 }
112 
113 #endif