| 1 |
rousseau |
413 |
/*
|
| 2 |
|
|
ccid.h: CCID structures
|
| 3 |
|
|
Copyright (C) 2003 Ludovic Rousseau
|
| 4 |
|
|
|
| 5 |
|
|
This program is free software; you can redistribute it and/or modify
|
| 6 |
|
|
it under the terms of the GNU General Public License as published by
|
| 7 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
| 8 |
|
|
(at your option) any later version.
|
| 9 |
|
|
|
| 10 |
|
|
This program 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
|
| 13 |
|
|
GNU General Public License for more details.
|
| 14 |
|
|
|
| 15 |
|
|
You should have received a copy of the GNU General Public License
|
| 16 |
|
|
along with this program; 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 |
|
|
typedef struct
|
| 25 |
|
|
{
|
| 26 |
|
|
/*
|
| 27 |
|
|
* CCID Sequence number
|
| 28 |
|
|
*/
|
| 29 |
|
|
unsigned char bSeq;
|
| 30 |
|
|
|
| 31 |
|
|
/*
|
| 32 |
|
|
* VendorID << 16 + ProductID
|
| 33 |
|
|
*/
|
| 34 |
|
|
int readerID;
|
| 35 |
|
|
|
| 36 |
|
|
/*
|
| 37 |
|
|
* Maximum message length
|
| 38 |
|
|
*/
|
| 39 |
|
|
int dwMaxCCIDMessageLength;
|
| 40 |
|
|
|
| 41 |
|
|
/*
|
| 42 |
rousseau |
672 |
* Maximum IFSD
|
| 43 |
|
|
*/
|
| 44 |
|
|
int dwMaxIFSD;
|
| 45 |
|
|
|
| 46 |
|
|
/*
|
| 47 |
rousseau |
413 |
* Features supported by the reader (directly from class Descriptor)
|
| 48 |
|
|
*/
|
| 49 |
|
|
int dwFeatures;
|
| 50 |
|
|
|
| 51 |
|
|
} _ccid_descriptor;
|
| 52 |
|
|
|
| 53 |
rousseau |
685 |
#define CCID_CLASS_AUTO_CONF_ATR 0x00000002
|
| 54 |
rousseau |
413 |
#define CCID_CLASS_AUTO_VOLTAGE 0x00000008
|
| 55 |
rousseau |
691 |
#define CCID_CLASS_AUTO_BAUD 0x00000020
|
| 56 |
rousseau |
672 |
#define CCID_CLASS_AUTO_PPS_CUR 0x00000080
|
| 57 |
rousseau |
691 |
#define CCID_CLASS_AUTO_IFSD 0x00000400
|
| 58 |
rousseau |
413 |
#define CCID_CLASS_TPDU 0x00010000
|
| 59 |
|
|
#define CCID_CLASS_SHORT_APDU 0x00020000
|
| 60 |
|
|
#define CCID_CLASS_EXTENDED_APDU 0x00040000
|
| 61 |
rousseau |
672 |
#define CCID_CLASS_EXCHANGE_MASK 0x00070000
|
| 62 |
rousseau |
413 |
|
| 63 |
|
|
/* See CCID specs ch. 4.2.1 */
|
| 64 |
|
|
#define CCID_COMMAND_FAILED 0x40 /* 01 0000 00 */
|
| 65 |
|
|
#define CCID_TIME_EXTENSION 0x80 /* 10 0000 00 */
|
| 66 |
|
|
|
| 67 |
|
|
/* Product identification for special treatments */
|
| 68 |
|
|
#define GEMPC433 0x08E64433
|
| 69 |
|
|
#define GEMPCKEY 0x08E63438
|
| 70 |
|
|
#define GEMPCTWIN 0x08E63437
|
| 71 |
|
|
#define CARDMAN3121 0x076B3021
|
| 72 |
|
|
|
| 73 |
|
|
/* Escape sequence codes */
|
| 74 |
|
|
#define ESC_GEMPC_SET_ISO_MODE 1
|
| 75 |
|
|
#define ESC_GEMPC_SET_APDU_MODE 2
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
int ccid_open_hack(int lun);
|
| 79 |
|
|
void ccid_error(int error, char *file, int line);
|
| 80 |
|
|
_ccid_descriptor *get_ccid_descriptor(int lun);
|
| 81 |
|
|
|
| 82 |
|
|
/* convert a 4 byte integer in USB format into an int */
|
| 83 |
|
|
#define dw2i(a, x) ((((((a[x+3] << 8) + a[x+2]) << 8) + a[x+1]) << 8) + a[x])
|
| 84 |
|
|
|