target-ppc: Set instruction flags on CPU family classes
[qemu/agraf.git] / libcacard / vcard_emul_type.c
blob59a14582012cc20e3322fba9c57604311a2849b9
1 /*
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.
9 */
11 #include <strings.h>
12 #include "vcardt.h"
13 #include "vcard_emul_type.h"
14 #include "cac.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)
21 switch (type) {
22 case VCARD_EMUL_NONE:
23 break;
24 case VCARD_EMUL_CAC:
25 return cac_card_init(vreader, vcard, params,
26 cert, cert_len, key, cert_count);
27 /* add new ones here */
28 default:
29 break;
31 return VCARD_FAIL;
34 VCardEmulType vcard_emul_type_select(VReader *vreader)
36 #ifdef notdef
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;
41 #endif
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;
51 #ifdef USE_PASSTHRU
52 if (strcasecmp(type_string, "PASSTHRU") == 0) {
53 return VCARD_EMUL_PASSTHRU;
55 #endif
56 return VCARD_EMUL_NONE;