VirtualBox

source: vbox/trunk/src/VBox/Main/include/ConsoleVRDPServer.h@ 5982

Last change on this file since 5982 was 5982, checked in by vboxsync, 17 years ago

Removed obsolete VRDP server interface that used COM.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.4 KB
Line 
1/** @file
2 *
3 * VBox Console VRDP Helper class and implementation of IRemoteDisplayInfo
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_CONSOLEVRDPSERVER
19#define ____H_CONSOLEVRDPSERVER
20
21#include "RemoteUSBBackend.h"
22#include <hgcm/HGCM.h>
23
24#include <VBox/VRDPAuth.h>
25
26#include <VBox/HostServices/VBoxClipboardExt.h>
27
28#include "SchemaDefs.h"
29
30// ConsoleVRDPServer
31///////////////////////////////////////////////////////////////////////////////
32
33typedef struct _VRDPInputSynch
34{
35 int cGuestNumLockAdaptions;
36 int cGuestCapsLockAdaptions;
37
38 bool fGuestNumLock;
39 bool fGuestCapsLock;
40 bool fGuestScrollLock;
41
42 bool fClientNumLock;
43 bool fClientCapsLock;
44 bool fClientScrollLock;
45} VRDPInputSynch;
46
47/* Member of Console. Helper class for VRDP server management. Not a COM class. */
48class ConsoleVRDPServer
49{
50public:
51 ConsoleVRDPServer (Console *console);
52 ~ConsoleVRDPServer ();
53
54 int Launch (void);
55
56 void NotifyAbsoluteMouse (bool fGuestWantsAbsolute)
57 {
58 m_fGuestWantsAbsolute = fGuestWantsAbsolute;
59 }
60
61 void NotifyKeyboardLedsChange (BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock)
62 {
63 bool fGuestNumLock = (fNumLock != FALSE);
64 bool fGuestCapsLock = (fCapsLock != FALSE);
65 bool fGuestScrollLock = (fScrollLock != FALSE);
66
67 /* Might need to resynch in case the guest itself changed the LED status. */
68 if (m_InputSynch.fClientNumLock != fGuestNumLock)
69 {
70 m_InputSynch.cGuestNumLockAdaptions = 2;
71 }
72
73 if (m_InputSynch.fClientCapsLock != fGuestCapsLock)
74 {
75 m_InputSynch.cGuestCapsLockAdaptions = 2;
76 }
77
78 m_InputSynch.fGuestNumLock = fGuestNumLock;
79 m_InputSynch.fGuestCapsLock = fGuestCapsLock;
80 m_InputSynch.fGuestScrollLock = fGuestScrollLock;
81 }
82
83 void EnableConnections (void);
84 void MousePointerUpdate (const VRDPCOLORPOINTER *pPointer);
85 void MousePointerHide (void);
86
87 void Stop (void);
88
89 VRDPAuthResult Authenticate (const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,
90 const char *pszUser, const char *pszPassword, const char *pszDomain,
91 uint32_t u32ClientId);
92
93 void AuthDisconnect (const Guid &uuid, uint32_t u32ClientId);
94
95 void USBBackendCreate (uint32_t u32ClientId, void **ppvIntercept);
96 void USBBackendDelete (uint32_t u32ClientId);
97
98 void *USBBackendRequestPointer (uint32_t u32ClientId, const Guid *pGuid);
99 void USBBackendReleasePointer (const Guid *pGuid);
100
101 /* Private interface for the RemoteUSBBackend destructor. */
102 void usbBackendRemoveFromList (RemoteUSBBackend *pRemoteUSBBackend);
103
104 /* Private methods for the Remote USB thread. */
105 RemoteUSBBackend *usbBackendGetNext (RemoteUSBBackend *pRemoteUSBBackend);
106
107 void notifyRemoteUSBThreadRunning (RTTHREAD thread);
108 bool isRemoteUSBThreadRunning (void);
109 void waitRemoteUSBThreadEvent (unsigned cMillies);
110
111 void ClipboardCreate (uint32_t u32ClientId);
112 void ClipboardDelete (uint32_t u32ClientId);
113
114 /*
115 * Forwarders to VRDP server library.
116 */
117 void SendUpdate (unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate) const;
118 void SendResize (void) const;
119 void SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const;
120
121 void SendAudioSamples (void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format) const;
122 void SendAudioVolume (uint16_t left, uint16_t right) const;
123 void SendUSBRequest (uint32_t u32ClientId, void *pvParms, uint32_t cbParms) const;
124
125 void QueryInfo (uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const;
126
127private:
128 /* Note: This is not a ComObjPtr here, because the ConsoleVRDPServer object
129 * is actually just a part of the Console.
130 */
131 Console *mConsole;
132
133#ifdef VBOX_VRDP
134 HVRDPSERVER mhServer;
135
136 static bool loadVRDPLibrary (void);
137
138 /** Static because will never load this more than once! */
139 static RTLDRMOD mVRDPLibrary;
140
141 static PFNVRDPCREATESERVER mpfnVRDPCreateServer;
142
143 static VRDPENTRYPOINTS_1 *mpEntryPoints;
144 static VRDPCALLBACKS_1 mCallbacks;
145
146 static DECLCALLBACK(int) VRDPCallbackQueryProperty (void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut);
147 static DECLCALLBACK(int) VRDPCallbackClientLogon (void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
148 static DECLCALLBACK(void) VRDPCallbackClientConnect (void *pvCallback, uint32_t u32ClientId);
149 static DECLCALLBACK(void) VRDPCallbackClientDisconnect (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted);
150 static DECLCALLBACK(int) VRDPCallbackIntercept (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept);
151 static DECLCALLBACK(int) VRDPCallbackUSB (void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint8_t u8Code, const void *pvRet, uint32_t cbRet);
152 static DECLCALLBACK(int) VRDPCallbackClipboard (void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData);
153 static DECLCALLBACK(bool) VRDPCallbackFramebufferQuery (void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo);
154 static DECLCALLBACK(void) VRDPCallbackFramebufferLock (void *pvCallback, unsigned uScreenId);
155 static DECLCALLBACK(void) VRDPCallbackFramebufferUnlock (void *pvCallback, unsigned uScreenId);
156 static DECLCALLBACK(void) VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput);
157 static DECLCALLBACK(void) VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId);
158
159 bool m_fGuestWantsAbsolute;
160 int m_mousex;
161 int m_mousey;
162
163 IFramebuffer *maFramebuffers[SchemaDefs::MaxGuestMonitors];
164
165 IConsoleCallback *mConsoleCallback;
166
167 VRDPInputSynch m_InputSynch;
168#endif /* VBOX_VRDP */
169
170 RTCRITSECT mCritSect;
171
172 int lockConsoleVRDPServer (void);
173 void unlockConsoleVRDPServer (void);
174
175 int mcClipboardRefs;
176 HGCMSVCEXTHANDLE mhClipboard;
177 PFNVRDPCLIPBOARDEXTCALLBACK mpfnClipboardCallback;
178
179 static DECLCALLBACK(int) ClipboardCallback (void *pvCallback, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData);
180 static DECLCALLBACK(int) ClipboardServiceExtension (void *pvExtension, uint32_t u32Function, void *pvParm, uint32_t cbParms);
181
182#ifdef VBOX_WITH_USB
183 RemoteUSBBackend *usbBackendFindByUUID (const Guid *pGuid);
184 RemoteUSBBackend *usbBackendFind (uint32_t u32ClientId);
185
186 typedef struct _USBBackends
187 {
188 RemoteUSBBackend *pHead;
189 RemoteUSBBackend *pTail;
190
191 RTTHREAD thread;
192
193 bool fThreadRunning;
194
195 RTSEMEVENT event;
196 } USBBackends;
197
198 USBBackends mUSBBackends;
199
200 void remoteUSBThreadStart (void);
201 void remoteUSBThreadStop (void);
202#endif /* VBOX_WITH_USB */
203
204 /* External authentication library handle. The library is loaded in the
205 * Authenticate method and unloaded at the object destructor.
206 */
207 RTLDRMOD mAuthLibrary;
208 PVRDPAUTHENTRY mpfnAuthEntry;
209 PVRDPAUTHENTRY2 mpfnAuthEntry2;
210};
211
212
213class Console;
214
215class ATL_NO_VTABLE RemoteDisplayInfo :
216 public VirtualBoxSupportErrorInfoImpl <RemoteDisplayInfo, IRemoteDisplayInfo>,
217 public VirtualBoxSupportTranslation <RemoteDisplayInfo>,
218 public VirtualBoxBase,
219 public IRemoteDisplayInfo
220{
221public:
222
223 DECLARE_NOT_AGGREGATABLE(RemoteDisplayInfo)
224
225 DECLARE_PROTECT_FINAL_CONSTRUCT()
226
227 BEGIN_COM_MAP(RemoteDisplayInfo)
228 COM_INTERFACE_ENTRY(ISupportErrorInfo)
229 COM_INTERFACE_ENTRY(IRemoteDisplayInfo)
230 END_COM_MAP()
231
232 NS_DECL_ISUPPORTS
233
234 HRESULT FinalConstruct();
235 void FinalRelease();
236
237 /* Public initializer/uninitializer for internal purposes only. */
238 HRESULT init (Console *aParent);
239 void uninit();
240
241 /* IRemoteDisplayInfo properties */
242 #define DECL_GETTER(_aType, _aName) STDMETHOD(COMGETTER(_aName)) (_aType *a##_aName)
243 DECL_GETTER (BOOL, Active);
244 DECL_GETTER (ULONG, NumberOfClients);
245 DECL_GETTER (LONG64, BeginTime);
246 DECL_GETTER (LONG64, EndTime);
247 DECL_GETTER (ULONG64, BytesSent);
248 DECL_GETTER (ULONG64, BytesSentTotal);
249 DECL_GETTER (ULONG64, BytesReceived);
250 DECL_GETTER (ULONG64, BytesReceivedTotal);
251 DECL_GETTER (BSTR, User);
252 DECL_GETTER (BSTR, Domain);
253 DECL_GETTER (BSTR, ClientName);
254 DECL_GETTER (BSTR, ClientIP);
255 DECL_GETTER (ULONG, ClientVersion);
256 DECL_GETTER (ULONG, EncryptionStyle);
257 #undef DECL_GETTER
258
259 /* For VirtualBoxSupportErrorInfoImpl. */
260 static const wchar_t *getComponentName() { return L"RemoteDisplayInfo"; }
261
262private:
263
264 ComObjPtr <Console, ComWeakRef> mParent;
265};
266
267#endif // ____H_CONSOLEVRDPSERVER
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette