target-sparc: Revert setting cpu_dst to gen_dest_gpr
[qemu/pbrook.git] / libcacard / vcard.h
blob47dc70382b901094c8590a221bc846275054f0fe
1 /*
2 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
3 * See the COPYING.LIB file in the top-level directory.
4 */
5 #ifndef VCARD_H
6 #define VCARD_H 1
8 #include "vcardt.h"
11 * response buffer constructors and destructors.
13 * response buffers are used when we need to return more data than will fit in
14 * a normal APDU response (nominally 254 bytes).
16 VCardBufferResponse *vcard_buffer_response_new(unsigned char *buffer, int size);
17 void vcard_buffer_response_delete(VCardBufferResponse *buffer_response);
21 * clean up state on reset
23 void vcard_reset(VCard *card, VCardPower power);
26 * applet utilities
29 * Constructor for a VCardApplet
31 VCardApplet *vcard_new_applet(VCardProcessAPDU applet_process_function,
32 VCardResetApplet applet_reset_function,
33 unsigned char *aid, int aid_len);
36 * destructor for a VCardApplet
37 * Can be called with a NULL applet
39 void vcard_delete_applet(VCardApplet *applet);
41 /* accessor - set the card type specific private data */
42 void vcard_set_applet_private(VCardApplet *applet, VCardAppletPrivate *_private,
43 VCardAppletPrivateFree private_free);
45 /* set type of vcard */
46 void vcard_set_type(VCard *card, VCardType type);
49 * utilities interacting with the current applet
51 /* add a new applet to a card */
52 VCardStatus vcard_add_applet(VCard *card, VCardApplet *applet);
53 /* find the applet on the card with the given aid */
54 VCardApplet *vcard_find_applet(VCard *card, unsigned char *aid, int aid_len);
55 /* set the following applet to be current on the given channel */
56 void vcard_select_applet(VCard *card, int channel, VCardApplet *applet);
57 /* get the card type specific private data on the given channel */
58 VCardAppletPrivate *vcard_get_current_applet_private(VCard *card, int channel);
59 /* fetch the applet's id */
60 unsigned char *vcard_applet_get_aid(VCardApplet *applet, int *aid_len);
62 /* process the apdu for the current selected applet/file */
63 VCardStatus vcard_process_applet_apdu(VCard *card, VCardAPDU *apdu,
64 VCardResponse **response);
66 * VCard utilities
68 /* constructor */
69 VCard *vcard_new(VCardEmul *_private, VCardEmulFree private_free);
70 /* get a reference */
71 VCard *vcard_reference(VCard *);
72 /* destructor (reference counted) */
73 void vcard_free(VCard *);
74 /* get the atr from the card */
75 void vcard_get_atr(VCard *card, unsigned char *atr, int *atr_len);
76 void vcard_set_atr_func(VCard *card, VCardGetAtr vcard_get_atr);
78 /* accessor functions for the response buffer */
79 VCardBufferResponse *vcard_get_buffer_response(VCard *card);
80 void vcard_set_buffer_response(VCard *card, VCardBufferResponse *buffer);
81 /* accessor functions for the type */
82 VCardType vcard_get_type(VCard *card);
83 /* get the private data */
84 VCardEmul *vcard_get_private(VCard *card);
86 #endif