VirtualBox

source: vbox/trunk/src/VBox/HostServices/HostChannel/HostChannel.h@ 43785

Last change on this file since 43785 was 43785, checked in by vboxsync, 12 years ago

HostServices/HostChannel: callback must not access a client structure directly.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
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
34struct VBOXHOSTCHCTX;
35typedef struct VBOXHOSTCHCTX VBOXHOSTCHCTX;
36
37typedef 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 */
65int vboxHostChannelLock(void);
66void vboxHostChannelUnlock(void);
67
68int vboxHostChannelInit(void);
69void vboxHostChannelDestroy(void);
70
71int vboxHostChannelClientConnect(VBOXHOSTCHCLIENT *pClient);
72void vboxHostChannelClientDisconnect(VBOXHOSTCHCLIENT *pClient);
73
74int vboxHostChannelAttach(VBOXHOSTCHCLIENT *pClient,
75 uint32_t *pu32Handle,
76 const char *pszName,
77 uint32_t u32Flags);
78int vboxHostChannelDetach(VBOXHOSTCHCLIENT *pClient,
79 uint32_t u32Handle);
80
81int vboxHostChannelSend(VBOXHOSTCHCLIENT *pClient,
82 uint32_t u32Handle,
83 const void *pvData,
84 uint32_t cbData);
85int vboxHostChannelRecv(VBOXHOSTCHCLIENT *pClient,
86 uint32_t u32Handle,
87 void *pvData,
88 uint32_t cbData,
89 uint32_t *pu32DataReceived,
90 uint32_t *pu32DataRemaining);
91int 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
100int vboxHostChannelQueryEvent(VBOXHOSTCHCLIENT *pClient,
101 bool *pfEvent,
102 uint32_t *pu32Handle,
103 uint32_t *pu32Id,
104 void *pvParm,
105 uint32_t cbParm,
106 uint32_t *pcbParmOut);
107
108int vboxHostChannelQuery(VBOXHOSTCHCLIENT *pClient,
109 const char *pszName,
110 uint32_t u32Code,
111 void *pvParm,
112 uint32_t cbParm,
113 void *pvData,
114 uint32_t cbData,
115 uint32_t *pu32SizeDataReturned);
116
117int vboxHostChannelRegister(const char *pszName,
118 const VBOXHOSTCHANNELINTERFACE *pInterface,
119 uint32_t cbInterface);
120int vboxHostChannelUnregister(const char *pszName);
121
122
123void vboxHostChannelReportAsync(VBOXHOSTCHCLIENT *pClient, uint32_t u32ChannelHandle,
124 uint32_t u32Id, const void *pvEvent, uint32_t cbEvent);
125
126#endif /* __VBOXHOSTCHANNEL__H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette