Statistics
| Branch: | Revision:

root / libcacard / vcard.h @ c2162a8b

History | View | Annotate | Download (2.8 kB)

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