OpenCT  0.6.20
driver.h
Go to the documentation of this file.
1 
8 #ifndef OPENCT_DRIVER_H
9 #define OPENCT_DRIVER_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include <openct/device.h>
16 
21  int default_protocol;
22 
34  int (*open)(ifd_reader_t *reader, const char *name);
49  int (*close)(ifd_reader_t * reader);
76  int (*change_parity)(ifd_reader_t *reader, int parity);
87  int (*change_speed)(ifd_reader_t *reader, unsigned int speed);
102  int (*activate)(ifd_reader_t *reader);
113  int (*deactivate)(ifd_reader_t *reader);
138  int (*card_status)(ifd_reader_t *reader, int slot, int *status);
154  int (*card_reset)(ifd_reader_t *reader, int slot, void *atr, size_t atr_len);
169  int (*card_request)(ifd_reader_t *reader, int slot,
170  time_t timeout, const char *message,
171  void *atr, size_t atr_len);
185  int (*card_eject)(ifd_reader_t *reader, int slot,
186  time_t timeout, const char *message);
193  int (*output)(ifd_reader_t *reader, const char *message);
209  int (*perform_verify)(ifd_reader_t *reader,
210  int slot, unsigned int timeout, const char *prompt,
211  const unsigned char *data, size_t data_len,
212  unsigned char *resp, size_t resp_len);
230  int (*send)(ifd_reader_t *reader,
231  unsigned int dad,
232  const unsigned char *buffer,
233  size_t len);
247  int (*recv)(ifd_reader_t *reader,
248  unsigned int dad,
249  unsigned char *buffer,
250  size_t len,
251  long timeout);
274  int (*set_protocol)(ifd_reader_t *reader, int slot, int protocol);
290  int (*transparent)(ifd_reader_t *reader, int slot,
291  const void *sbuf, size_t slen,
292  void *rbuf, size_t rlen);
304  int (*sync_read)(ifd_reader_t *reader, int slot, int proto,
305  unsigned short addr,
306  unsigned char *rbuf, size_t rlen);
318  int (*sync_write)(ifd_reader_t *reader, int slot, int proto,
319  unsigned short addr,
320  const unsigned char *sbuf, size_t slen);
321 
322  /*Support for transparent access to "escape" */
323  int (*escape)(ifd_reader_t *reader, int slot,
324  const void *sbuf, const size_t slen,
325  void *rbuf, size_t rlen);
326 
335 
344 
353  int (*get_eventfd) (ifd_reader_t *, short *events);
354 
363  int (*event) (ifd_reader_t *, int *status, size_t status_size);
364 
374  int (*error) (ifd_reader_t *);
375 };
376 
377 extern void ifd_driver_register(const char *,
378  struct ifd_driver_ops *);
379 extern const ifd_driver_t *ifd_driver_get(const char *);
380 extern int ifd_driver_add_id(const char *, const char *);
381 extern const char * ifd_driver_for_id(ifd_devid_t *);
382 
383 /*
384  * Protocol handling for card terminal drivers
385  */
386 extern ifd_protocol_t * ifd_protocol_select(ifd_reader_t *, int, int);
387 extern int ifd_protocol_transceive(ifd_protocol_t *proto,
388  int dad,
389  const void *, size_t,
390  void *, size_t);
391 extern int ifd_protocol_resynchronize(ifd_protocol_t *, int);
392 
393 #ifdef __cplusplus
394 }
395 #endif
396 
397 #endif /* OPENCT_DRIVER_H */
int(* change_speed)(ifd_reader_t *reader, unsigned int speed)
Change the communication protocol speed.
Definition: driver.h:87
int(* activate)(ifd_reader_t *reader)
Activate the smart card reader.
Definition: driver.h:102
Definition: ifd.h:39
int(* after_command)(ifd_reader_t *)
Execute after command.
Definition: driver.h:343
int(* event)(ifd_reader_t *, int *status, size_t status_size)
Event callback.
Definition: driver.h:363
int(* perform_verify)(ifd_reader_t *reader, int slot, unsigned int timeout, const char *prompt, const unsigned char *data, size_t data_len, unsigned char *resp, size_t resp_len)
Request the PIN and have the card verify it.
Definition: driver.h:209
int(* set_protocol)(ifd_reader_t *reader, int slot, int protocol)
Select the smart card communication protocol.
Definition: driver.h:274
int(* sync_write)(ifd_reader_t *reader, int slot, int proto, unsigned short addr, const unsigned char *sbuf, size_t slen)
Write data to a synchronous smart card.
Definition: driver.h:318
int(* sync_read)(ifd_reader_t *reader, int slot, int proto, unsigned short addr, unsigned char *rbuf, size_t rlen)
Read data from a synchronous smart card.
Definition: driver.h:304
int(* recv)(ifd_reader_t *reader, unsigned int dad, unsigned char *buffer, size_t len, long timeout)
Receive an APDU response using the currently selected protocol.
Definition: driver.h:247
int(* get_eventfd)(ifd_reader_t *, short *events)
Get event fd.
Definition: driver.h:353
Driver operations.
Definition: driver.h:20
int(* open)(ifd_reader_t *reader, const char *name)
Open the reader.
Definition: driver.h:34
int(* transparent)(ifd_reader_t *reader, int slot, const void *sbuf, size_t slen, void *rbuf, size_t rlen)
Transceive a protocol data unit.
Definition: driver.h:290
int(* close)(ifd_reader_t *reader)
Close the reader.
Definition: driver.h:49
Definition: ifd.h:59
int(* card_reset)(ifd_reader_t *reader, int slot, void *atr, size_t atr_len)
Reset the card and fetch the ATR.
Definition: driver.h:154
int(* card_status)(ifd_reader_t *reader, int slot, int *status)
Fetch the card status.
Definition: driver.h:138
int(* error)(ifd_reader_t *)
Error callback.
Definition: driver.h:374
int(* card_request)(ifd_reader_t *reader, int slot, time_t timeout, const char *message, void *atr, size_t atr_len)
Prompts the insertion of a smart card in the reader and performs a card reset.
Definition: driver.h:169
int(* send)(ifd_reader_t *reader, unsigned int dad, const unsigned char *buffer, size_t len)
Send an APDU using the currently selected protocol.
Definition: driver.h:230
int(* output)(ifd_reader_t *reader, const char *message)
Output a message on the reader's display.
Definition: driver.h:193
int(* deactivate)(ifd_reader_t *reader)
Deactivate the smart card reader.
Definition: driver.h:113
int(* change_parity)(ifd_reader_t *reader, int parity)
Change the communication protocol parity.
Definition: driver.h:76
int(* card_eject)(ifd_reader_t *reader, int slot, time_t timeout, const char *message)
Eject the smart card.
Definition: driver.h:185
int(* before_command)(ifd_reader_t *)
Execute before command.
Definition: driver.h:334

libp11, Copyright (C) 2005 Olaf Kirch <okir@lst.de>OpenSC-Project.org Logo