Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ConnectFreeRDP.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CCONNECTFREERDP_H
4#define CCONNECTFREERDP_H
5
6#include "ConnectDesktop.h"
7#include "freerdp/freerdp.h"
8#include "ClipboardFreeRDP.h"
9#include "ConnecterFreeRDP.h"
10#include "CursorFreeRDP.h"
11#include <QSharedPointer>
12
13#ifdef HAVE_LIBSSH
14#include "SSHTunnelThread.h"
15#endif
16
18{
19 Q_OBJECT
20
21public:
22 explicit CConnectFreeRDP(CConnecterFreeRDP* pConnecter);
23 virtual ~CConnectFreeRDP() override;
24
25 static BOOL cbGlobalInit();
26 static void cbGlobalUninit();
27 static BOOL cbClientNew(freerdp* instance, rdpContext* context);
28 static void cbClientFree(freerdp* instance, rdpContext* context);
29 static int cbClientStart(rdpContext* context);
30 static int cbClientStop(rdpContext* context);
31
43 static BOOL cb_pre_connect(freerdp* instance);
49 static BOOL cb_post_connect(freerdp* instance);
50 static void cb_post_disconnect(freerdp* instance);
51 static int cb_logon_error_info(freerdp* instance, UINT32 data, UINT32 type);
52
53 static void OnChannelConnectedEventHandler(void* context,
54 #if FreeRDP_VERSION_MAJOR >= 3
55 const
56 #endif
57 ChannelConnectedEventArgs* e);
58 static void OnChannelDisconnectedEventHandler(void* context,
59 #if FreeRDP_VERSION_MAJOR >= 3
60 const
61 #endif
62 ChannelDisconnectedEventArgs* e);
63
64 static BOOL cb_authenticate(freerdp* instance,
65 char** username, char** password, char** domain);
66 static BOOL cb_GatewayAuthenticate(freerdp* instance,
67 char** username, char** password, char** domain);
68#if FreeRDP_VERSION_MAJOR >= 3
69 static BOOL cb_authenticate_ex(freerdp* instance,
70 char** username, char** password,
71 char** domain, rdp_auth_reason reason);
72 static BOOL cb_choose_smartcard(freerdp* instance,
73 SmartcardCertInfo** cert_list,
74 DWORD count,
75 DWORD* choice, BOOL gateway);
76#endif
90 static int cb_verify_x509_certificate(freerdp* instance,
91 const BYTE* data, size_t length,
92 const char* hostname, UINT16 port, DWORD flags);
93 static DWORD cb_verify_certificate_ex(freerdp* instance,
94 const char* host, UINT16 port,
95 const char* common_name, const char* subject,
96 const char* issuer, const char* fingerprint, DWORD flags);
97 static DWORD cb_verify_changed_certificate_ex(freerdp* instance,
98 const char* host, UINT16 port,
99 const char* common_name, const char* subject,
100 const char* issuer, const char* fingerprint,
101 const char* old_subject, const char* old_issuer,
102 const char* old_fingerprint, DWORD flags);
103 static BOOL cb_present_gateway_message(freerdp* instance,
104 UINT32 type, BOOL isDisplayMandatory,
105 BOOL isConsentMandatory, size_t length, const WCHAR* message);
106
107 static BOOL cb_begin_paint(rdpContext* context);
108 static BOOL cb_end_paint(rdpContext* context);
109 static BOOL cb_desktop_resize(rdpContext* context);
110 static BOOL cb_play_bell_sound(rdpContext* context,
111 const PLAY_SOUND_UPDATE* play_sound);
112 static BOOL cb_keyboard_set_indicators(rdpContext* context, UINT16 led_flags);
113 static BOOL cb_keyboard_set_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState,
114 UINT32 imeConvMode);
115
116 static UINT32 GetImageFormat(QImage::Format format);
117 static const char* GetTitle(freerdp *instance);
118
119private:
120 UINT32 GetImageFormat();
121 BOOL CreateImage(rdpContext* context);
122 BOOL UpdateBuffer(INT32 x, INT32 y, INT32 w, INT32 h);
123
124 int RedirectionSound();
125 int RedirectionMicrophone();
126 int RedirectionDriver();
127 int RedirectionPrinter();
128 int RedirectionSerial();
129
130 bool SendMouseEvent(UINT16 flags, QPoint pos, bool isExtended);
131
132 // CConnectDesktop interface
133public Q_SLOTS:
134 virtual void slotClipBoardChanged() override;
135
136protected:
137 virtual void mousePressEvent(QMouseEvent* event) override;
138 virtual void mouseReleaseEvent(QMouseEvent* event) override;
139 virtual void mouseMoveEvent(QMouseEvent* event) override;
140 virtual void wheelEvent(QWheelEvent* event) override;
141 virtual void keyPressEvent(QKeyEvent *event) override;
142 virtual void keyReleaseEvent(QKeyEvent *event) override;
143 virtual int WakeUp() override;
144
145private:
146 // CConnect interface
147 virtual OnInitReturnValue OnInit() override;
148 virtual int OnClean() override;
149 virtual int OnProcess() override;
150
151private:
153 #if FreeRDP_VERSION_MAJOR >= 3
154 rdpClientContext Context;
155 #else
156 rdpContext Context;
157 #endif
158 CConnectFreeRDP* pThis;
159 };
160 ClientContext* m_pContext;
161 CParameterFreeRDP* m_pParameter;
162
163 RDP_CLIENT_ENTRY_POINTS m_ClientEntryPoints;
164
165 QImage m_Image;
166
167 CClipboardFreeRDP m_ClipBoard;
168 CCursorFreeRDP m_Cursor;
169 friend class CCursorFreeRDP;
170
171 HANDLE m_writeEvent;
172
173#ifdef HAVE_LIBSSH
174 CSSHTunnelThread* m_pThread;
175#endif
176private Q_SLOTS:
177 void slotConnectProxyServer(QString szHost, quint16 nPort);
178};
179
180#endif // CCONNECTFREERDP_H
Remote desktop connect interface.
virtual OnInitReturnValue OnInit() override
Specific plug-in realizes connection initialization.
virtual int OnClean() override
Clean.
static int cb_verify_x509_certificate(freerdp *instance, const BYTE *data, size_t length, const char *hostname, UINT16 port, DWORD flags)
Callback used if user interaction is required to accept a certificate.
static DWORD cb_verify_changed_certificate_ex(freerdp *instance, const char *host, UINT16 port, const char *common_name, const char *subject, const char *issuer, const char *fingerprint, const char *old_subject, const char *old_issuer, const char *old_fingerprint, DWORD flags)
Callback set in the rdp_freerdp structure, and used to make a certificate validation when a stored ce...
virtual int WakeUp() override
Wake up Connect thread(background thread)
static DWORD cb_verify_certificate_ex(freerdp *instance, const char *host, UINT16 port, const char *common_name, const char *subject, const char *issuer, const char *fingerprint, DWORD flags)
Callback set in the rdp_freerdp structure, and used to make a certificate validation when the connect...
virtual int OnProcess() override
Specific operation processing of plug-in connection.
static BOOL cb_post_connect(freerdp *instance)
Callback given to freerdp_connect() to perform post-connection operations.
static BOOL cb_pre_connect(freerdp *instance)
Callback given to freerdp_connect() to process the pre-connect operations.
[Declare CParameterFreeRDP]
Data is forwarded over a local socket and SSH tunnel.