1 | /*
|
---|
2 | protocol_t1.h
|
---|
3 | ISO 7816 T=1 Transport Protocol 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 _PROTOCOL_T1_
|
---|
26 | #define _PROTOCOL_T1_
|
---|
27 |
|
---|
28 | #include "defines.h"
|
---|
29 | #include "icc_async.h"
|
---|
30 | #include "apdu.h"
|
---|
31 | #include "pps.h"
|
---|
32 |
|
---|
33 | /*
|
---|
34 | * Exported constants definition
|
---|
35 | */
|
---|
36 |
|
---|
37 | /* Return codes */
|
---|
38 | #define PROTOCOL_T1_OK 0 /* Command OK */
|
---|
39 | #define PROTOCOL_T1_ICC_ERROR 2 /* ICC comunication error */
|
---|
40 | #define PROTOCOL_T1_ERROR 4 /* T=1 Protocol Error */
|
---|
41 | #define PROTOCOL_T1_NOT_IMPLEMENTED 7 /* Feture not implemented */
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Exported datatypes definition
|
---|
45 | */
|
---|
46 |
|
---|
47 | /* T=1 Protocol context */
|
---|
48 | typedef struct
|
---|
49 | {
|
---|
50 | ICC_Async *icc; /* Asynchronous integrated cirtuit card */
|
---|
51 | unsigned short ifsc; /* Information field size for the ICC */
|
---|
52 | unsigned short ifsd; /* Information field size for the IFD */
|
---|
53 | unsigned short bgt; /* Block guard time */
|
---|
54 | unsigned short bwt; /* Block waiting time */
|
---|
55 | unsigned short cwt; /* Character waiting time */
|
---|
56 | int edc; /* Type of error detection code */
|
---|
57 | BYTE ns; /* Send sequence number */
|
---|
58 | }
|
---|
59 | Protocol_T1;
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * Exported functions declaration
|
---|
63 | */
|
---|
64 |
|
---|
65 | /* Create a new protocol handler */
|
---|
66 | extern Protocol_T1 *
|
---|
67 | Protocol_T1_New (void);
|
---|
68 |
|
---|
69 | /* Delete a protocol handler */
|
---|
70 | extern void
|
---|
71 | Protocol_T1_Delete (Protocol_T1 * t1);
|
---|
72 |
|
---|
73 | /* Initialise a protocol handler */
|
---|
74 | extern int
|
---|
75 | Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc, PPS_ProtocolParameters * params);
|
---|
76 |
|
---|
77 | /* Send a command and return a response */
|
---|
78 | extern int
|
---|
79 | Protocol_T1_Command (Protocol_T1 * t1, APDU_Cmd * cmd, APDU_Rsp ** rsp);
|
---|
80 |
|
---|
81 | /* Close a protocol handler */
|
---|
82 | extern int
|
---|
83 | Protocol_T1_Close (Protocol_T1 * t1);
|
---|
84 |
|
---|
85 | #endif /* _PROTOCOL_T1_ */
|
---|