SourceMod SDK  1.7
SourceMod::IHandleSys Class Referenceabstract

Provides functions for managing Handles. More...

#include <public/IHandleSys.h>

Inheritance diagram for SourceMod::IHandleSys:
SourceMod::SMInterface

Public Member Functions

virtual unsigned int GetInterfaceVersion ()
 Must return an integer defining the interface's version.
 
virtual const char * GetInterfaceName ()
 Must return a string defining the interface's unique name.
 
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. More...
 
virtual bool RemoveType (HandleType_t type, IdentityToken_t *ident)=0
 Removes a handle type. NOTE: This removes all child types. More...
 
virtual bool FindHandleType (const char *name, HandleType_t *type)=0
 Finds a handle type by name. More...
 
virtual Handle_t CreateHandle (HandleType_t type, void *object, IdentityToken_t *owner, IdentityToken_t *ident, HandleError *err)=0
 Creates a new handle. More...
 
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 decrement the internal reference counter. It will only perform any further action if the counter hits 0. More...
 
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 remain the same. More...
 
virtual HandleError ReadHandle (Handle_t handle, HandleType_t type, const HandleSecurity *pSecurity, void **object)=0
 Retrieves the contents of a handle. More...
 
virtual bool InitAccessDefaults (TypeAccess *pTypeAccess, HandleAccess *pHandleAccess)=0
 Sets access permissions on one or more structures. More...
 
virtual Handle_t CreateHandleEx (HandleType_t type, void *object, const HandleSecurity *pSec, const HandleAccess *pAccess, HandleError *err)=0
 Creates a new handle. More...
 
virtual Handle_t FastCloneHandle (Handle_t hndl)=0
 Clones a handle, bypassing security checks. More...
 
virtual bool TypeCheck (HandleType_t given, HandleType_t actual)=0
 Type checks two handles. More...
 
- Public Member Functions inherited from SourceMod::SMInterface
virtual bool IsVersionCompatible (unsigned int version)
 Must return whether the requested version number is backwards compatible. Note: This can be overridden for breaking changes or custom versioning. More...
 

Detailed Description

Provides functions for managing Handles.

Member Function Documentation

virtual HandleError SourceMod::IHandleSys::CloneHandle ( Handle_t  handle,
Handle_t *  newhandle,
IdentityToken_t *  newOwner,
const HandleSecurity pSecurity 
)
pure virtual

Clones a handle by adding to its internal reference count. Its data, type, and security permissions remain the same.

Parameters
handleHandle to duplicate. Any non-free handle target is valid.
newhandleStores the duplicated handle in the pointer (must not be NULL).
newOwnerNew owner of cloned handle.
pSecuritySecurity information struct (may be NULL).
Returns
A HandleError error code.
virtual Handle_t SourceMod::IHandleSys::CreateHandle ( HandleType_t  type,
void *  object,
IdentityToken_t *  owner,
IdentityToken_t *  ident,
HandleError *  err 
)
pure virtual

Creates a new handle.

Parameters
typeType to use on the handle.
objectObject to bind to the handle.
ownerOwner of the new Handle (may be NULL).
identIdentity for type access if needed (may be NULL).
errOptional pointer to store an error code on failure (undefined on success).
Returns
A new Handle_t, or 0 on failure.
virtual Handle_t SourceMod::IHandleSys::CreateHandleEx ( HandleType_t  type,
void *  object,
const HandleSecurity pSec,
const HandleAccess pAccess,
HandleError *  err 
)
pure virtual

Creates a new handle.

Parameters
typeType to use on the handle.
objectObject to bind to the handle.
pSecSecurity pointer; pOwner is written as the owner, pIdent is used as the parent identity for authorization.
pAccessAccess right descriptor for the Handle; NULL for type defaults.
errOptional pointer to store an error code on failure (undefined on success).
Returns
A new Handle_t, or 0 on failure.
virtual HandleType_t SourceMod::IHandleSys::CreateType ( const char *  name,
IHandleTypeDispatch dispatch,
HandleType_t  parent,
const TypeAccess typeAccess,
const HandleAccess hndlAccess,
IdentityToken_t *  ident,
HandleError *  err 
)
pure virtual

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.

Parameters
nameName of handle type (NULL or "" to be anonymous)
dispatchPointer to a valid IHandleTypeDispatch object.
parentParent handle to inherit from, 0 for none.
typeAccessPointer to a TypeAccess object, NULL to use default or inherited permissions. Pointer can be temporary.
hndlAccessPointer to a HandleAccess object to define default default permissions on each Handle. NULL to use default permissions.
identSecurity token for any permissions. If typeAccess is NULL, this becomes the owning identity.
errOptional pointer to store an error code on failure (undefined on success).
Returns
A new HandleType_t unique ID, or 0 on failure.
virtual Handle_t SourceMod::IHandleSys::FastCloneHandle ( Handle_t  hndl)
pure virtual

Clones a handle, bypassing security checks.

Returns
A new Handle_t, or 0 on failure.
virtual bool SourceMod::IHandleSys::FindHandleType ( const char *  name,
HandleType_t *  type 
)
pure virtual

Finds a handle type by name.

Parameters
nameName of handle type to find (anonymous not allowed).
typeAddress to store found handle in (if not found, undefined).
Returns
True if found, false otherwise.
virtual HandleError SourceMod::IHandleSys::FreeHandle ( Handle_t  handle,
const HandleSecurity pSecurity 
)
pure virtual

Frees the memory associated with a handle and calls any destructors. NOTE: This function will decrement the internal reference counter. It will only perform any further action if the counter hits 0.

Parameters
handleHandle_t identifier to destroy.
pSecuritySecurity information struct (may be NULL).
Returns
A HandleError error code.
virtual bool SourceMod::IHandleSys::InitAccessDefaults ( TypeAccess pTypeAccess,
HandleAccess pHandleAccess 
)
pure virtual

Sets access permissions on one or more structures.

Parameters
pTypeAccessOptional TypeAccess buffer to initialize with the default values.
pHandleAccessOptional HandleAccess buffer to initialize with the default values.
Returns
True on success, false if version is unsupported.
virtual HandleError SourceMod::IHandleSys::ReadHandle ( Handle_t  handle,
HandleType_t  type,
const HandleSecurity pSecurity,
void **  object 
)
pure virtual

Retrieves the contents of a handle.

Parameters
handleHandle_t from which to retrieve contents.
typeExpected type to read as. 0 ignores typing rules.
pSecuritySecurity information struct (may be NULL).
objectOptional address to store object in.
Returns
HandleError error code.
virtual bool SourceMod::IHandleSys::RemoveType ( HandleType_t  type,
IdentityToken_t *  ident 
)
pure virtual

Removes a handle type. NOTE: This removes all child types.

Parameters
typeType chain to remove.
identIdentity token. Removal fails if the token does not match.
Returns
True on success, false on failure.
virtual bool SourceMod::IHandleSys::TypeCheck ( HandleType_t  given,
HandleType_t  actual 
)
pure virtual

Type checks two handles.

Parameters
givenType to test.
actualType to check for.
Returns
True if "given" is a subtype of "actual", false otherwise.

The documentation for this class was generated from the following file: