apdu.h

00001 /*
00002  * APDU type definitions
00003  *
00004  * Copyright (C) 2003, Olaf Kirch <okir@suse.de>
00005  */
00006 
00007 #ifndef OPENCT_APDU_H
00008 #define OPENCT_APDU_H
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 typedef struct ifd_iso_apdu {
00015         unsigned char           cse, cla, ins, p1, p2;
00016         unsigned int            lc, le;
00017         unsigned int            sw;
00018         void *                  data;
00019         size_t                  len;
00020 
00021         /* xxx go away */
00022         unsigned char *         rcv_buf;
00023         unsigned int            rcv_len;
00024 } ifd_iso_apdu_t;
00025 
00026 enum {
00027         IFD_APDU_CASE_1  = 0x00,
00028         IFD_APDU_CASE_2S = 0x01,
00029         IFD_APDU_CASE_3S = 0x02,
00030         IFD_APDU_CASE_4S = 0x03,
00031         IFD_APDU_CASE_2E = 0x10,
00032         IFD_APDU_CASE_3E = 0x20,
00033         IFD_APDU_CASE_4E = 0x30,
00034 
00035         IFD_APDU_BAD = -1
00036 };
00037 
00038 #define IFD_APDU_CASE_LC(c)     ((c) & 0x02)
00039 #define IFD_APDU_CASE_LE(c)     ((c) & 0x01)
00040 
00041 extern int      ifd_iso_apdu_parse(const void *, size_t, ifd_iso_apdu_t *);
00042 extern int      ifd_apdu_case(const void *, size_t);
00043 
00044 #ifdef __cplusplus
00045 }
00046 #endif
00047 
00048 #endif /* OPENCT_APDU_H */

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