2 * This file contains utility functions which abstract the different card
3 * types. The goal is that new card types can easily be added by simply
4 * changing this file and vcard_emul_type.h. It is currently not a requirement
5 * to dynamically add new card types.
7 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
8 * See the COPYING.LIB file in the top-level directory.
13 #include "vcard_emul_type.h"
16 VCardStatus vcard_init(VReader *vreader, VCard *vcard,
17 VCardEmulType type, const char *params,
18 unsigned char *const *cert, int cert_len[],
19 VCardKey *key[], int cert_count)
25 return cac_card_init(vreader, vcard, params,
26 cert, cert_len, key, cert_count);
27 /* add new ones here */
34 VCardEmulType vcard_emul_type_select(VReader *vreader)
37 /* since there is only one emulator no need to call this function */
38 if (cac_is_cac_card(vreader) == VCARD_DONE) {
39 return VCARD_EMUL_CAC;
42 /* return the default */
43 return VCARD_EMUL_CAC;
46 VCardEmulType vcard_emul_type_from_string(const char *type_string)
48 if (strcasecmp(type_string, "CAC") == 0) {
49 return VCARD_EMUL_CAC;
52 if (strcasecmp(type_string, "PASSTHRU") == 0) {
53 return VCARD_EMUL_PASSTHRU;
56 return VCARD_EMUL_NONE;