qemu/libcacard/vcardt.h
<<
>>
Prefs
   1/*
   2 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
   3 * See the COPYING.LIB file in the top-level directory.
   4 */
   5#ifndef VCARDT_H
   6#define VCARDT_H 1
   7
   8/*
   9 * these should come from some common spice header file
  10 */
  11#include <assert.h>
  12#ifndef MIN
  13#define MIN(x, y) ((x) > (y) ? (y) : (x))
  14#define MAX(x, y) ((x) > (y) ? (x) : (y))
  15#endif
  16
  17typedef struct VCardStruct VCard;
  18typedef struct VCardAPDUStruct VCardAPDU;
  19typedef struct VCardResponseStruct VCardResponse;
  20typedef struct VCardBufferResponseStruct VCardBufferResponse;
  21typedef struct VCardAppletStruct VCardApplet;
  22typedef struct VCardAppletPrivateStruct VCardAppletPrivate;
  23typedef struct VCardKeyStruct VCardKey;  /* opaque */
  24typedef struct VCardEmulStruct VCardEmul;
  25
  26#define MAX_CHANNEL 4
  27
  28/* create an ATR with appropriate historical bytes */
  29#define VCARD_ATR_PREFIX(size) 0x3b, 0x68+(size), 0x00, 0xff, \
  30                               'V', 'C', 'A', 'R', 'D', '_'
  31
  32
  33typedef enum {
  34    VCARD_DONE,
  35    VCARD_NEXT,
  36    VCARD_FAIL
  37} VCardStatus;
  38
  39typedef enum {
  40    VCARD_FILE_SYSTEM,
  41    VCARD_VM,
  42    VCARD_DIRECT
  43} VCardType;
  44
  45typedef enum {
  46    VCARD_POWER_ON,
  47    VCARD_POWER_OFF
  48} VCardPower;
  49
  50typedef VCardStatus (*VCardProcessAPDU)(VCard *card, VCardAPDU *apdu,
  51                                        VCardResponse **response);
  52typedef VCardStatus (*VCardResetApplet)(VCard *card, int channel);
  53typedef void (*VCardAppletPrivateFree) (VCardAppletPrivate *);
  54typedef void (*VCardEmulFree) (VCardEmul *);
  55typedef void (*VCardGetAtr) (VCard *, unsigned char *atr, int *atr_len);
  56
  57struct VCardBufferResponseStruct {
  58    unsigned char *buffer;
  59    int buffer_len;
  60    unsigned char *current;
  61    int len;
  62};
  63
  64#endif
  65