linux-user: add SO_PEERCRED support for getsockopt
[qemu.git] / libcacard / card_7816.h
1 /*
2 * Implement the 7816 portion of the card spec
3 *
4 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
5 * See the COPYING.LIB file in the top-level directory.
6 */
7 #ifndef CARD_7816_H
8 #define CARD_7816_H 1
9
10 #include "card_7816t.h"
11 #include "vcardt.h"
12
13 /*
14 * constructors for VCardResponse's
15 */
16 /* response from a return buffer and a status */
17 VCardResponse *vcard_response_new(VCard *card, unsigned char *buf, int len,
18 int Le, vcard_7816_status_t status);
19 /* response from a return buffer and status bytes */
20 VCardResponse *vcard_response_new_bytes(VCard *card, unsigned char *buf,
21 int len, int Le,
22 unsigned char sw1, unsigned char sw2);
23 /* response from just status bytes */
24 VCardResponse *vcard_response_new_status_bytes(unsigned char sw1,
25 unsigned char sw2);
26 /* response from just status: NOTE this cannot fail, it will always return a
27 * valid response, if it can't allocate memory, the response will be
28 * VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE */
29 VCardResponse *vcard_make_response(vcard_7816_status_t status);
30
31 /* create a raw response (status has already been encoded */
32 VCardResponse *vcard_response_new_data(unsigned char *buf, int len);
33
34
35
36
37 /*
38 * destructor for VCardResponse.
39 * Can be called with a NULL response
40 */
41 void vcard_response_delete(VCardResponse *response);
42
43 /*
44 * constructor for VCardAPDU
45 */
46 VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len,
47 unsigned short *status);
48
49 /*
50 * destructor for VCardAPDU
51 * Can be called with a NULL apdu
52 */
53 void vcard_apdu_delete(VCardAPDU *apdu);
54
55 /*
56 * APDU processing starts here. This routes the card processing stuff to the
57 * right location. Always returns a valid response.
58 */
59 VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu,
60 VCardResponse **response);
61
62 #endif