Initial commit
[platform/upstream/ccid.git] / src / commands.h
1 /*
2     commands.h: Commands sent to the card
3     Copyright (C) 2003-2009   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 License
16         along with this library; if not, write to the Free Software Foundation,
17         Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #define SIZE_GET_SLOT_STATUS 10
21 #define STATUS_OFFSET 7
22 #define ERROR_OFFSET 8
23 #define CHAIN_PARAMETER_OFFSET 9
24
25 RESPONSECODE CmdPowerOn(unsigned int reader_index, unsigned int * nlength,
26         /*@out@*/ unsigned char buffer[], int voltage);
27
28 RESPONSECODE SecurePINVerify(unsigned int reader_index,
29         unsigned char TxBuffer[], unsigned int TxLength,
30         unsigned char RxBuffer[], unsigned int *RxLength);
31
32 RESPONSECODE SecurePINModify(unsigned int reader_index,
33         unsigned char TxBuffer[], unsigned int TxLength,
34         unsigned char RxBuffer[], unsigned int *RxLength);
35
36 RESPONSECODE CmdEscape(unsigned int reader_index,
37         const unsigned char TxBuffer[], unsigned int TxLength,
38         unsigned char RxBuffer[], unsigned int *RxLength, unsigned int timeout);
39
40 RESPONSECODE CmdEscapeCheck(unsigned int reader_index,
41         const unsigned char TxBuffer[], unsigned int TxLength,
42         unsigned char RxBuffer[], unsigned int *RxLength, unsigned int timeout,
43         int mayfail);
44
45 RESPONSECODE CmdPowerOff(unsigned int reader_index);
46
47 RESPONSECODE CmdGetSlotStatus(unsigned int reader_index,
48         /*@out@*/ unsigned char buffer[]);
49
50 RESPONSECODE CmdXfrBlock(unsigned int reader_index, unsigned int tx_length,
51         unsigned char tx_buffer[], unsigned int *rx_length,
52         unsigned char rx_buffer[], int protoccol);
53
54 RESPONSECODE CCID_Transmit(unsigned int reader_index, unsigned int tx_length,
55         const unsigned char tx_buffer[], unsigned short rx_length, unsigned char bBWI);
56
57 RESPONSECODE CCID_Receive(unsigned int reader_index,
58         /*@out@*/ unsigned int *rx_length,
59         /*@out@*/ unsigned char rx_buffer[], unsigned char *chain_parameter);
60
61 RESPONSECODE SetParameters(unsigned int reader_index, char protocol,
62         unsigned int length, unsigned char buffer[]);
63
64 int isCharLevel(int reader_index);
65