target-ppc: Fix invalid SPR read/write warnings
[qemu/agraf.git] / libcacard / card_7816.h
blob4a01993d2db976a875ee3433d1574fc7caed6546
1 /*
2 * Implement the 7816 portion of the card spec
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
10 #include "card_7816t.h"
11 #include "vcardt.h"
14 * constructors for VCardResponse's
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);
31 /* create a raw response (status has already been encoded */
32 VCardResponse *vcard_response_new_data(unsigned char *buf, int len);
38 * destructor for VCardResponse.
39 * Can be called with a NULL response
41 void vcard_response_delete(VCardResponse *response);
44 * constructor for VCardAPDU
46 VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len,
47 unsigned short *status);
50 * destructor for VCardAPDU
51 * Can be called with a NULL apdu
53 void vcard_apdu_delete(VCardAPDU *apdu);
56 * APDU processing starts here. This routes the card processing stuff to the
57 * right location. Always returns a valid response.
59 VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu,
60 VCardResponse **response);
62 #endif