VirtualBox

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

Last change on this file since 25414 was 25288, checked in by vboxsync, 14 years ago

Main: preparation for deadlock detection: make lock instance data private, no more global semaphore IPRT includes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/** @file
2 *
3 * VirtualBox Remote USB backend
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
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#include <iprt/critsect.h>
31
32//typedef enum
33//{
34// RDLIdle = 0,
35// RDLReqSent,
36// RDLObtained
37//} RDLState;
38
39class Console;
40class ConsoleVRDPServer;
41
42DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet);
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 REMOTEUSBCALLBACK *GetBackendCallbackPointer (void) { return &mCallback; }
72
73 void NotifyDelete (void);
74
75 void PollRemoteDevices (void);
76
77 public: /* Functions for internal use. */
78 ConsoleVRDPServer *VRDPServer (void) { return mServer; };
79
80 bool pollingEnabledURB (void) { return mfPollURB; }
81
82 int saveDeviceList (const void *pvList, uint32_t cbList);
83
84 int negotiateResponse (const VRDPUSBREQNEGOTIATERET *pret, uint32_t cbRet);
85
86 int reapURB (const void *pvBody, uint32_t cbBody);
87
88 void request (void);
89 void release (void);
90
91 PREMOTEUSBDEVICE deviceFromId (VRDPUSBDEVID id);
92
93 void addDevice (PREMOTEUSBDEVICE pDevice);
94 void removeDevice (PREMOTEUSBDEVICE pDevice);
95
96 bool addUUID (const Guid *pUuid);
97 bool findUUID (const Guid *pUuid);
98 void removeUUID (const Guid *pUuid);
99
100 private:
101 Console *mConsole;
102 ConsoleVRDPServer *mServer;
103
104 int cRefs;
105
106 uint32_t mu32ClientId;
107
108 RTCRITSECT mCritsect;
109
110 REMOTEUSBCALLBACK mCallback;
111
112 bool mfHasDeviceList;
113
114 void *mpvDeviceList;
115 uint32_t mcbDeviceList;
116
117 typedef enum {
118 PollRemoteDevicesStatus_Negotiate,
119 PollRemoteDevicesStatus_WaitNegotiateResponse,
120 PollRemoteDevicesStatus_SendRequest,
121 PollRemoteDevicesStatus_WaitResponse,
122 PollRemoteDevicesStatus_Dereferenced
123 } PollRemoteDevicesStatus;
124
125 PollRemoteDevicesStatus menmPollRemoteDevicesStatus;
126
127 bool mfPollURB;
128
129 PREMOTEUSBDEVICE mpDevices;
130
131 bool mfWillBeDeleted;
132
133 Guid aGuids[VRDP_MAX_USB_DEVICES_PER_CLIENT];
134
135 /* VRDP_USB_VERSION_2: the client version. */
136 uint32_t mClientVersion;
137};
138
139#endif /* ____H_REMOTEUSBBACKEND */
140/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use