VirtualBox

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

Last change on this file since 3392 was 3278, checked in by vboxsync, 18 years ago

Removed some obsolete VRDP code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 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 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_CONSOLEVRDPSERVER
23#define ____H_CONSOLEVRDPSERVER
24
25#include "RemoteUSBBackend.h"
26#include <hgcm/HGCM.h>
27
28#include <VBox/VRDPAuth.h>
29
30#include <VBox/HostServices/VBoxClipboardExt.h>
31
32// ConsoleVRDPServer
33///////////////////////////////////////////////////////////////////////////////
34
35/* Member of Console. Helper class for VRDP server management. Not a COM class. */
36class ConsoleVRDPServer
37{
38public:
39 ConsoleVRDPServer (Console *console);
40 ~ConsoleVRDPServer ();
41
42 int Launch (void);
43 void SetCallback (void);
44 void Stop (void);
45
46 VRDPAuthResult Authenticate (const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,
47 const char *pszUser, const char *pszPassword, const char *pszDomain,
48 uint32_t u32ClientId);
49
50 void AuthDisconnect (const Guid &uuid, uint32_t u32ClientId);
51
52 void USBBackendCreate (uint32_t u32ClientId, PFNVRDPUSBCALLBACK *ppfn, void **ppv);
53 void USBBackendDelete (uint32_t u32ClientId);
54
55 void *USBBackendRequestPointer (uint32_t u32ClientId, const Guid *pGuid);
56 void USBBackendReleasePointer (const Guid *pGuid);
57
58 /* Private interface for the RemoteUSBBackend destructor. */
59 void usbBackendRemoveFromList (RemoteUSBBackend *pRemoteUSBBackend);
60
61 /* Private methods for the Remote USB thread. */
62 RemoteUSBBackend *usbBackendGetNext (RemoteUSBBackend *pRemoteUSBBackend);
63
64 void notifyRemoteUSBThreadRunning (RTTHREAD thread);
65 bool isRemoteUSBThreadRunning (void);
66 void waitRemoteUSBThreadEvent (unsigned cMillies);
67
68 void ClipboardCreate (uint32_t u32ClientId, PFNVRDPCLIPBOARDCALLBACK *ppfn, void **ppv);
69 void ClipboardDelete (uint32_t u32ClientId);
70
71 /*
72 * Forwarders to VRDP server library.
73 */
74 void SendUpdate (unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate) const;
75 void SendResize (void) const;
76 void SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const;
77 void SetFramebuffer (IFramebuffer *framebuffer, uint32_t fFlags) const;
78
79 void SendAudioSamples (void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format) const;
80 void SendAudioVolume (uint16_t left, uint16_t right) const;
81 void SendUSBRequest (uint32_t u32ClientId, void *pvParms, uint32_t cbParms) const;
82
83 void QueryInfo (uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const;
84
85private:
86 /* Note: This is not a ComObjPtr here, because the ConsoleVRDPServer object
87 * is actually just a part of the Console.
88 */
89 Console *mConsole;
90
91#ifdef VBOX_VRDP
92 HVRDPSERVER mhServer;
93
94 static bool loadVRDPLibrary (void);
95
96 /** Static because will never load this more than once! */
97 static RTLDRMOD mVRDPLibrary;
98
99 // VRDP API function pointers
100 static int (VBOXCALL *mpfnVRDPStartServer) (IConsole *pConsole, IVRDPServer *pVRDPServer, HVRDPSERVER *phServer);
101 static int (VBOXCALL *mpfnVRDPSetFramebuffer) (HVRDPSERVER hServer, IFramebuffer *pFramebuffer, uint32_t fFlags);
102 static void (VBOXCALL *mpfnVRDPSetCallback) (HVRDPSERVER hServer, VRDPSERVERCALLBACK *pcallback, void *pvUser);
103 static void (VBOXCALL *mpfnVRDPShutdownServer) (HVRDPSERVER hServer);
104 static void (VBOXCALL *mpfnVRDPSendUpdateBitmap)(HVRDPSERVER hServer, unsigned uScreenId, unsigned x, unsigned y, unsigned w, unsigned h);
105 static void (VBOXCALL *mpfnVRDPSendResize) (HVRDPSERVER hServer);
106 static void (VBOXCALL *mpfnVRDPSendAudioSamples)(HVRDPSERVER hserver, void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format);
107 static void (VBOXCALL *mpfnVRDPSendAudioVolume) (HVRDPSERVER hserver, uint16_t left, uint16_t right);
108 static void (VBOXCALL *mpfnVRDPSendUSBRequest) (HVRDPSERVER hserver, uint32_t u32ClientId, void *pvParms, uint32_t cbParms);
109 static void (VBOXCALL *mpfnVRDPSendUpdate) (HVRDPSERVER hServer, unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate);
110 static void (VBOXCALL *mpfnVRDPQueryInfo) (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut);
111 static void (VBOXCALL *mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData, uint32_t *pcbActualRead);
112#endif /* VBOX_VRDP */
113
114 RTCRITSECT mCritSect;
115
116 int lockConsoleVRDPServer (void);
117 void unlockConsoleVRDPServer (void);
118
119 int mcClipboardRefs;
120 HGCMSVCEXTHANDLE mhClipboard;
121 PFNVRDPCLIPBOARDEXTCALLBACK mpfnClipboardCallback;
122
123 static DECLCALLBACK(int) ClipboardCallback (void *pvCallback, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData);
124 static DECLCALLBACK(int) ClipboardServiceExtension (void *pvExtension, uint32_t u32Function, void *pvParm, uint32_t cbParms);
125
126#ifdef VBOX_WITH_USB
127 RemoteUSBBackend *usbBackendFindByUUID (const Guid *pGuid);
128 RemoteUSBBackend *usbBackendFind (uint32_t u32ClientId);
129
130 typedef struct _USBBackends
131 {
132 RemoteUSBBackend *pHead;
133 RemoteUSBBackend *pTail;
134
135 RTTHREAD thread;
136
137 bool fThreadRunning;
138
139 RTSEMEVENT event;
140 } USBBackends;
141
142 USBBackends mUSBBackends;
143
144 void remoteUSBThreadStart (void);
145 void remoteUSBThreadStop (void);
146#endif /* VBOX_WITH_USB */
147
148 /* External authentication library handle. The library is loaded in the
149 * Authenticate method and unloaded at the object destructor.
150 */
151 RTLDRMOD mAuthLibrary;
152 PVRDPAUTHENTRY mpfnAuthEntry;
153 PVRDPAUTHENTRY2 mpfnAuthEntry2;
154};
155
156
157class Console;
158
159class ATL_NO_VTABLE RemoteDisplayInfo :
160 public VirtualBoxSupportErrorInfoImpl <RemoteDisplayInfo, IRemoteDisplayInfo>,
161 public VirtualBoxSupportTranslation <RemoteDisplayInfo>,
162 public VirtualBoxBase,
163 public IRemoteDisplayInfo
164{
165public:
166
167 DECLARE_NOT_AGGREGATABLE(RemoteDisplayInfo)
168
169 DECLARE_PROTECT_FINAL_CONSTRUCT()
170
171 BEGIN_COM_MAP(RemoteDisplayInfo)
172 COM_INTERFACE_ENTRY(ISupportErrorInfo)
173 COM_INTERFACE_ENTRY(IRemoteDisplayInfo)
174 END_COM_MAP()
175
176 NS_DECL_ISUPPORTS
177
178 HRESULT FinalConstruct();
179 void FinalRelease();
180
181 /* Public initializer/uninitializer for internal purposes only. */
182 HRESULT init (Console *aParent);
183 void uninit();
184
185 /* IRemoteDisplayInfo properties */
186 #define DECL_GETTER(_aType, _aName) STDMETHOD(COMGETTER(_aName)) (_aType *a##_aName)
187 DECL_GETTER (BOOL, Active);
188 DECL_GETTER (ULONG, NumberOfClients);
189 DECL_GETTER (LONG64, BeginTime);
190 DECL_GETTER (LONG64, EndTime);
191 DECL_GETTER (ULONG64, BytesSent);
192 DECL_GETTER (ULONG64, BytesSentTotal);
193 DECL_GETTER (ULONG64, BytesReceived);
194 DECL_GETTER (ULONG64, BytesReceivedTotal);
195 DECL_GETTER (BSTR, User);
196 DECL_GETTER (BSTR, Domain);
197 DECL_GETTER (BSTR, ClientName);
198 DECL_GETTER (BSTR, ClientIP);
199 DECL_GETTER (ULONG, ClientVersion);
200 DECL_GETTER (ULONG, EncryptionStyle);
201 #undef DECL_GETTER
202
203 /* For VirtualBoxSupportErrorInfoImpl. */
204 static const wchar_t *getComponentName() { return L"RemoteDisplayInfo"; }
205
206private:
207
208 ComObjPtr <Console, ComWeakRef> mParent;
209};
210
211#endif // ____H_CONSOLEVRDPSERVER
Note: See TracBrowser for help on using the repository browser.

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