Files correlati : Ricompilazione Demo : [ ] Commento : Riportate le patch fino alla 172 git-svn-id: svn://10.65.10.50/trunk@12526 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			311 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			311 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /////////////////////////////////////////////////////////////////////////////
 | |
| //  ASECard Memory SDK Header File
 | |
| // 
 | |
| //  LICENSE AGREEMENT:
 | |
| //  1.  COPYRIGHTS AND TRADEMARKS
 | |
| //  The ASECard Memory SDK and its documentation are copyright (C) 2003 ,
 | |
| //  by Athena Smartcard Solution Inc.. All rights reserved.
 | |
| //
 | |
| //  ASECard is a trademark of Athena Smartcard Solutions Inc.. All  other  trademarks,  brands,  and product 
 | |
| //  names used in this guide are trademarks of their respective owners.
 | |
| //
 | |
| //  2.  Title & Ownership
 | |
| //  THIS IS A LICENSE AGREEMENT AND NOT AN AGREEMENT FOR SALE. 
 | |
| //  The Code IS NOT FOR SALE and is and shall remain in Athena's sole property. 
 | |
| //  All right, title and interest in and to the Code, including associated 
 | |
| //  intellectual property rights, in and to the Code are and will remain with Athena.
 | |
| //
 | |
| //  3.  Disclaimer of Warranty
 | |
| //  THE CODE CONSTITUTES A CODE SAMPLE AND IS NOT A COMPLETE PRODUCT AND MAY CONTAIN 
 | |
| //  DEFECTS, AND PRODUCE UNINTENDED OR ERRONEOUS RESULTS. THE CODE IS PROVIDED "AS IS", 
 | |
| //  WITHOUT WARRANTY OF ANY KIND. Athena DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR 
 | |
| //  IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
 | |
| //  AND FITNESS FOR A PARTICULAR PURPOSE.
 | |
| //  The entire risk arising out of the use or performance of the Code remains with you.
 | |
| //
 | |
| //  4.   No Liability For Damages
 | |
| //  Without derogating from the above, in no event shall Athena be liable for any damages 
 | |
| //  whatsoever (including, without limitation, damages for loss of business profits, business 
 | |
| //  interruption, loss of business information, or other pecuniary loss) arising out of the 
 | |
| //  use of or inability to use the Code, even if Athena has been advised of the possibility 
 | |
| //  of such damages. Your sole recourse in the event of any dissatisfaction with the Code is 
 | |
| //  to stop using it and return it.
 | |
| /////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
| #ifndef ASEMEMCARDS_H
 | |
| #define ASEMEMCARDS_H
 | |
| 
 | |
| #define ASEMEM_API __stdcall
 | |
| 
 | |
| /***************************************************/
 | |
| /*                  Card Errors                    */
 | |
| /***************************************************/
 | |
| /*
 | |
|  * No error was encountered. 
 | |
|  */
 | |
| #define ASEMEM_S_SUCCESS                        0x0
 | |
| 
 | |
| /*
 | |
|  * The smart card does not support the current function. 
 | |
|  */ 
 | |
| #define ASEMEM_E_FUNCTION_NOT_SUPPORTED         0x20
 | |
| 
 | |
| /*
 | |
|  * The smart card has been removed, so that further communication is not possible.  
 | |
|  */ 
 | |
| #define ASEMEM_E_REMOVED_CARD                   0x21
 | |
| 
 | |
| /* 
 | |
|  * The smart card is unpowered, so that further communication is not possible. 
 | |
|  */
 | |
| #define ASEMEM_E_UNPOWERED_CARD                 0x22
 | |
| 
 | |
| /*
 | |
|  * Smartcard is not supported. 
 | |
|  */
 | |
| #define ASEMEM_E_UNSUPPORTED_CARD               0x23
 | |
| 
 | |
| /*
 | |
|  * The supplied password is incorrect.
 | |
|  */
 | |
| #define ASEMEM_E_PASSWORD_VERIFICATION_FAILED   0x24
 | |
| 
 | |
| /*
 | |
|  * The card cannot be accessed because the maximum number 
 | |
|  * of password verification attempts has been reached. 
 | |
|  */
 | |
| #define ASEMEM_E_PASSWORD_BLOCKED               0x25
 | |
| 
 | |
| /*
 | |
|  * The supplied handle is invalid. 
 | |
|  */
 | |
| #define ASEMEM_E_INVALID_HANDLE                 0x26
 | |
| 
 | |
| /*
 | |
|  * One or more of the supplied parameters are invalid. 
 | |
|  */
 | |
| #define ASEMEM_E_INVALID_PARAMETER              0x27
 | |
| 
 | |
| /*
 | |
|  * The operation requires a smart card, but no smart card is currently in the device. 
 | |
|  */
 | |
| #define ASEMEM_E_NO_SMARTCARD                   0x28
 | |
| 
 | |
| /*
 | |
|  * The smart card has been reset. 
 | |
|  */
 | |
| #define ASEMEM_E_RESET_CARD                     0x29
 | |
| 
 | |
| /*
 | |
|  * The smart card cannot be accessed because of other outstanding connections. 
 | |
|  */
 | |
| #define ASEMEM_E_SHARING_VIOLATION              0x2A
 | |
| 
 | |
| /*
 | |
|  * The specified reader name is not recognized. 
 | |
|  */
 | |
| #define ASEMEM_E_UNKNOWN_READER                 0x2B
 | |
| 
 | |
| /*
 | |
|  * No smart card reader is available.
 | |
|  */
 | |
| #define ASEMEM_E_NO_READERS_AVAILABLE           0x2C
 | |
| 
 | |
| /* 
 | |
|  * The data buffer is too small for the returned data. 
 | |
|  */
 | |
| #define ASEMEM_E_INSUFFICIENT_BUFFER            0x2D
 | |
| 
 | |
| /*
 | |
|  * The smart card resource manager has shut down. 
 | |
|  */
 | |
| #define ASEMEM_E_SERVICE_STOPPED                0x2E
 | |
| 
 | |
| /*
 | |
|  * The user-specified timeout value has expired. 
 | |
|  */
 | |
| #define ASEMEM_E_TIMEOUT                        0x2F
 | |
| 
 | |
| /*
 | |
|  * Address out of range
 | |
|  */
 | |
| #define ASEMEM_E_NO_MEMORY                      0x30
 | |
| 
 | |
| /*
 | |
|  * An unknown error has occurred.
 | |
|  */
 | |
| #define ASEMEM_E_UNKNOWN_ERROR                  0x31
 | |
| 
 | |
| /***************************************************/
 | |
| /*                  Card Types                     */
 | |
| /***************************************************/
 | |
| #define ASEMEM_CARD_TYPE_UNKNOWN                0x0
 | |
| #define ASEMEM_CARD_TYPE_2BUS                   0x10
 | |
| #define ASEMEM_CARD_TYPE_3BUS                   0x11
 | |
| #define ASEMEM_CARD_TYPE_I2C                    0x12
 | |
| #define ASEMEM_CARD_TYPE_XI2C                   0x13
 | |
| 
 | |
| /***************************************************/
 | |
| /*                  Card State                     */
 | |
| /***************************************************/
 | |
| #define ASEMEM_CARD_IN                          0x1
 | |
| #define ASEMEM_CARD_OUT                         0x2
 | |
| 
 | |
| /***************************************************/
 | |
| /*                  Protected State                */
 | |
| /***************************************************/
 | |
| /* DATA Read */
 | |
| #define ASEMEM_DATA_PROTECTED                   0x0
 | |
| #define ASEMEM_DATA_NOT_PROTECTED               0x1
 | |
| 
 | |
| /* WRITE Mode */
 | |
| #define ASEMEM_WRITE_AND_PROTECT_MODE           0x1
 | |
| #define ASEMEM_WRITE_MODE                       0x0
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 Card Timeout                    */
 | |
| /***************************************************/
 | |
| /* Infinite timeout */
 | |
| #define INFINITE_WAIT_TIME                      0xFFFFFFFF  
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 2BUS and 3BUS password length   */
 | |
| /***************************************************/
 | |
| #define ASEMEM_2BUS_PASSWORD_LENGTH             0x3
 | |
| #define ASEMEM_3BUS_PASSWORD_LENGTH             0x2
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 Connect Modes                   */
 | |
| /***************************************************/
 | |
| /* This application is willing to share the card with other applications.*/ 
 | |
| #define ASEMEM_SHARE_SHARED                     0x0 
 | |
| /* This application is not willing to share the card with other applications.*/
 | |
| #define ASEMEM_SHARE_EXCLUSIVE                  0x1  
 | |
| /* Work in XI2C mode*/
 | |
| #define ASEMEM_XI2C                             0x2
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 Cards Adress                   */
 | |
| /***************************************************/
 | |
| /* All data size of 2BUS card*/ 
 | |
| #define ASEMEM_2BUS_DATA_SIZE                   256 
 | |
| /* Protected data size of 2BUS card*/ 
 | |
| #define ASEMEM_2BUS_PROTECTED_DATA_SIZE         32
 | |
| /* All data size of 3BUS card*/ 
 | |
| #define ASEMEM_3BUS_DATA_SIZE                   1021 
 | |
| /* Protected data size of 3BUS card*/ 
 | |
| #define ASEMEM_3BUS_PROTECTED_DATA_SIZE         1021 
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 Disconnect Modes                */
 | |
| /***************************************************/
 | |
| /* Don't do anything special */
 | |
| #define ASEMEM_LEAVE_CARD                       0x2 
 | |
| /* Reset the card */
 | |
| #define ASEMEM_RESET_CARD                       0x4 
 | |
| /* Power down the card */
 | |
| #define ASEMEM_UNPOWER_CARD                     0x6 
 | |
| 
 | |
| 
 | |
| /***************************************************/
 | |
| /*                 Data Types                      */
 | |
| /***************************************************/
 | |
| /* Card handle */ 
 | |
| typedef void * ASEMEM_HANDLE;
 | |
| 
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /***************************************************/
 | |
| /*                ASECard Memory Functions         */
 | |
| /***************************************************/
 | |
| 
 | |
| /*
 | |
|  * ASEListReaders - returns the list of all connected readers in a multi string and
 | |
|  * its length. If readerList param is NULL the function will return the expected 
 | |
|  * length of readerList.
 | |
|  *
 | |
|  * In  parameters: readerList (If NULL).
 | |
|  * Out parameters: readerList, length.
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEListReaders(char * readersList, unsigned long * length);
 | |
| 
 | |
| /*
 | |
|  * ASEWaitForCardEvent - waits for card status IN or OUT depends on inOut parameter.
 | |
|  * The functionwaits the amount of Ms spcified in timeOut on reader.
 | |
|  *
 | |
|  * In  parameters: reader, inOut, timeOut.
 | |
|  * Out parameters: 
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEWaitForCardEvent(char * reader, unsigned char inOut, unsigned long timeOut);
 | |
| 
 | |
| /*
 | |
|  * ASEMemConnect - connect to the card in reader.  the function returns,
 | |
|  * on success, hCard and cardType. 
 | |
|  * 
 | |
|  * In  parameters: reader, connectMode.
 | |
|  * Out parameters: hCard, cardType.
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemConnect(ASEMEM_HANDLE * hCard, char * reader, unsigned long connectMode, unsigned long * cardType);
 | |
| 
 | |
| /*
 | |
|  * ASEMemDisconnect - disconnect a card by card handle at specific mode:leave card, 
 | |
|  * reset card or unpower card.
 | |
|  *
 | |
|  * In  parameters: hCard, mode.
 | |
|  * Out parameters: 
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemDisconnect(ASEMEM_HANDLE hCard, char mode);
 | |
| 
 | |
| /*
 | |
|  * ASEMemWrite - writeBuffer to a card from address lenWrite long.  
 | |
|  * It can write or write and protect depend
 | |
|  * on protect parameter. 
 | |
|  *
 | |
|  * In  parameters: hCard, address, writeBuffer, lenWrite, protect.
 | |
|  * Out parameters: 
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemWrite(ASEMEM_HANDLE hCard, unsigned long address, unsigned char * writeBuffer, unsigned long lenWrite, char protect);
 | |
| 
 | |
| /*
 | |
|  * ASEMemRead - reads from a card from address lenRead long.
 | |
|  * If protReadBuffer or ReadBuffer are
 | |
|  * NULL this type of reading will not take place.
 | |
|  *
 | |
|  * In  parameters: hCard, address, ReadBuffer, protReadBuffer, lenRead.
 | |
|  * Out parameters: 
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemRead(ASEMEM_HANDLE hCard, unsigned long address, unsigned char * readBuffer, unsigned char * protReadBuffer, unsigned long lenRead);
 | |
| 
 | |
| /*
 | |
|  * ASEMemVerifyPassword - verify card's password supported only by 2BUS and 3BUS cards.
 | |
|  * User should supply password and its length.  Returns number of left attempts. 
 | |
|  *
 | |
|  * In  parameters: hCard, password, length.
 | |
|  * Out parameters: attempts.
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemVerifyPassword(ASEMEM_HANDLE hCard, unsigned char * password, unsigned long length, int * attempts);
 | |
| 
 | |
| /*
 | |
|  * ASEMemChangePassword - verify card's password if it is not verified yet then change 
 | |
|  * password.  Supported only by 2BUS and 3BUS cards.  User should supply oldPassword, 
 | |
|  * newPassword and length.
 | |
|  * If the password is not verified and the oldPassword fails verify the password will
 | |
|  * not be changed.
 | |
|  * If the password was verified change will succeed even if oldPassword is wrong.
 | |
|  * Returns number of left attempts.
 | |
|  *
 | |
|  * In  parameters: hCard, oldPassword, newPassword, length.
 | |
|  * Out parameters: attempts.
 | |
|  */
 | |
| unsigned long ASEMEM_API ASEMemChangePassword(ASEMEM_HANDLE hCard,unsigned char * oldPassword, unsigned char * newPassword, unsigned long length, int * attempts);
 | |
| 
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif 
 |