1 | /* @file
|
---|
2 | *
|
---|
3 | * Host Channel
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2023 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 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_HostChannel_HostChannel_h
|
---|
29 | #define VBOX_INCLUDED_SRC_HostChannel_HostChannel_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <iprt/list.h>
|
---|
35 |
|
---|
36 | #define LOG_GROUP LOG_GROUP_HGCM
|
---|
37 | #include <VBox/log.h>
|
---|
38 | #include <VBox/HostServices/VBoxHostChannel.h>
|
---|
39 |
|
---|
40 | #define HOSTCHLOG Log
|
---|
41 |
|
---|
42 | #ifdef DEBUG_sunlover
|
---|
43 | # undef HOSTCHLOG
|
---|
44 | # define HOSTCHLOG LogRel
|
---|
45 | #endif /* DEBUG_sunlover */
|
---|
46 |
|
---|
47 | struct VBOXHOSTCHCTX;
|
---|
48 | typedef struct VBOXHOSTCHCTX VBOXHOSTCHCTX;
|
---|
49 |
|
---|
50 | typedef struct VBOXHOSTCHCLIENT
|
---|
51 | {
|
---|
52 | RTLISTNODE nodeClient;
|
---|
53 |
|
---|
54 | VBOXHOSTCHCTX *pCtx;
|
---|
55 |
|
---|
56 | uint32_t u32ClientID;
|
---|
57 |
|
---|
58 | RTLISTANCHOR listChannels;
|
---|
59 | uint32_t volatile u32HandleSrc;
|
---|
60 |
|
---|
61 | RTLISTANCHOR listContexts; /* Callback contexts. */
|
---|
62 |
|
---|
63 | RTLISTANCHOR listEvents;
|
---|
64 |
|
---|
65 | bool fAsync; /* Guest is waiting for a message. */
|
---|
66 |
|
---|
67 | struct {
|
---|
68 | VBOXHGCMCALLHANDLE callHandle;
|
---|
69 | VBOXHGCMSVCPARM *paParms;
|
---|
70 | } async;
|
---|
71 |
|
---|
72 | } VBOXHOSTCHCLIENT;
|
---|
73 |
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * The service functions. Locking is between the service thread and the host channel provider thread.
|
---|
77 | */
|
---|
78 | int vboxHostChannelLock(void);
|
---|
79 | void vboxHostChannelUnlock(void);
|
---|
80 |
|
---|
81 | int vboxHostChannelInit(void);
|
---|
82 | void vboxHostChannelDestroy(void);
|
---|
83 |
|
---|
84 | int vboxHostChannelClientConnect(VBOXHOSTCHCLIENT *pClient);
|
---|
85 | void vboxHostChannelClientDisconnect(VBOXHOSTCHCLIENT *pClient);
|
---|
86 |
|
---|
87 | int vboxHostChannelAttach(VBOXHOSTCHCLIENT *pClient,
|
---|
88 | uint32_t *pu32Handle,
|
---|
89 | const char *pszName,
|
---|
90 | uint32_t u32Flags);
|
---|
91 | int vboxHostChannelDetach(VBOXHOSTCHCLIENT *pClient,
|
---|
92 | uint32_t u32Handle);
|
---|
93 |
|
---|
94 | int vboxHostChannelSend(VBOXHOSTCHCLIENT *pClient,
|
---|
95 | uint32_t u32Handle,
|
---|
96 | const void *pvData,
|
---|
97 | uint32_t cbData);
|
---|
98 | int vboxHostChannelRecv(VBOXHOSTCHCLIENT *pClient,
|
---|
99 | uint32_t u32Handle,
|
---|
100 | void *pvData,
|
---|
101 | uint32_t cbData,
|
---|
102 | uint32_t *pu32DataReceived,
|
---|
103 | uint32_t *pu32DataRemaining);
|
---|
104 | int vboxHostChannelControl(VBOXHOSTCHCLIENT *pClient,
|
---|
105 | uint32_t u32Handle,
|
---|
106 | uint32_t u32Code,
|
---|
107 | void *pvParm,
|
---|
108 | uint32_t cbParm,
|
---|
109 | void *pvData,
|
---|
110 | uint32_t cbData,
|
---|
111 | uint32_t *pu32SizeDataReturned);
|
---|
112 |
|
---|
113 | int vboxHostChannelEventWait(VBOXHOSTCHCLIENT *pClient,
|
---|
114 | bool *pfEvent,
|
---|
115 | VBOXHGCMCALLHANDLE callHandle,
|
---|
116 | VBOXHGCMSVCPARM *paParms);
|
---|
117 |
|
---|
118 | int vboxHostChannelEventCancel(VBOXHOSTCHCLIENT *pClient);
|
---|
119 |
|
---|
120 | int vboxHostChannelQuery(VBOXHOSTCHCLIENT *pClient,
|
---|
121 | const char *pszName,
|
---|
122 | uint32_t u32Code,
|
---|
123 | void *pvParm,
|
---|
124 | uint32_t cbParm,
|
---|
125 | void *pvData,
|
---|
126 | uint32_t cbData,
|
---|
127 | uint32_t *pu32SizeDataReturned);
|
---|
128 |
|
---|
129 | int vboxHostChannelRegister(const char *pszName,
|
---|
130 | const VBOXHOSTCHANNELINTERFACE *pInterface,
|
---|
131 | uint32_t cbInterface);
|
---|
132 | int vboxHostChannelUnregister(const char *pszName);
|
---|
133 |
|
---|
134 |
|
---|
135 | void vboxHostChannelEventParmsSet(VBOXHGCMSVCPARM *paParms,
|
---|
136 | uint32_t u32ChannelHandle,
|
---|
137 | uint32_t u32Id,
|
---|
138 | const void *pvEvent,
|
---|
139 | uint32_t cbEvent);
|
---|
140 |
|
---|
141 | void vboxHostChannelReportAsync(VBOXHOSTCHCLIENT *pClient,
|
---|
142 | uint32_t u32ChannelHandle,
|
---|
143 | uint32_t u32Id,
|
---|
144 | const void *pvEvent,
|
---|
145 | uint32_t cbEvent);
|
---|
146 |
|
---|
147 | #endif /* !VBOX_INCLUDED_SRC_HostChannel_HostChannel_h */
|
---|