HostChannel.h revision e2a4ff87ea2e2e95350793b5fccb143c1819fadc
af062818b47340eef15700d2f0211576ba3506eevboxsync/* @file
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * Host Channel
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2012 Oracle Corporation
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License (GPL) as published by the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
af062818b47340eef15700d2f0211576ba3506eevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
af062818b47340eef15700d2f0211576ba3506eevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef __VBOXHOSTCHANNEL__H
af062818b47340eef15700d2f0211576ba3506eevboxsync#define __VBOXHOSTCHANNEL__H
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <iprt/list.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define LOG_GROUP LOG_GROUP_HGCM
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/log.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync#include <VBox/HostServices/VBoxHostChannel.h>
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define HOSTCHLOG Log
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef DEBUG_sunlover
af062818b47340eef15700d2f0211576ba3506eevboxsync# undef HOSTCHLOG
af062818b47340eef15700d2f0211576ba3506eevboxsync# define HOSTCHLOG LogRel
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif /* DEBUG_sunlover */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct VBOXHOSTCHCTX;
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct VBOXHOSTCHCTX VBOXHOSTCHCTX;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct VBOXHOSTCHCLIENT
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync RTLISTNODE nodeClient;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync VBOXHOSTCHCTX *pCtx;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync uint32_t u32ClientID;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync RTLISTANCHOR listChannels;
af062818b47340eef15700d2f0211576ba3506eevboxsync uint32_t volatile u32HandleSrc;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync RTLISTANCHOR listEvents;
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync bool fAsync; /* Guest is waiting for a message. */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync struct {
af062818b47340eef15700d2f0211576ba3506eevboxsync VBOXHGCMCALLHANDLE callHandle;
VBOXHGCMSVCPARM *paParms;
} async;
} VBOXHOSTCHCLIENT;
/*
* The service functions. Locking is between the service thread and the host channel provider thread.
*/
int vboxHostChannelLock(void);
void vboxHostChannelUnlock(void);
int vboxHostChannelInit(void);
void vboxHostChannelDestroy(void);
int vboxHostChannelClientConnect(VBOXHOSTCHCLIENT *pClient);
void vboxHostChannelClientDisconnect(VBOXHOSTCHCLIENT *pClient);
int vboxHostChannelAttach(VBOXHOSTCHCLIENT *pClient,
uint32_t *pu32Handle,
const char *pszName,
uint32_t u32Flags);
int vboxHostChannelDetach(VBOXHOSTCHCLIENT *pClient,
uint32_t u32Handle);
int vboxHostChannelSend(VBOXHOSTCHCLIENT *pClient,
uint32_t u32Handle,
const void *pvData,
uint32_t cbData);
int vboxHostChannelRecv(VBOXHOSTCHCLIENT *pClient,
uint32_t u32Handle,
void *pvData,
uint32_t cbData,
uint32_t *pu32DataReceived,
uint32_t *pu32DataRemaining);
int vboxHostChannelControl(VBOXHOSTCHCLIENT *pClient,
uint32_t u32Handle,
uint32_t u32Code,
void *pvParm,
uint32_t cbParm,
void *pvData,
uint32_t cbData,
uint32_t *pu32SizeDataReturned);
int vboxHostChannelQueryEvent(VBOXHOSTCHCLIENT *pClient,
bool *pfEvent,
uint32_t *pu32Handle,
uint32_t *pu32Id,
void *pvParm,
uint32_t cbParm,
uint32_t *pcbParmOut);
int vboxHostChannelRegister(const char *pszName,
const VBOXHOSTCHANNELINTERFACE *pInterface,
uint32_t cbInterface);
int vboxHostChannelUnregister(const char *pszName);
void vboxHostChannelReportAsync(VBOXHOSTCHCLIENT *pClient, uint32_t u32ChannelHandle,
uint32_t u32Id, const void *pvEvent, uint32_t cbEvent);
#endif /* __VBOXHOSTCHANNEL__H */