VirtualBox

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

Last change on this file since 53517 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

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