1 /* $Id: ifdhandler.h,v 1.3 2001/07/02 20:07:08 rees Exp $ */
2 
3 /*
4 copyright 2001
5 the regents of the university of michigan
6 all rights reserved
7 
8 permission is granted to use, copy, create derivative works
9 and redistribute this software and such derivative works
10 for any purpose, so long as the name of the university of
11 michigan is not used in any advertising or publicity
12 pertaining to the use or distribution of this software
13 without specific, written prior authorization.  if the
14 above copyright notice or any other identification of the
15 university of michigan is included in any copy of any
16 portion of this software, then the disclaimer below must
17 also be included.
18 
19 this software is provided as is, without representation
20 from the university of michigan as to its fitness for any
21 purpose, and without warranty by the university of
22 michigan of any kind, either express or implied, including
23 without limitation the implied warranties of
24 merchantability and fitness for a particular purpose. the
25 regents of the university of michigan shall not be liable
26 for any damages, including special, indirect, incidental, or
27 consequential damages, with respect to any claim arising
28 out of or in connection with the use of the software, even
29 if it has been or is hereafter advised of the possibility of
30 such damages.
31 */
32 
33 /*
34  * pcsc cruft
35  */
36 
37 #define MAX_ATR_SIZE 33
38 #define IFD_POWER_UP 500
39 #define IFD_POWER_DOWN 501
40 #define IFD_RESET 502
41 #define IFD_ERROR_NOT_SUPPORTED 606
42 #define IFD_ERROR_POWER_ACTION 608
43 #define IFD_COMMUNICATION_ERROR 612
44 #define IFD_NOT_SUPPORTED 614
45 #define IFD_ICC_PRESENT 615
46 #define IFD_ICC_NOT_PRESENT 616
47 #define TAG_IFD_ATR 0x303
48 
49 /* Extra tags for things they forgot to put in the ifd interface */
50 #define SCTAG_IFD_ATRLEN 0x6601
51 #define SCTAG_IFD_CARDPRESENT 0x301
52 #define SCTAG_OPEN_FLAGS  0x800
53 #define SCTAG_RESET_FLAGS 0x801
54 
55 struct SCARD_IO_HEADER {
56     u_long Protocol, Length;
57 };
58 
59 /* IFD interface */
60 u_long IO_Create_Channel(u_long ChannelId);
61 u_long IO_Close_Channel();
62 u_long IFD_Get_Capabilities(u_long Tag, u_char Value[]);
63 u_long IFD_Set_Capabilities(u_long Tag, u_char Value[]);
64 u_long IFD_Set_Protocol_Parameters(u_long ProtocolType, u_char SelectionFlags, u_char PTS1, u_char PTS2, u_char PTS3);
65 u_long IFD_Power_ICC(u_long a);
66 u_long IFD_Swallow_ICC();
67 u_long IFD_Eject_ICC();
68 u_long IFD_Confiscate_ICC();
69 u_long IFD_Transmit_to_ICC(struct SCARD_IO_HEADER SendPci,
70 		    u_char ibuf[], u_long ilen, u_char obuf[], u_long *olen,
71 		    struct SCARD_IO_HEADER *RecvPci);
72 u_long IFD_Is_ICC_Present();
73