VirtualBox

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

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

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