VirtualBox

source: vbox/trunk/src/VBox/Main/include/RemoteUSBBackend.h@ 4044

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

VRDP NO_COM code in Main.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 *
3 * VirtualBox Remote USB backend
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_REMOTEUSBBACKEND
23#define ____H_REMOTEUSBBACKEND
24
25#include "RemoteUSBDeviceImpl.h"
26
27#include <VBox/vrdpapi.h>
28#include <VBox/vrdpusb.h>
29
30//typedef enum
31//{
32// RDLIdle = 0,
33// RDLReqSent,
34// RDLObtained
35//} RDLState;
36
37class Console;
38class ConsoleVRDPServer;
39
40#ifdef VRDP_NO_COM
41DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet);
42#endif /* VRDP_NO_COM */
43
44
45/* How many remote devices can be attached to a remote client.
46 * Normally a client computer has 2-8 physical USB ports, so 16 devices
47 * should be usually enough.
48 */
49#define VRDP_MAX_USB_DEVICES_PER_CLIENT (16)
50
51class RemoteUSBBackendListable
52{
53 public:
54 RemoteUSBBackendListable *pNext;
55 RemoteUSBBackendListable *pPrev;
56
57 RemoteUSBBackendListable() : pNext (NULL), pPrev (NULL) {};
58};
59
60class RemoteUSBBackend: public RemoteUSBBackendListable
61{
62 public:
63 RemoteUSBBackend(Console *console, ConsoleVRDPServer *server, uint32_t u32ClientId);
64 ~RemoteUSBBackend();
65
66 uint32_t ClientId (void) { return mu32ClientId; }
67
68 void AddRef (void);
69 void Release (void);
70
71#ifdef VRDP_NO_COM
72#else
73 void QueryVRDPCallbackPointer (PFNVRDPUSBCALLBACK *ppfn, void **ppv);
74#endif /* VRDP_NO_COM */
75
76 REMOTEUSBCALLBACK *GetBackendCallbackPointer (void) { return &mCallback; }
77
78 void NotifyDelete (void);
79
80 void PollRemoteDevices (void);
81
82 public: /* Functions for internal use. */
83 ConsoleVRDPServer *VRDPServer (void) { return mServer; };
84
85 bool pollingEnabledURB (void) { return mfPollURB; }
86
87 int saveDeviceList (const void *pvList, uint32_t cbList);
88
89 int negotiateResponse (const VRDPUSBREQNEGOTIATERET *pret);
90
91 int reapURB (const void *pvBody, uint32_t cbBody);
92
93 void request (void);
94 void release (void);
95
96 PREMOTEUSBDEVICE deviceFromId (VRDPUSBDEVID id);
97
98 void addDevice (PREMOTEUSBDEVICE pDevice);
99 void removeDevice (PREMOTEUSBDEVICE pDevice);
100
101 bool addUUID (const Guid *pUuid);
102 bool findUUID (const Guid *pUuid);
103 void removeUUID (const Guid *pUuid);
104
105 private:
106 Console *mConsole;
107 ConsoleVRDPServer *mServer;
108
109 int cRefs;
110
111 uint32_t mu32ClientId;
112
113 RTCRITSECT mCritsect;
114
115 REMOTEUSBCALLBACK mCallback;
116
117 bool mfHasDeviceList;
118
119 void *mpvDeviceList;
120 uint32_t mcbDeviceList;
121
122 typedef enum {
123 PollRemoteDevicesStatus_Negotiate,
124 PollRemoteDevicesStatus_WaitNegotiateResponse,
125 PollRemoteDevicesStatus_SendRequest,
126 PollRemoteDevicesStatus_WaitResponse,
127 PollRemoteDevicesStatus_Dereferenced
128 } PollRemoteDevicesStatus;
129
130 PollRemoteDevicesStatus menmPollRemoteDevicesStatus;
131
132 bool mfPollURB;
133
134 PREMOTEUSBDEVICE mpDevices;
135
136 bool mfWillBeDeleted;
137
138 Guid aGuids[VRDP_MAX_USB_DEVICES_PER_CLIENT];
139};
140
141#endif /* ____H_REMOTEUSBBACKEND */
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