/[pcsclite]/trunk/Drivers/ccid/src/defs.h
ViewVC logotype

Contents of /trunk/Drivers/ccid/src/defs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1771 - (show annotations) (download)
Tue Nov 29 12:21:00 2005 UTC (7 years, 5 months ago) by rousseau
File MIME type: text/plain
File size: 2615 byte(s)
remove PCSC/ from the pcsc-lite #include header files since the PCSC/
part is already given by `pkg-config --cflags libpcsclite`
1 /*
2 defs.h:
3 Copyright (C) 2003 Ludovic Rousseau
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 /*
21 * $Id$
22 */
23
24 #include <pcsclite.h>
25
26 #include "openct/proto-t1.h"
27
28 typedef struct CCID_DESC
29 {
30 /*
31 * ATR
32 */
33 DWORD nATRLength;
34 UCHAR pcATRBuffer[MAX_ATR_SIZE];
35
36 /*
37 * Card state
38 */
39 UCHAR bPowerFlags;
40
41 /*
42 * T=1 Protocol context
43 */
44 t1_state_t t1;
45 } CcidDesc;
46
47 typedef enum {
48 STATUS_SUCCESS = 0xFA,
49 STATUS_UNSUCCESSFUL = 0xFB,
50 STATUS_COMM_ERROR = 0xFC,
51 STATUS_DEVICE_PROTOCOL_ERROR = 0xFD,
52 STATUS_COMM_NAK = 0xFE
53 } status_t;
54
55 /* Powerflag (used to detect quick insertion removals unnoticed by the
56 * resource manager)Initial value */
57 #define POWERFLAGS_RAZ 0x00
58 /* Flag set when a power up has been requested */
59 #define MASK_POWERFLAGS_PUP 0x01
60 /* Flag set when a power down is requested */
61 #define MASK_POWERFLAGS_PDWN 0x02
62
63 /* Communication buffer size (max=cmd+adpu+Lc+data+Le) */
64 #define CMD_BUF_SIZE (1+4+1+256+1)
65 /* Larger communication buffer size (max=reader status+data+sw) */
66 #define RESP_BUF_SIZE (1+256+2)
67
68 /* Protocols */
69 #define T_0 0
70 #define T_1 1
71
72 /* Size of an ISO command (CLA+INS+P1+P2) */
73 #define ISO_CMD_SIZE 4
74 /* Offset of the length byte in an TPDU */
75 #define ISO_OFFSET_LENGTH 4
76 /* Offset of the data in a TPDU */
77 #define ISO_OFFSET_TPDU_DATA 5
78 /* ISO length size (1 in general) */
79 #define ISO_LENGTH_SIZE 1
80
81 /* Default communication read timeout in seconds */
82 #define DEFAULT_COM_READ_TIMEOUT 2
83
84 /*
85 * communication ports abstraction
86 */
87 #ifdef TWIN_SERIAL
88
89 #define OpenPortByName OpenSerialByName
90 #define OpenPort OpenSerial
91 #define ClosePort CloseSerial
92 #define ReadPort ReadSerial
93 #define WritePort WriteSerial
94 #include "ccid_serial.h"
95
96 #else
97
98 #define OpenPortByName OpenUSBByName
99 #define OpenPort OpenUSB
100 #define ClosePort CloseUSB
101 #define ReadPort ReadUSB
102 #define WritePort WriteUSB
103 #include "ccid_usb.h"
104
105 #endif
106

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5