home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / usbd0906.zip / usb_20020906.zip / usbcalls / samples / Cardreader / ifdhandler.h < prev    next >
C/C++ Source or Header  |  2001-11-13  |  4KB  |  136 lines

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