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