| 1 |
/*****************************************************************
|
| 2 |
/
|
| 3 |
/ File : ifdhandler.h
|
| 4 |
/ Author : David Corcoran <corcoran@linuxnet.com>
|
| 5 |
/ Date : June 15, 2000
|
| 6 |
/ Purpose: This provides reader specific low-level calls.
|
| 7 |
/ See http://www.linuxnet.com for more information.
|
| 8 |
/ License: See file LICENSE.BSD
|
| 9 |
/
|
| 10 |
/ $Id$
|
| 11 |
/
|
| 12 |
******************************************************************/
|
| 13 |
|
| 14 |
#ifndef _ifd_handler_h_
|
| 15 |
#define _ifd_handler_h_
|
| 16 |
|
| 17 |
#ifdef __cplusplus
|
| 18 |
extern "C" {
|
| 19 |
#endif
|
| 20 |
|
| 21 |
/* List of data structures available to ifdhandler */
|
| 22 |
|
| 23 |
typedef struct _DEVICE_CAPABILITIES {
|
| 24 |
|
| 25 |
LPSTR Vendor_Name; /* Tag 0x0100 */
|
| 26 |
LPSTR IFD_Type; /* Tag 0x0101 */
|
| 27 |
DWORD IFD_Version; /* Tag 0x0102 */
|
| 28 |
LPSTR IFD_Serial; /* Tag 0x0103 */
|
| 29 |
DWORD IFD_Channel_ID; /* Tag 0x0110 */
|
| 30 |
|
| 31 |
DWORD Asynch_Supported; /* Tag 0x0120 */
|
| 32 |
DWORD Default_Clock; /* Tag 0x0121 */
|
| 33 |
DWORD Max_Clock; /* Tag 0x0122 */
|
| 34 |
DWORD Default_Data_Rate; /* Tag 0x0123 */
|
| 35 |
DWORD Max_Data_Rate; /* Tag 0x0124 */
|
| 36 |
DWORD Max_IFSD; /* Tag 0x0125 */
|
| 37 |
DWORD Synch_Supported; /* Tag 0x0126 */
|
| 38 |
DWORD Power_Mgmt; /* Tag 0x0131 */
|
| 39 |
DWORD Card_Auth_Devices; /* Tag 0x0140 */
|
| 40 |
DWORD User_Auth_Device; /* Tag 0x0142 */
|
| 41 |
DWORD Mechanics_Supported; /* Tag 0x0150 */
|
| 42 |
DWORD Vendor_Features; /* Tag 0x0180 - 0x01F0 User Defined. */
|
| 43 |
|
| 44 |
} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
|
| 45 |
|
| 46 |
typedef struct _ICC_STATE {
|
| 47 |
|
| 48 |
UCHAR ICC_Presence; /* Tag 0x0300 */
|
| 49 |
UCHAR ICC_Interface_Status; /* Tag 0x0301 */
|
| 50 |
UCHAR ATR[MAX_ATR_SIZE]; /* Tag 0x0303 */
|
| 51 |
UCHAR ICC_Type; /* Tag 0x0304 */
|
| 52 |
|
| 53 |
} ICC_STATE, *PICC_STATE;
|
| 54 |
|
| 55 |
typedef struct _PROTOCOL_OPTIONS {
|
| 56 |
|
| 57 |
DWORD Protocol_Type; /* Tag 0x0201 */
|
| 58 |
DWORD Current_Clock; /* Tag 0x0202 */
|
| 59 |
DWORD Current_F; /* Tag 0x0203 */
|
| 60 |
DWORD Current_D; /* Tag 0x0204 */
|
| 61 |
DWORD Current_N; /* Tag 0x0205 */
|
| 62 |
DWORD Current_W; /* Tag 0x0206 */
|
| 63 |
DWORD Current_IFSC; /* Tag 0x0207 */
|
| 64 |
DWORD Current_IFSD; /* Tag 0x0208 */
|
| 65 |
DWORD Current_BWT; /* Tag 0x0209 */
|
| 66 |
DWORD Current_CWT; /* Tag 0x020A */
|
| 67 |
DWORD Current_EBC; /* Tag 0x020B */
|
| 68 |
} PROTOCOL_OPTIONS, *PPROTOCOL_OPTIONS;
|
| 69 |
|
| 70 |
typedef struct _SCARD_IO_HEADER {
|
| 71 |
DWORD Protocol;
|
| 72 |
DWORD Length;
|
| 73 |
} SCARD_IO_HEADER, *PSCARD_IO_HEADER;
|
| 74 |
|
| 75 |
/* End of structure list */
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
/* The list of tags should be alot more but
|
| 80 |
this is all I use in the meantime */
|
| 81 |
|
| 82 |
#define TAG_IFD_ATR 0x0303
|
| 83 |
#define TAG_IFD_SLOTNUM 0x0180
|
| 84 |
#define TAG_IFD_THREAD_SAFE 0x0FAD
|
| 85 |
#define TAG_IFD_SLOTS_NUMBER 0x0FAE
|
| 86 |
#define TAG_IFD_SIMULTANEOUS_ACCESS 0x0FAF
|
| 87 |
|
| 88 |
/* End of tag list */
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
/* List of defines available to ifdhandler */
|
| 93 |
|
| 94 |
#define IFD_POWER_UP 500
|
| 95 |
#define IFD_POWER_DOWN 501
|
| 96 |
#define IFD_RESET 502
|
| 97 |
|
| 98 |
#define IFD_NEGOTIATE_PTS1 1
|
| 99 |
#define IFD_NEGOTIATE_PTS2 2
|
| 100 |
#define IFD_NEGOTIATE_PTS3 4
|
| 101 |
|
| 102 |
#define IFD_SUCCESS 0
|
| 103 |
#define IFD_ERROR_TAG 600
|
| 104 |
#define IFD_ERROR_SET_FAILURE 601
|
| 105 |
#define IFD_ERROR_VALUE_READ_ONLY 602
|
| 106 |
#define IFD_ERROR_PTS_FAILURE 605
|
| 107 |
#define IFD_ERROR_NOT_SUPPORTED 606
|
| 108 |
#define IFD_PROTOCOL_NOT_SUPPORTED 607
|
| 109 |
#define IFD_ERROR_POWER_ACTION 608
|
| 110 |
#define IFD_ERROR_SWALLOW 609
|
| 111 |
#define IFD_ERROR_EJECT 610
|
| 112 |
#define IFD_ERROR_CONFISCATE 611
|
| 113 |
#define IFD_COMMUNICATION_ERROR 612
|
| 114 |
#define IFD_RESPONSE_TIMEOUT 613
|
| 115 |
#define IFD_NOT_SUPPORTED 614
|
| 116 |
#define IFD_ICC_PRESENT 615
|
| 117 |
#define IFD_ICC_NOT_PRESENT 616
|
| 118 |
|
| 119 |
/* List of Defined Functions Available to IFD_Handler */
|
| 120 |
|
| 121 |
RESPONSECODE IFDHCreateChannel ( DWORD, DWORD );
|
| 122 |
RESPONSECODE IFDHCloseChannel ( DWORD );
|
| 123 |
RESPONSECODE IFDHGetCapabilities ( DWORD, DWORD, PDWORD,
|
| 124 |
PUCHAR );
|
| 125 |
RESPONSECODE IFDHSetCapabilities ( DWORD, DWORD, DWORD, PUCHAR );
|
| 126 |
RESPONSECODE IFDHSetProtocolParameters ( DWORD, DWORD, UCHAR,
|
| 127 |
UCHAR, UCHAR, UCHAR );
|
| 128 |
RESPONSECODE IFDHPowerICC ( DWORD, DWORD, PUCHAR, PDWORD );
|
| 129 |
RESPONSECODE IFDHTransmitToICC ( DWORD, SCARD_IO_HEADER, PUCHAR,
|
| 130 |
DWORD, PUCHAR, PDWORD,
|
| 131 |
PSCARD_IO_HEADER );
|
| 132 |
RESPONSECODE IFDHControl ( DWORD, PUCHAR, DWORD,
|
| 133 |
PUCHAR, PDWORD );
|
| 134 |
RESPONSECODE IFDHICCPresence( DWORD );
|
| 135 |
|
| 136 |
CcidDesc *get_ccid_slot(int lun);
|
| 137 |
|
| 138 |
#ifdef __cplusplus
|
| 139 |
}
|
| 140 |
#endif
|
| 141 |
|
| 142 |
#endif /* _ifd_hander_h_ */
|
| 143 |
|