table.h
资源名称:pkcs11.rar [点击查看]
上传用户:filter2008
上传日期:2013-02-01
资源大小:101k
文件大小:3k
源码类别:
CA认证
开发平台:
C/C++
- /****************************************************************************
- * library : pkcs_csp.dll
- * Purpose : It is a cryptographic service provider which is an independent
- * software module that actually performs cryptography algorithms for
- * authentication, encoding, and encryption.
- * This DLL can be interfaced on any PKCS#11 module.
- *
- * Copyright (C) 2003 Ilex Syst鑝es Informatiques
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Contact :
- * Ilex
- * 51 boulevard Voltaire
- * 92600 Asni鑢es-sur-Seine
- * pkizy@ilex.fr
- *
- * Author: Delouvrier Antoine
- *
- *******************************************************************************/
- /*
- %----------------------------------------------------------------------------
- % PROJECT : CSP_PKCS
- %
- % MODULE : handletable
- %
- % VERSION : 1.00
- %
- % FILE : handletable.h
- %
- % cryptool: class allows to manage a table of handle
- %----------------------------------------------------------------------------
- % Version 1.00
- %
- % CPX-31/03/2003-Creation
- %----------------------------------------------------------------------------
- */
- #ifndef _INCL__TABLE_H
- #define _INCL__TABLE_H
- #ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x0400
- #endif
- #include <windows.h>
- #pragma once
- #define START 0
- #define EXTEND_FACTOR 2
- #define INITIAL_SIZE 3
- #define NO_ENTRY 0x0
- #define DELETED_ENTRY 0xFFFFFFFF
- class TableOfHandle
- {
- public:
- TableOfHandle();
- ~TableOfHandle();
- bool VerifyEntry(const void * const pHandle);
- bool AddEntry(void * const pHandle);
- void RemoveEntry(const void * const pHandle);
- void* GetNext(int& i);
- void Lock(){EnterCriticalSection(&critical_object);}
- void Unlock(){LeaveCriticalSection(&critical_object);}
- private:
- int GetIndex(const void * const pHandle);
- bool ExtendSize();
- CRITICAL_SECTION critical_object;
- void ** pTable;
- int tableSize;
- int entryTableUsed;
- };
- #endif