File: ccid.h

package info (click to toggle)
qemu 1%3A10.0.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 413,648 kB
  • sloc: ansic: 4,733,433; pascal: 114,769; python: 105,506; asm: 68,406; sh: 52,878; makefile: 27,469; perl: 18,778; cpp: 11,435; xml: 3,404; objc: 2,877; yacc: 2,505; php: 1,299; tcl: 1,296; lex: 1,110; sql: 71; awk: 43; sed: 35; javascript: 7
file content (62 lines) | stat: -rw-r--r-- 1,781 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * CCID Passthru Card Device emulation
 *
 * Copyright (c) 2011 Red Hat.
 * Written by Alon Levy.
 *
 * This code is licensed under the GNU LGPL, version 2 or later.
 */

#ifndef CCID_H
#define CCID_H

#include "hw/qdev-core.h"
#include "qom/object.h"

typedef struct CCIDCardInfo CCIDCardInfo;

#define TYPE_CCID_CARD "ccid-card"
OBJECT_DECLARE_TYPE(CCIDCardState, CCIDCardClass, CCID_CARD)

/*
 * callbacks to be used by the CCID device (hw/usb-ccid.c) to call
 * into the smartcard device (hw/ccid-card-*.c)
 */
struct CCIDCardClass {
    /*< private >*/
    DeviceClass parent_class;
    /*< public >*/
    const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
    void (*apdu_from_guest)(CCIDCardState *card,
                            const uint8_t *apdu,
                            uint32_t len);
    void (*realize)(CCIDCardState *card, Error **errp);
    void (*unrealize)(CCIDCardState *card);
};

/*
 * state of the CCID Card device (i.e. hw/ccid-card-*.c)
 */
struct CCIDCardState {
    DeviceState qdev;
    uint32_t    slot; /* For future use with multiple slot reader. */
};

/*
 * API for smartcard calling the CCID device (used by hw/ccid-card-*.c)
 */
void ccid_card_send_apdu_to_guest(CCIDCardState *card,
                                  uint8_t *apdu,
                                  uint32_t len);
void ccid_card_card_removed(CCIDCardState *card);
void ccid_card_card_inserted(CCIDCardState *card);
void ccid_card_card_error(CCIDCardState *card, uint64_t error);

/*
 * support guest visible insertion/removal of ccid devices based on actual
 * devices connected/removed. Called by card implementation (passthru, local)
 */
int ccid_card_ccid_attach(CCIDCardState *card);
void ccid_card_ccid_detach(CCIDCardState *card);

#endif /* CCID_H */