1 | /* $Id: UsbTestServiceGadgetHostInternal.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * UsbTestServ - Remote USB test configuration and execution server, Gadget API.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef VBOX_INCLUDED_SRC_usb_UsbTestServiceGadgetHostInternal_h
|
---|
38 | #define VBOX_INCLUDED_SRC_usb_UsbTestServiceGadgetHostInternal_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <iprt/cdefs.h>
|
---|
44 | #include <iprt/types.h>
|
---|
45 |
|
---|
46 | #include "UsbTestServiceGadget.h"
|
---|
47 |
|
---|
48 | RT_C_DECLS_BEGIN
|
---|
49 |
|
---|
50 | /** Pointer to an opaque type dependent gadget host instance data. */
|
---|
51 | typedef struct UTSGADGETHOSTTYPEINT *PUTSGADGETHOSTTYPEINT;
|
---|
52 | /** Pointer to a gadget host instance pointer. */
|
---|
53 | typedef PUTSGADGETHOSTTYPEINT *PPUTSGADETHOSTTYPEINT;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Gadget host interface.
|
---|
57 | */
|
---|
58 | typedef struct UTSGADGETHOSTIF
|
---|
59 | {
|
---|
60 | /** The gadget host type implemented. */
|
---|
61 | UTSGADGETHOSTTYPE enmType;
|
---|
62 | /** Description. */
|
---|
63 | const char *pszDesc;
|
---|
64 | /** Size of the interface specific instance data. */
|
---|
65 | size_t cbIf;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Initializes the gadget host interface.
|
---|
69 | *
|
---|
70 | * @returns IPRT status code.
|
---|
71 | * @param pIf The interface specific instance data.
|
---|
72 | * @param paCfg The configuration of the interface.
|
---|
73 | */
|
---|
74 | DECLR3CALLBACKMEMBER(int, pfnInit, (PUTSGADGETHOSTTYPEINT pIf, PCUTSGADGETCFGITEM paCfg));
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Terminates the gadget host interface.
|
---|
78 | *
|
---|
79 | * @param pIf The interface specific instance data.
|
---|
80 | */
|
---|
81 | DECLR3CALLBACKMEMBER(void, pfnTerm, (PUTSGADGETHOSTTYPEINT pIf));
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Adds the given gadget to the host interface.
|
---|
85 | *
|
---|
86 | * @returns IPRT status code.
|
---|
87 | * @param pIf The interface specific instance data.
|
---|
88 | * @param hGadget The gadget handle to add.
|
---|
89 | */
|
---|
90 | DECLR3CALLBACKMEMBER(int, pfnGadgetAdd, (PUTSGADGETHOSTTYPEINT pIf, UTSGADGET hGadget));
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Removes the given gadget from the host interface.
|
---|
94 | *
|
---|
95 | * @returns IPRT status code.
|
---|
96 | * @param pIf The interface specific instance data.
|
---|
97 | * @param hGadget The gadget handle to remove.
|
---|
98 | */
|
---|
99 | DECLR3CALLBACKMEMBER(int, pfnGadgetRemove, (PUTSGADGETHOSTTYPEINT pIf, UTSGADGET hGadget));
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Connects the given gadget to the host interface so it appears as connected to the client
|
---|
103 | * of the gadget host.
|
---|
104 | *
|
---|
105 | * @returns IPRT status code.
|
---|
106 | * @param pIf The interface specific instance data.
|
---|
107 | * @param hGadget The gadget handle to add.
|
---|
108 | */
|
---|
109 | DECLR3CALLBACKMEMBER(int, pfnGadgetConnect, (PUTSGADGETHOSTTYPEINT pIf, UTSGADGET hGadget));
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Disconnects the given gadget from the host interface so it appears as disconnected to the client
|
---|
113 | * of the gadget host.
|
---|
114 | *
|
---|
115 | * @returns IPRT status code.
|
---|
116 | * @param pIf The interface specific instance data.
|
---|
117 | * @param hGadget The gadget handle to add.
|
---|
118 | */
|
---|
119 | DECLR3CALLBACKMEMBER(int, pfnGadgetDisconnect, (PUTSGADGETHOSTTYPEINT pIf, UTSGADGET hGadget));
|
---|
120 |
|
---|
121 | } UTSGADGETHOSTIF;
|
---|
122 | /** Pointer to a gadget host callback table. */
|
---|
123 | typedef UTSGADGETHOSTIF *PUTSGADGETHOSTIF;
|
---|
124 | /** Pointer to a const gadget host callback table. */
|
---|
125 | typedef const struct UTSGADGETHOSTIF *PCUTSGADGETHOSTIF;
|
---|
126 |
|
---|
127 | extern UTSGADGETHOSTIF const g_UtsGadgetHostIfUsbIp;
|
---|
128 |
|
---|
129 | RT_C_DECLS_END
|
---|
130 |
|
---|
131 | #endif /* !VBOX_INCLUDED_SRC_usb_UsbTestServiceGadgetHostInternal_h */
|
---|
132 |
|
---|