-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathterminal.h
More file actions
48 lines (36 loc) · 813 Bytes
/
terminal.h
File metadata and controls
48 lines (36 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TERMINAL_H
#define TERMINAL_H
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#define DEBUG_APDU 1
#define DEBUG_TERM 2
typedef struct apdu_s {
uint8_t cla;
uint8_t ins;
uint8_t p1;
uint8_t p2;
uint8_t p3;
uint8_t ack;
uint8_t *dout;
uint8_t *din;
uint8_t sw[2];
} apdu_t;
typedef struct terminal_s {
// name
const char *name;
// functions
int (*init) (char *dev, int debug);
void (*close) (void);
int (*reset) (uint8_t * atr, int maxlen);
int (*apdu) (apdu_t * apu);
int (*pps) (uint8_t *obuf, uint8_t *ibuf);
// TODO: features?
// TODO: private data?
} terminal_t;
int term_init(char *dev, int debug, FILE *log);
void term_close(void);
int term_reset(uint8_t * atr, int maxlen);
int term_apdu(apdu_t * apdu);
int term_pps(int new_etu);
#endif // TERMINAL_H