32 #ifndef _INCLUDE_SOURCEMOD_HANDLESYSTEM_INTERFACE_H_
33 #define _INCLUDE_SOURCEMOD_HANDLESYSTEM_INTERFACE_H_
52 #include <sp_vm_types.h>
54 #define SMINTERFACE_HANDLESYSTEM_NAME "IHandleSys"
55 #define SMINTERFACE_HANDLESYSTEM_VERSION 5
58 #define DEFAULT_IDENTITY NULL
60 #define NO_HANDLE_TYPE 0
69 typedef unsigned int HandleType_t;
74 typedef unsigned int Handle_t;
102 HandleError_Identity,
105 HandleError_Parameter,
106 HandleError_NoInherit,
112 enum HTypeAccessRight
114 HTypeAccess_Create = 0,
125 enum HandleAccessRight
135 #define HANDLE_RESTRICT_IDENTITY (1<<0)
137 #define HANDLE_RESTRICT_OWNER (1<<1)
147 hsVersion = SMINTERFACE_HANDLESYSTEM_VERSION;
162 hsVersion = SMINTERFACE_HANDLESYSTEM_VERSION;
193 return SMINTERFACE_HANDLESYSTEM_VERSION;
227 return SMINTERFACE_HANDLESYSTEM_VERSION;
231 return SMINTERFACE_HANDLESYSTEM_NAME;
252 virtual HandleType_t
CreateType(
const char *name,
257 IdentityToken_t *ident,
258 HandleError *err) =0;
268 virtual bool RemoveType(HandleType_t type, IdentityToken_t *ident) =0;
277 virtual bool FindHandleType(
const char *name, HandleType_t *type) =0;
291 IdentityToken_t *owner,
292 IdentityToken_t *ident,
293 HandleError *err) =0;
318 IdentityToken_t *newOwner,
330 virtual HandleError
ReadHandle(Handle_t handle,
359 HandleError *err) =0;
375 virtual bool TypeCheck(HandleType_t given, HandleType_t actual) = 0;
379 #endif //_INCLUDE_SOURCEMOD_HANDLESYSTEM_INTERFACE_H_
virtual unsigned int GetDispatchVersion()
Definition: IHandleSys.h:191
virtual bool TypeCheck(HandleType_t given, HandleType_t actual)=0
Type checks two handles.
virtual HandleError ReadHandle(Handle_t handle, HandleType_t type, const HandleSecurity *pSecurity, void **object)=0
Retrieves the contents of a handle.
virtual bool InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHandleAccess)=0
Sets access permissions on one or more structures.
Provides functions for managing Handles.
Definition: IHandleSys.h:222
Defines the Share System, responsible for shared resources and dependencies.
This is used to define per-type access rights.
Definition: IHandleSys.h:142
virtual void OnHandleDestroy(HandleType_t type, void *object)=0
Called when destroying a handle. Must be implemented.
Defines the base functionality required by a shared interface.
Definition: IShareSys.h:92
IdentityToken_t * pIdentity
Definition: IHandleSys.h:181
virtual HandleType_t CreateType(const char *name, IHandleTypeDispatch *dispatch, HandleType_t parent, const TypeAccess *typeAccess, const HandleAccess *hndlAccess, IdentityToken_t *ident, HandleError *err)=0
Creates a new Handle type. NOTE: Currently, a child type may not have its own children. NOTE: Handle names must be unique if not private.
virtual bool FindHandleType(const char *name, HandleType_t *type)=0
Finds a handle type by name.
This pair of tokens is used for identification.
Definition: IHandleSys.h:171
HandleAccess()
Definition: IHandleSys.h:160
virtual bool RemoveType(HandleType_t type, IdentityToken_t *ident)=0
Removes a handle type. NOTE: This removes all child types.
unsigned int hsVersion
Definition: IHandleSys.h:164
IdentityToken_t * pOwner
Definition: IHandleSys.h:180
Hooks type-specific Handle operations.
Definition: IHandleSys.h:187
unsigned int access[HandleAccess_TOTAL]
Definition: IHandleSys.h:165
Definition: IAdminSystem.h:63
unsigned int hsVersion
Definition: IHandleSys.h:149
virtual HandleError CloneHandle(Handle_t handle, Handle_t *newhandle, IdentityToken_t *newOwner, const HandleSecurity *pSecurity)=0
Clones a handle by adding to its internal reference count. Its data, type, and security permissions r...
virtual Handle_t CreateHandleEx(HandleType_t type, void *object, const HandleSecurity *pSec, const HandleAccess *pAccess, HandleError *err)=0
Creates a new handle.
virtual HandleError FreeHandle(Handle_t handle, const HandleSecurity *pSecurity)=0
Frees the memory associated with a handle and calls any destructors. NOTE: This function will decreme...
virtual bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize)
Called to get the size of a handle's memory usage in bytes. Implementation is optional.
Definition: IHandleSys.h:213
virtual Handle_t FastCloneHandle(Handle_t hndl)=0
Clones a handle, bypassing security checks.
TypeAccess()
Definition: IHandleSys.h:145
virtual Handle_t CreateHandle(HandleType_t type, void *object, IdentityToken_t *owner, IdentityToken_t *ident, HandleError *err)=0
Creates a new handle.
virtual const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: IHandleSys.h:229
virtual unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: IHandleSys.h:225
IdentityToken_t * ident
Definition: IHandleSys.h:150
bool access[HTypeAccess_TOTAL]
Definition: IHandleSys.h:151
This is used to define per-Handle access rights.
Definition: IHandleSys.h:157