// ExclusionMutua.h: interface for the CExclusionMutua class.
//
//////////////////////////////////////////////////////////////////////

/*
#if !defined(AFX_EXCLUSIONMUTUA_H__57EF4846_EBBE_11D4_A93E_00105ACAACA9__INCLUDED_)
#define AFX_EXCLUSIONMUTUA_H__57EF4846_EBBE_11D4_A93E_00105ACAACA9__INCLUDED_
*/

#include "cryptoki.h"	// Added by ClassView
#include "pkcs11t.h"	// Added by ClassView
#include "byteBuffer.h"
#include "Util.h"

#ifdef __APPLE__
#include <wintypes.h>
#endif

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CExclusionMutua  
{
public:
	void SetFunctionsPointer(	CK_CREATEMUTEX pFuncCreateMutex = NULL, 
								CK_DESTROYMUTEX pFuncDestroyMutex = NULL,
								CK_LOCKMUTEX pFuncLockMutex = NULL,
								CK_UNLOCKMUTEX pFuncUnlockMutex = NULL
							);
	CK_RV UnlockMutex();
	CK_RV LockMutex();
	CK_RV DestroyMutex(BOOL bMutexLector = false);
	CK_RV CreateMutex();
	CExclusionMutua();
	virtual ~CExclusionMutua();

	// Nombre del Mutex que crearemos
	//CK_CHAR_PTR		m_pNombre_Lector;
	byteBuffer		m_pNombre_Lector;

private:	
	CK_VOID_PTR		m_pMutex;
	CK_CREATEMUTEX	m_pFuncCreateMutex;
	CK_DESTROYMUTEX m_pFuncDestroyMutex;
	CK_LOCKMUTEX	m_pFuncLockMutex;
	CK_UNLOCKMUTEX	m_pFuncUnlockMutex;
	
	// Jesús (18/01/2002)
	// Nuevo Mutex para el lector que estemos utilizando
	CK_VOID_PTR		m_pMutex_Lector;
	CK_BBOOL		m_bMutexReady;
	CK_ULONG		m_ulNumSolic;
	
};

//#endif // !defined(AFX_EXCLUSIONMUTUA_H__57EF4846_EBBE_11D4_A93E_00105ACAACA9__INCLUDED_)
