VirtualBox

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

Last change on this file since 69859 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: RemoteUSBBackend.h 69500 2017-10-28 15:14:05Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox Remote USB backend
5 */
6
7/*
8 * Copyright (C) 2006-2017 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef ____H_REMOTEUSBBACKEND
20#define ____H_REMOTEUSBBACKEND
21
22#include "RemoteUSBDeviceImpl.h"
23
24#include <VBox/RemoteDesktop/VRDE.h>
25#include <VBox/vrdpusb.h>
26
27#include <iprt/critsect.h>
28
29//typedef enum
30//{
31// RDLIdle = 0,
32// RDLReqSent,
33// RDLObtained
34//} RDLState;
35
36class Console;
37class ConsoleVRDPServer;
38
39DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet);
40
41
42/* How many remote devices can be attached to a remote client.
43 * Normally a client computer has 2-8 physical USB ports, so 16 devices
44 * should be usually enough.
45 */
46#define VRDP_MAX_USB_DEVICES_PER_CLIENT (16)
47
48class RemoteUSBBackendListable
49{
50 public:
51 RemoteUSBBackendListable *pNext;
52 RemoteUSBBackendListable *pPrev;
53
54 RemoteUSBBackendListable() : pNext (NULL), pPrev (NULL) {};
55};
56
57class RemoteUSBBackend: public RemoteUSBBackendListable
58{
59 public:
60 RemoteUSBBackend(Console *console, ConsoleVRDPServer *server, uint32_t u32ClientId);
61 ~RemoteUSBBackend();
62
63 uint32_t ClientId (void) { return mu32ClientId; }
64
65 void AddRef (void);
66 void Release (void);
67
68 REMOTEUSBCALLBACK *GetBackendCallbackPointer (void) { return &mCallback; }
69
70 void NotifyDelete (void);
71
72 void PollRemoteDevices (void);
73
74 public: /* Functions for internal use. */
75 ConsoleVRDPServer *VRDPServer (void) { return mServer; };
76
77 bool pollingEnabledURB (void) { return mfPollURB; }
78
79 int saveDeviceList (const void *pvList, uint32_t cbList);
80
81 int negotiateResponse (const VRDEUSBREQNEGOTIATERET *pret, uint32_t cbRet);
82
83 int reapURB (const void *pvBody, uint32_t cbBody);
84
85 void request (void);
86 void release (void);
87
88 PREMOTEUSBDEVICE deviceFromId (VRDEUSBDEVID id);
89
90 void addDevice (PREMOTEUSBDEVICE pDevice);
91 void removeDevice (PREMOTEUSBDEVICE pDevice);
92
93 bool addUUID (const Guid *pUuid);
94 bool findUUID (const Guid *pUuid);
95 void removeUUID (const Guid *pUuid);
96
97 private:
98 Console *mConsole;
99 ConsoleVRDPServer *mServer;
100
101 int cRefs;
102
103 uint32_t mu32ClientId;
104
105 RTCRITSECT mCritsect;
106
107 REMOTEUSBCALLBACK mCallback;
108
109 bool mfHasDeviceList;
110
111 void *mpvDeviceList;
112 uint32_t mcbDeviceList;
113
114 typedef enum {
115 PollRemoteDevicesStatus_Negotiate,
116 PollRemoteDevicesStatus_WaitNegotiateResponse,
117 PollRemoteDevicesStatus_SendRequest,
118 PollRemoteDevicesStatus_WaitResponse,
119 PollRemoteDevicesStatus_Dereferenced
120 } PollRemoteDevicesStatus;
121
122 PollRemoteDevicesStatus menmPollRemoteDevicesStatus;
123
124 bool mfPollURB;
125
126 PREMOTEUSBDEVICE mpDevices;
127
128 bool mfWillBeDeleted;
129
130 Guid aGuids[VRDP_MAX_USB_DEVICES_PER_CLIENT];
131
132 /* VRDP_USB_VERSION_2: the client version. */
133 uint32_t mClientVersion;
134
135 /* VRDP_USB_VERSION_3: the client sends VRDE_USB_REQ_DEVICE_LIST_EXT_RET. */
136 bool mfDescExt;
137};
138
139#endif /* ____H_REMOTEUSBBACKEND */
140/* 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