VirtualBox

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

Last change on this file since 76542 was 76487, checked in by vboxsync, 6 years ago

Main/include: Slapped #pragma once on all headers in prep for GCC precompiled headers. Won't catch repeat includes of an already precompiled header otherwise, i.e. killing most of the PCH gain.

  • 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 76487 2018-12-27 03:31:39Z 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#ifndef RT_WITHOUT_PRAGMA_ONCE
22# pragma once
23#endif
24
25#include "RemoteUSBDeviceImpl.h"
26
27#include <VBox/RemoteDesktop/VRDE.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 VRDEUSBREQNEGOTIATERET *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 (VRDEUSBDEVID 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 /* VRDP_USB_VERSION_3: the client sends VRDE_USB_REQ_DEVICE_LIST_EXT_RET. */
139 bool mfDescExt;
140};
141
142#endif /* ____H_REMOTEUSBBACKEND */
143/* 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