|
@@ -31,22 +31,16 @@
|
|
#define U2FHID_PACKET_SIZE 64
|
|
#define U2FHID_PACKET_SIZE 64
|
|
#define U2FHID_PENDING_IN_NUM 32
|
|
#define U2FHID_PENDING_IN_NUM 32
|
|
|
|
|
|
-typedef struct U2FKeyState U2FKeyState;
|
|
|
|
typedef struct U2FKeyInfo U2FKeyInfo;
|
|
typedef struct U2FKeyInfo U2FKeyInfo;
|
|
|
|
|
|
#define TYPE_U2F_KEY "u2f-key"
|
|
#define TYPE_U2F_KEY "u2f-key"
|
|
-#define U2F_KEY(obj) \
|
|
|
|
- OBJECT_CHECK(U2FKeyState, (obj), TYPE_U2F_KEY)
|
|
|
|
-#define U2F_KEY_CLASS(klass) \
|
|
|
|
- OBJECT_CLASS_CHECK(U2FKeyClass, (klass), TYPE_U2F_KEY)
|
|
|
|
-#define U2F_KEY_GET_CLASS(obj) \
|
|
|
|
- OBJECT_GET_CLASS(U2FKeyClass, (obj), TYPE_U2F_KEY)
|
|
|
|
|
|
+OBJECT_DECLARE_TYPE(U2FKeyState, U2FKeyClass, U2F_KEY)
|
|
|
|
|
|
/*
|
|
/*
|
|
* Callbacks to be used by the U2F key base device (i.e. hw/u2f.c)
|
|
* Callbacks to be used by the U2F key base device (i.e. hw/u2f.c)
|
|
* to interact with its variants (i.e. hw/u2f-*.c)
|
|
* to interact with its variants (i.e. hw/u2f-*.c)
|
|
*/
|
|
*/
|
|
-typedef struct U2FKeyClass {
|
|
|
|
|
|
+struct U2FKeyClass {
|
|
/*< private >*/
|
|
/*< private >*/
|
|
USBDeviceClass parent_class;
|
|
USBDeviceClass parent_class;
|
|
|
|
|
|
@@ -55,12 +49,12 @@ typedef struct U2FKeyClass {
|
|
const uint8_t packet[U2FHID_PACKET_SIZE]);
|
|
const uint8_t packet[U2FHID_PACKET_SIZE]);
|
|
void (*realize)(U2FKeyState *key, Error **errp);
|
|
void (*realize)(U2FKeyState *key, Error **errp);
|
|
void (*unrealize)(U2FKeyState *key);
|
|
void (*unrealize)(U2FKeyState *key);
|
|
-} U2FKeyClass;
|
|
|
|
|
|
+};
|
|
|
|
|
|
/*
|
|
/*
|
|
* State of the U2F key base device (i.e. hw/u2f.c)
|
|
* State of the U2F key base device (i.e. hw/u2f.c)
|
|
*/
|
|
*/
|
|
-typedef struct U2FKeyState {
|
|
|
|
|
|
+struct U2FKeyState {
|
|
USBDevice dev;
|
|
USBDevice dev;
|
|
USBEndpoint *ep;
|
|
USBEndpoint *ep;
|
|
uint8_t idle;
|
|
uint8_t idle;
|
|
@@ -70,7 +64,7 @@ typedef struct U2FKeyState {
|
|
uint8_t pending_in_start;
|
|
uint8_t pending_in_start;
|
|
uint8_t pending_in_end;
|
|
uint8_t pending_in_end;
|
|
uint8_t pending_in_num;
|
|
uint8_t pending_in_num;
|
|
-} U2FKeyState;
|
|
|
|
|
|
+};
|
|
|
|
|
|
/*
|
|
/*
|
|
* API to be used by the U2F key device variants (i.e. hw/u2f-*.c)
|
|
* API to be used by the U2F key device variants (i.e. hw/u2f-*.c)
|