1 | /*
|
---|
2 | cardterminal.h
|
---|
3 | Card Terminal 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 _CARDTERMINAL_
|
---|
26 | #define _CARDTERMINAL_
|
---|
27 |
|
---|
28 | #include "defines.h"
|
---|
29 | #include "ct_slot.h"
|
---|
30 | #include "io_serial.h"
|
---|
31 | #include "apdu.h"
|
---|
32 | #include "ctapi.h"
|
---|
33 | #include "ctbcs.h"
|
---|
34 | #ifdef HAVE_PTHREAD_H
|
---|
35 | #include "pthread.h"
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * Exported constats definition
|
---|
40 | */
|
---|
41 |
|
---|
42 | /* Maximum number of slots in a cardterminal */
|
---|
43 | #define CARDTERMINAL_MAX_SLOTS 2
|
---|
44 |
|
---|
45 | /*
|
---|
46 | * Exported datatypes definition
|
---|
47 | */
|
---|
48 |
|
---|
49 | typedef struct
|
---|
50 | {
|
---|
51 | IO_Serial * io; /* Serial device */
|
---|
52 | CT_Slot * slots[CARDTERMINAL_MAX_SLOTS]; /* Array of CT_Slot's */
|
---|
53 | int num_slots; /* Number of CT_Slot's */
|
---|
54 | #ifdef HAVE_PTHREAD_H
|
---|
55 | pthread_mutex_t mutex;
|
---|
56 | #endif
|
---|
57 | }
|
---|
58 | CardTerminal;
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * Exported functions declaration
|
---|
62 | */
|
---|
63 |
|
---|
64 | /* Cretate a new CardTerminal */
|
---|
65 | extern CardTerminal *
|
---|
66 | CardTerminal_New ();
|
---|
67 |
|
---|
68 | /* Intialice a CardTerminal in a given port */
|
---|
69 | extern char
|
---|
70 | CardTerminal_Init (CardTerminal * ct, unsigned short pn);
|
---|
71 |
|
---|
72 | /* Send a CT-BCS command to a CardTerminal */
|
---|
73 | extern char
|
---|
74 | CardTerminal_Command (CardTerminal * ct, APDU_Cmd * cmd, APDU_Rsp ** rsp);
|
---|
75 |
|
---|
76 | /* Return the reference to a slot */
|
---|
77 | extern CT_Slot *
|
---|
78 | CardTerminal_GetSlot (CardTerminal * ct, int number);
|
---|
79 |
|
---|
80 | /* Close a CardTerminal */
|
---|
81 | extern char
|
---|
82 | CardTerminal_Close (CardTerminal * cn);
|
---|
83 |
|
---|
84 | /* Delete a CardTerminal */
|
---|
85 | extern void
|
---|
86 | CardTerminal_Delete (CardTerminal * ct);
|
---|
87 |
|
---|
88 | #ifdef HAVE_PTHREAD_H
|
---|
89 | extern pthread_mutex_t *
|
---|
90 | CardTerminal_GetMutex (CardTerminal * ct);
|
---|
91 | #endif
|
---|
92 |
|
---|
93 | #endif
|
---|