mirror of
https://github.com/qemu/qemu.git
synced 2024-12-15 23:43:31 +08:00
39bffca203
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/*
|
|
* 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 "qdev.h"
|
|
|
|
typedef struct CCIDCardState CCIDCardState;
|
|
typedef struct CCIDCardInfo CCIDCardInfo;
|
|
|
|
#define TYPE_CCID_CARD "ccid-card"
|
|
#define CCID_CARD(obj) \
|
|
OBJECT_CHECK(CCIDCardState, (obj), TYPE_CCID_CARD)
|
|
#define CCID_CARD_CLASS(klass) \
|
|
OBJECT_CLASS_CHECK(CCIDCardClass, (klass), TYPE_CCID_CARD)
|
|
#define CCID_CARD_GET_CLASS(obj) \
|
|
OBJECT_GET_CLASS(CCIDCardClass, (obj), TYPE_CCID_CARD)
|
|
|
|
/*
|
|
* callbacks to be used by the CCID device (hw/usb-ccid.c) to call
|
|
* into the smartcard device (hw/ccid-card-*.c)
|
|
*/
|
|
typedef struct CCIDCardClass {
|
|
DeviceClass parent_class;
|
|
const uint8_t *(*get_atr)(CCIDCardState *card, uint32_t *len);
|
|
void (*apdu_from_guest)(CCIDCardState *card,
|
|
const uint8_t *apdu,
|
|
uint32_t len);
|
|
int (*exitfn)(CCIDCardState *card);
|
|
int (*initfn)(CCIDCardState *card);
|
|
} CCIDCardClass;
|
|
|
|
/*
|
|
* 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 */
|