VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

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