]> git.ipfire.org Git - thirdparty/qemu.git/blame - hw/usb/ccid.h
Move QOM typedefs and add missing includes
[thirdparty/qemu.git] / hw / usb / ccid.h
CommitLineData
36707144
AL
1/*
2 * CCID Passthru Card Device emulation
3 *
4 * Copyright (c) 2011 Red Hat.
5 * Written by Alon Levy.
6 *
8e31bf38 7 * This code is licensed under the GNU LGPL, version 2 or later.
36707144
AL
8 */
9
10#ifndef CCID_H
11#define CCID_H
12
a27bd6c7 13#include "hw/qdev-core.h"
db1015e9 14#include "qom/object.h"
36707144
AL
15
16typedef struct CCIDCardState CCIDCardState;
17typedef struct CCIDCardInfo CCIDCardInfo;
18
ba7c0520 19#define TYPE_CCID_CARD "ccid-card"
db1015e9 20typedef struct CCIDCardClass CCIDCardClass;
ba7c0520
AL
21#define CCID_CARD(obj) \
22 OBJECT_CHECK(CCIDCardState, (obj), TYPE_CCID_CARD)
23#define CCID_CARD_CLASS(klass) \
24 OBJECT_CLASS_CHECK(CCIDCardClass, (klass), TYPE_CCID_CARD)
25#define CCID_CARD_GET_CLASS(obj) \
26 OBJECT_GET_CLASS(CCIDCardClass, (obj), TYPE_CCID_CARD)
36707144
AL
27
28/*
29 * callbacks to be used by the CCID device (hw/usb-ccid.c) to call
30 * into the smartcard device (hw/ccid-card-*.c)
31 */
db1015e9 32struct CCIDCardClass {
80ae8654 33 /*< private >*/
ba7c0520 34 DeviceClass parent_class;
80ae8654 35 /*< public >*/
36707144
AL
36 const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
37 void (*apdu_from_guest)(CCIDCardState *card,
38 const uint8_t *apdu,
39 uint32_t len);
cc847bfd 40 void (*realize)(CCIDCardState *card, Error **errp);
b69c3c21 41 void (*unrealize)(CCIDCardState *card);
db1015e9 42};
ba7c0520
AL
43
44/*
45 * state of the CCID Card device (i.e. hw/ccid-card-*.c)
46 */
47struct CCIDCardState {
48 DeviceState qdev;
49 uint32_t slot; /* For future use with multiple slot reader. */
36707144
AL
50};
51
52/*
53 * API for smartcard calling the CCID device (used by hw/ccid-card-*.c)
54 */
55void ccid_card_send_apdu_to_guest(CCIDCardState *card,
56 uint8_t *apdu,
57 uint32_t len);
58void ccid_card_card_removed(CCIDCardState *card);
59void ccid_card_card_inserted(CCIDCardState *card);
60void ccid_card_card_error(CCIDCardState *card, uint64_t error);
36707144
AL
61
62/*
63 * support guest visible insertion/removal of ccid devices based on actual
64 * devices connected/removed. Called by card implementation (passthru, local)
65 */
66int ccid_card_ccid_attach(CCIDCardState *card);
67void ccid_card_ccid_detach(CCIDCardState *card);
68
69#endif /* CCID_H */