VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • 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 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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * 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
36#ifdef VRDP_NO_COM
37DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet);
38#endif /* VRDP_NO_COM */
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#ifdef VRDP_NO_COM
68#else
69 void QueryVRDPCallbackPointer (PFNVRDPUSBCALLBACK *ppfn, void **ppv);
70#endif /* VRDP_NO_COM */
71
72 REMOTEUSBCALLBACK *GetBackendCallbackPointer (void) { return &mCallback; }
73
74 void NotifyDelete (void);
75
76 void PollRemoteDevices (void);
77
78 public: /* Functions for internal use. */
79 ConsoleVRDPServer *VRDPServer (void) { return mServer; };
80
81 bool pollingEnabledURB (void) { return mfPollURB; }
82
83 int saveDeviceList (const void *pvList, uint32_t cbList);
84
85 int negotiateResponse (const VRDPUSBREQNEGOTIATERET *pret);
86
87 int reapURB (const void *pvBody, uint32_t cbBody);
88
89 void request (void);
90 void release (void);
91
92 PREMOTEUSBDEVICE deviceFromId (VRDPUSBDEVID id);
93
94 void addDevice (PREMOTEUSBDEVICE pDevice);
95 void removeDevice (PREMOTEUSBDEVICE pDevice);
96
97 bool addUUID (const Guid *pUuid);
98 bool findUUID (const Guid *pUuid);
99 void removeUUID (const Guid *pUuid);
100
101 private:
102 Console *mConsole;
103 ConsoleVRDPServer *mServer;
104
105 int cRefs;
106
107 uint32_t mu32ClientId;
108
109 RTCRITSECT mCritsect;
110
111 REMOTEUSBCALLBACK mCallback;
112
113 bool mfHasDeviceList;
114
115 void *mpvDeviceList;
116 uint32_t mcbDeviceList;
117
118 typedef enum {
119 PollRemoteDevicesStatus_Negotiate,
120 PollRemoteDevicesStatus_WaitNegotiateResponse,
121 PollRemoteDevicesStatus_SendRequest,
122 PollRemoteDevicesStatus_WaitResponse,
123 PollRemoteDevicesStatus_Dereferenced
124 } PollRemoteDevicesStatus;
125
126 PollRemoteDevicesStatus menmPollRemoteDevicesStatus;
127
128 bool mfPollURB;
129
130 PREMOTEUSBDEVICE mpDevices;
131
132 bool mfWillBeDeleted;
133
134 Guid aGuids[VRDP_MAX_USB_DEVICES_PER_CLIENT];
135};
136
137#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