OpenCT  0.6.20
apdu.h
1 /*
2  * APDU type definitions
3  *
4  * Copyright (C) 2003, Olaf Kirch <okir@suse.de>
5  */
6 
7 #ifndef OPENCT_APDU_H
8 #define OPENCT_APDU_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef struct ifd_iso_apdu {
15  unsigned char cse, cla, ins, p1, p2;
16  unsigned int lc, le;
17  unsigned int sw;
18  void * data;
19  size_t len;
20 
21  /* xxx go away */
22  unsigned char * rcv_buf;
23  unsigned int rcv_len;
25 
26 enum {
27  IFD_APDU_CASE_1 = 0x00,
28  IFD_APDU_CASE_2S = 0x01,
29  IFD_APDU_CASE_3S = 0x02,
30  IFD_APDU_CASE_4S = 0x03,
31  IFD_APDU_CASE_2E = 0x10,
32  IFD_APDU_CASE_3E = 0x20,
33  IFD_APDU_CASE_4E = 0x30,
34 
35  IFD_APDU_BAD = -1
36 };
37 
38 #define IFD_APDU_CASE_LC(c) ((c) & 0x02)
39 #define IFD_APDU_CASE_LE(c) ((c) & 0x01)
40 
41 extern int ifd_iso_apdu_parse(const void *, size_t, ifd_iso_apdu_t *);
42 extern int ifd_apdu_case(const void *, size_t);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 
48 #endif /* OPENCT_APDU_H */

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