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