view dstep/security/cssmspi.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 22, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.security.cssmspi;

import dstep.security.cssmtype;

alias uint CSSM_CONTEXT_EVENT;
alias CSSM_MODULE_FUNCS* CSSM_MODULE_FUNCS_PTR;
alias CSSM_UPCALLS* CSSM_UPCALLS_PTR;

extern (C)
{
	alias void * function (int, uint, uint) CSSM_UPCALLS_CALLOC;
	alias void * function (int, void*, uint) CSSM_UPCALLS_REALLOC;
	alias void * function (int, uint) CSSM_UPCALLS_MALLOC;
	alias int function (CSSM_GUID*, void*, uint, uint, uint) CSSM_SPI_ModuleEventHandler;
	alias void function (int, void*) CSSM_UPCALLS_FREE;
}

enum
{
	CSSM_CONTEXT_EVENT_CREATE = 1,
	CSSM_CONTEXT_EVENT_DELETE = 2,
	CSSM_CONTEXT_EVENT_UPDATE = 3
}

struct CSSM_MODULE_FUNCS
{
	uint ServiceType;
	uint NumberOfServiceFuncs;
	CSSM_PROC_ADDR* ServiceFuncs;
}


struct CSSM_UPCALLS
{
	CSSM_UPCALLS_MALLOC malloc_func;
	CSSM_UPCALLS_FREE free_func;
	CSSM_UPCALLS_REALLOC realloc_func;
	CSSM_UPCALLS_CALLOC calloc_func;
	CSSM_GUID_PTR Guid;
	CSSM_VERSION_PTR Version;
	uint* SubServiceId;
	CSSM_SERVICE_TYPE* SubServiceType;
	CSSM_ATTACH_FLAGS* AttachFlags;
	CSSM_KEY_HIERARCHY* KeyHierarchy;
	CSSM_API_MEMORY_FUNCS_PTR AttachedMemFuncs;
	CSSM_FUNC_NAME_ADDR_PTR FunctionTable;
}

extern (C)
{
	int CSSM_SPI_ModuleLoad (CSSM_GUID* CssmGuid, CSSM_GUID* ModuleGuid, CSSM_SPI_ModuleEventHandler CssmNotifyCallback, void* CssmNotifyCallbackCtx);
	int CSSM_SPI_ModuleUnload (CSSM_GUID* CssmGuid, CSSM_GUID* ModuleGuid, CSSM_SPI_ModuleEventHandler CssmNotifyCallback, void* CssmNotifyCallbackCtx);
	int CSSM_SPI_ModuleAttach (CSSM_GUID* ModuleGuid, CSSM_VERSION* Version, uint SubserviceID, uint SubServiceType, uint AttachFlags, int ModuleHandle, uint KeyHierarchy, CSSM_GUID* CssmGuid, CSSM_GUID* ModuleManagerGuid, CSSM_GUID* CallerGuid, CSSM_UPCALLS* Upcalls, CSSM_MODULE_FUNCS_PTR* FuncTbl);
	int CSSM_SPI_ModuleDetach (int ModuleHandle);
}