1 | /* @file
|
---|
2 | *
|
---|
3 | * Host Channel
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012 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 listEvents;
|
---|
49 |
|
---|
50 | bool fAsync; /* Guest is waiting for a message. */
|
---|
51 |
|
---|
52 | struct {
|
---|
53 | VBOXHGCMCALLHANDLE callHandle;
|
---|
54 | VBOXHGCMSVCPARM *paParms;
|
---|
55 | } async;
|
---|
56 |
|
---|
57 | } VBOXHOSTCHCLIENT;
|
---|
58 |
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * The service functions. Locking is between the service thread and the host channel provider thread.
|
---|
62 | */
|
---|
63 | int vboxHostChannelLock(void);
|
---|
64 | void vboxHostChannelUnlock(void);
|
---|
65 |
|
---|
66 | int vboxHostChannelInit(void);
|
---|
67 | void vboxHostChannelDestroy(void);
|
---|
68 |
|
---|
69 | int vboxHostChannelClientConnect(VBOXHOSTCHCLIENT *pClient);
|
---|
70 | void vboxHostChannelClientDisconnect(VBOXHOSTCHCLIENT *pClient);
|
---|
71 |
|
---|
72 | int vboxHostChannelAttach(VBOXHOSTCHCLIENT *pClient,
|
---|
73 | uint32_t *pu32Handle,
|
---|
74 | const char *pszName,
|
---|
75 | uint32_t u32Flags);
|
---|
76 | int vboxHostChannelDetach(VBOXHOSTCHCLIENT *pClient,
|
---|
77 | uint32_t u32Handle);
|
---|
78 |
|
---|
79 | int vboxHostChannelSend(VBOXHOSTCHCLIENT *pClient,
|
---|
80 | uint32_t u32Handle,
|
---|
81 | const void *pvData,
|
---|
82 | uint32_t cbData);
|
---|
83 | int vboxHostChannelRecv(VBOXHOSTCHCLIENT *pClient,
|
---|
84 | uint32_t u32Handle,
|
---|
85 | void *pvData,
|
---|
86 | uint32_t cbData,
|
---|
87 | uint32_t *pu32DataReceived,
|
---|
88 | uint32_t *pu32DataRemaining);
|
---|
89 | int vboxHostChannelControl(VBOXHOSTCHCLIENT *pClient,
|
---|
90 | uint32_t u32Handle,
|
---|
91 | uint32_t u32Code,
|
---|
92 | void *pvParm,
|
---|
93 | uint32_t cbParm,
|
---|
94 | void *pvData,
|
---|
95 | uint32_t cbData,
|
---|
96 | uint32_t *pu32SizeDataReturned);
|
---|
97 |
|
---|
98 | int vboxHostChannelQueryEvent(VBOXHOSTCHCLIENT *pClient,
|
---|
99 | bool *pfEvent,
|
---|
100 | uint32_t *pu32Handle,
|
---|
101 | uint32_t *pu32Id,
|
---|
102 | void *pvParm,
|
---|
103 | uint32_t cbParm,
|
---|
104 | uint32_t *pcbParmOut);
|
---|
105 |
|
---|
106 | int vboxHostChannelRegister(const char *pszName,
|
---|
107 | const VBOXHOSTCHANNELINTERFACE *pInterface,
|
---|
108 | uint32_t cbInterface);
|
---|
109 | int vboxHostChannelUnregister(const char *pszName);
|
---|
110 |
|
---|
111 |
|
---|
112 | void vboxHostChannelReportAsync(VBOXHOSTCHCLIENT *pClient, uint32_t u32ChannelHandle,
|
---|
113 | uint32_t u32Id, const void *pvEvent, uint32_t cbEvent);
|
---|
114 |
|
---|
115 | #endif /* __VBOXHOSTCHANNEL__H */
|
---|