1 | /*
|
---|
2 | ct_slot.h
|
---|
3 | Card Terminal Slot handling definitions
|
---|
4 |
|
---|
5 | This file is part of the Unix driver for Towitoko smartcard readers
|
---|
6 | Copyright (C) 2000 Carlos Prados <cprados@yahoo.com>
|
---|
7 |
|
---|
8 | This version is modified by doz21 to work in a special manner ;)
|
---|
9 |
|
---|
10 | This library is free software; you can redistribute it and/or
|
---|
11 | modify it under the terms of the GNU Lesser General Public
|
---|
12 | License as published by the Free Software Foundation; either
|
---|
13 | version 2 of the License, or (at your option) any later version.
|
---|
14 |
|
---|
15 | This library is distributed in the hope that it will be useful,
|
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | Lesser General Public License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU Lesser General Public
|
---|
21 | License along with this library; if not, write to the Free Software
|
---|
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _CT_SLOT_
|
---|
26 | #define _CT_SLOT_
|
---|
27 |
|
---|
28 | #include "defines.h"
|
---|
29 | #include "../globals.h"
|
---|
30 | #include "apdu.h"
|
---|
31 | #include "ctapi.h"
|
---|
32 | #include "ctbcs.h"
|
---|
33 |
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * Exported constats definition
|
---|
37 | */
|
---|
38 |
|
---|
39 | /* Type of protocol and ICC */
|
---|
40 | #define CT_SLOT_PROTOCOL_T0 0
|
---|
41 | #define CT_SLOT_PROTOCOL_T1 1
|
---|
42 | #define CT_SLOT_PROTOCOL_T14 14
|
---|
43 | #define CT_SLOT_PROTOCOL_SYNC 16
|
---|
44 | #define CT_SLOT_ICC_ASYNC 0
|
---|
45 | #define CT_SLOT_ICC_SYNC 1
|
---|
46 | #define CT_SLOT_NULL -1
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * Exported datatypes definition
|
---|
50 | */
|
---|
51 |
|
---|
52 | typedef struct
|
---|
53 | {
|
---|
54 | void * icc; /* Integrated circuit card */
|
---|
55 | void * protocol; /* Protocol handler */
|
---|
56 | int icc_type; /* Type of ICC */
|
---|
57 | int protocol_type; /* Type of protocol */
|
---|
58 | }
|
---|
59 | CT_Slot;
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Exported functions declaration
|
---|
63 | */
|
---|
64 |
|
---|
65 | /* Cretate a new CT_Slot */
|
---|
66 | extern CT_Slot *
|
---|
67 | CT_Slot_New ();
|
---|
68 |
|
---|
69 | /* Intialice a CT_Slot */
|
---|
70 | extern char
|
---|
71 | CT_Slot_Init (CT_Slot * slot, int sn);
|
---|
72 |
|
---|
73 | /* Check for card inserted */
|
---|
74 | extern char
|
---|
75 | CT_Slot_Check (CT_Slot * slot, unsigned int timeout, bool * card, bool * change);
|
---|
76 |
|
---|
77 | /* Probe ICC type and protocol */
|
---|
78 | extern char
|
---|
79 | CT_Slot_Probe (CT_Slot * slot, BYTE * userdata, unsigned length);
|
---|
80 |
|
---|
81 | /* Release status information */
|
---|
82 | extern char
|
---|
83 | CT_Slot_Release (CT_Slot * slot);
|
---|
84 |
|
---|
85 | /* Send a command to and ICC */
|
---|
86 | extern char
|
---|
87 | CT_Slot_Command (CT_Slot * slot, APDU_Cmd * cmd, APDU_Rsp ** rsp);
|
---|
88 |
|
---|
89 | /* Return ICC type */
|
---|
90 | extern int
|
---|
91 | CT_Slot_GetICCType (CT_Slot * slot);
|
---|
92 |
|
---|
93 | /* Return a reference to the ICC */
|
---|
94 | extern void *
|
---|
95 | CT_Slot_GetICC (CT_Slot * slot);
|
---|
96 |
|
---|
97 | /* Get answer to reset of the card */
|
---|
98 | extern void *
|
---|
99 | CT_Slot_GetAtr (CT_Slot * slot);
|
---|
100 |
|
---|
101 | /* Says if this slot is last */
|
---|
102 | extern bool
|
---|
103 | CT_Slot_IsLast (CT_Slot * slot);
|
---|
104 |
|
---|
105 | /* Return slot type */
|
---|
106 | extern void
|
---|
107 | CT_Slot_GetType (CT_Slot * slot, BYTE * buffer, int len);
|
---|
108 |
|
---|
109 | /* Close a CT_Slot */
|
---|
110 | extern char
|
---|
111 | CT_Slot_Close (CT_Slot * slot);
|
---|
112 |
|
---|
113 | /* Delete a CT_Slot */
|
---|
114 | extern void
|
---|
115 | CT_Slot_Delete (CT_Slot * slot);
|
---|
116 |
|
---|
117 | #endif
|
---|
118 |
|
---|