7 #ifndef OPENCT_OPENCT_H 8 #define OPENCT_OPENCT_H 14 #include <sys/types.h> 17 #define OPENCT_MAX_READERS 16 18 #define OPENCT_MAX_SLOTS 8 22 unsigned int ct_slots;
23 unsigned int ct_card[OPENCT_MAX_SLOTS];
24 unsigned ct_display : 1,
29 typedef struct ct_handle ct_handle;
31 #define IFD_CARD_PRESENT 0x0001 32 #define IFD_CARD_STATUS_CHANGED 0x0002 45 typedef unsigned int ct_lock_handle;
56 IFD_PIN_ENCODING_ASCII
61 extern int ct_reader_info(
unsigned int,
ct_info_t *);
62 extern ct_handle * ct_reader_connect(
unsigned int);
63 extern void ct_reader_disconnect(ct_handle *);
64 extern int ct_reader_status(ct_handle *,
ct_info_t *);
65 extern int ct_card_status(ct_handle *h,
unsigned int slot,
int *status);
66 extern int ct_card_set_protocol(ct_handle *h,
unsigned int slot,
67 unsigned int protocol);
68 extern int ct_card_reset(ct_handle *h,
unsigned int slot,
69 void *atr,
size_t atr_len);
70 extern int ct_card_request(ct_handle *h,
unsigned int slot,
71 unsigned int timeout,
const char *message,
72 void *atr,
size_t atr_len);
73 extern int ct_card_lock(ct_handle *h,
unsigned int slot,
74 int type, ct_lock_handle *);
75 extern int ct_card_unlock(ct_handle *h,
unsigned int slot,
77 extern int ct_card_transact(ct_handle *h,
unsigned int slot,
78 const void *apdu,
size_t apdu_len,
79 void *recv_buf,
size_t recv_len);
80 extern int ct_card_verify(ct_handle *h,
unsigned int slot,
81 unsigned int timeout,
const char *prompt,
82 unsigned int pin_encoding,
83 unsigned int pin_length,
84 unsigned int pin_offset,
85 const void *send_buf,
size_t send_len,
86 void *recv_buf,
size_t recv_len);
87 extern int ct_card_read_memory(ct_handle *,
unsigned int slot,
88 unsigned short address,
89 void *recv_buf,
size_t recv_len);
90 extern int ct_card_write_memory(ct_handle *,
unsigned int slot,
91 unsigned short address,
92 const void *send_buf,
size_t send_len);
94 extern int ct_status_destroy(
void);
95 extern int ct_status_clear(
unsigned int,
const char *);
96 extern ct_info_t * ct_status_alloc_slot(
int *);