1 | /*
|
---|
2 | t1_block.h
|
---|
3 | T=1 block abstract data type 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 _T1_BLOCK_
|
---|
26 | #define _T1_BLOCK_
|
---|
27 |
|
---|
28 | #include "defines.h"
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * Exported constants definition
|
---|
32 | */
|
---|
33 |
|
---|
34 | /* Buffer sizes */
|
---|
35 | #define T1_BLOCK_MAX_SIZE 259
|
---|
36 | #define T1_BLOCK_INF_MAX_SIZE 254
|
---|
37 |
|
---|
38 | /* Types of block */
|
---|
39 | #define T1_BLOCK_I 0x00
|
---|
40 | #define T1_BLOCK_R_OK 0x80
|
---|
41 | #define T1_BLOCK_R_EDC_ERR 0x81
|
---|
42 | #define T1_BLOCK_R_OTHER_ERR 0x82
|
---|
43 | #define T1_BLOCK_S_RESYNCH_REQ 0xC0
|
---|
44 | #define T1_BLOCK_S_RESYNCH_RES 0xE0
|
---|
45 | #define T1_BLOCK_S_IFS_REQ 0xC1
|
---|
46 | #define T1_BLOCK_S_IFS_RES 0xE1
|
---|
47 | #define T1_BLOCK_S_ABORT_REQ 0xC2
|
---|
48 | #define T1_BLOCK_S_ABORT_RES 0xE2
|
---|
49 | #define T1_BLOCK_S_WTX_REQ 0xC3
|
---|
50 | #define T1_BLOCK_S_WTX_RES 0xE3
|
---|
51 | #define T1_BLOCK_S_VPP_ERR 0xE4
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * Exported data types definition
|
---|
55 | */
|
---|
56 |
|
---|
57 | typedef struct
|
---|
58 | {
|
---|
59 | BYTE * data;
|
---|
60 | unsigned length;
|
---|
61 | }
|
---|
62 | T1_Block;
|
---|
63 |
|
---|
64 | /*
|
---|
65 | * Exported functions declaration
|
---|
66 | */
|
---|
67 |
|
---|
68 | extern T1_Block *
|
---|
69 | T1_Block_New (BYTE * buffer, unsigned length);
|
---|
70 |
|
---|
71 | extern T1_Block *
|
---|
72 | T1_Block_NewIBlock (BYTE len, BYTE * inf, BYTE ns, bool more);
|
---|
73 |
|
---|
74 | extern T1_Block *
|
---|
75 | T1_Block_NewRBlock (BYTE type, BYTE nr);
|
---|
76 |
|
---|
77 | extern T1_Block *
|
---|
78 | T1_Block_NewSBlock (BYTE type, BYTE len, BYTE * inf);
|
---|
79 |
|
---|
80 | extern BYTE
|
---|
81 | T1_Block_GetType (T1_Block * block);
|
---|
82 |
|
---|
83 | extern BYTE
|
---|
84 | T1_Block_GetNS (T1_Block * block);
|
---|
85 |
|
---|
86 | extern bool
|
---|
87 | T1_Block_GetMore (T1_Block * block);
|
---|
88 |
|
---|
89 | extern BYTE
|
---|
90 | T1_Block_GetNR (T1_Block * block);
|
---|
91 |
|
---|
92 | extern BYTE
|
---|
93 | T1_Block_GetLen (T1_Block * block);
|
---|
94 |
|
---|
95 | extern BYTE *
|
---|
96 | T1_Block_GetInf (T1_Block * block);
|
---|
97 |
|
---|
98 | extern BYTE *
|
---|
99 | T1_Block_Raw (T1_Block * block);
|
---|
100 |
|
---|
101 | extern unsigned
|
---|
102 | T1_Block_RawLen (T1_Block * block);
|
---|
103 |
|
---|
104 | extern void
|
---|
105 | T1_Block_Delete (T1_Block * block);
|
---|
106 |
|
---|
107 | #endif /* _T1_BLOCK_ */
|
---|
108 |
|
---|