3
* HGCMObjects - Host-Guest Communication Manager objects header.
7
* Copyright (C) 2006-2007 Oracle Corporation
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.
18
#ifndef __HGCMOBJECTS__H
19
#define __HGCMOBJECTS__H
21
#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_HGCM
24
#include <iprt/assert.h>
26
#include <iprt/critsect.h>
31
typedef struct _ObjectAVLCore
33
AVLULNODECORE AvlCore;
42
HGCMOBJ_SizeHack = 0x7fffffff
48
friend uint32_t hgcmObjMake(HGCMObject *pObject, uint32_t u32HandleIn);
50
int32_t volatile m_cRefs;
51
HGCMOBJ_TYPE m_enmObjType;
60
HGCMObject(HGCMOBJ_TYPE enmObjType)
63
this->m_enmObjType = enmObjType;
68
int32_t refCnt = ASMAtomicIncS32(&m_cRefs);
70
Log(("Reference: refCnt = %d\n", refCnt));
75
int32_t refCnt = ASMAtomicDecS32(&m_cRefs);
77
Log(("Dereference: refCnt = %d\n", refCnt));
79
AssertRelease(refCnt >= 0);
91
return m_core.AvlCore.Key;
102
void hgcmObjUninit();
104
uint32_t hgcmObjGenerateHandle(HGCMObject *pObject);
105
uint32_t hgcmObjAssignHandle(HGCMObject *pObject, uint32_t u32Handle);
107
void hgcmObjDeleteHandle(uint32_t handle);
109
HGCMObject *hgcmObjReference(uint32_t handle, HGCMOBJ_TYPE enmObjType);
111
void hgcmObjDereference(HGCMObject *pObject);
113
uint32_t hgcmObjQueryHandleCount();
114
void hgcmObjSetHandleCount(uint32_t u32HandleCount);
116
#endif /* __HGCMOBJECTS__H */