1 |
/* wptCard.h |
2 |
* Copyright (C) 2003, 2004, 2005 Timo Schulz |
3 |
* |
4 |
* This file is part of WinPT. |
5 |
* |
6 |
* WinPT is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* WinPT is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
20 |
|
21 |
#ifndef WPT_CARD_H |
22 |
#define WPT_CARD_H |
23 |
|
24 |
enum { |
25 |
CARD_STATE_NONE=0, |
26 |
CARD_STATE_UNAWARE, |
27 |
CARD_STATE_UNAVAIL, |
28 |
CARD_STATE_PRESENT, |
29 |
CARD_STATE_EXCLUSI, |
30 |
CARD_STATE_EMPTY, |
31 |
CARD_STATE_INUSE, |
32 |
CARD_STATE_MUTE |
33 |
}; |
34 |
|
35 |
struct gpgme_card_s; |
36 |
typedef struct gpgme_card_s * gpgme_card_t; |
37 |
|
38 |
|
39 |
struct pin_cb_ctx_s { |
40 |
gpgme_edit_card_t which; |
41 |
char *info_text; |
42 |
char *apin; /* admin */ |
43 |
char *upin; /* user */ |
44 |
}; |
45 |
|
46 |
struct card_cb_s { |
47 |
int cancel; |
48 |
int init; |
49 |
int code; |
50 |
char val[128]; |
51 |
}; |
52 |
|
53 |
struct pcsc_reader_s; |
54 |
typedef struct pcsc_reader_s * pcsc_reader_t; |
55 |
|
56 |
|
57 |
unsigned get_card_status (void); |
58 |
int show_card_status (void); |
59 |
gpgme_card_t gpg_load_scard (void); |
60 |
|
61 |
/*-- wptCardManager.cpp --*/ |
62 |
const char * card_callback (int code, void *opaque); |
63 |
|
64 |
/*-- wptCardPCSC.c --*/ |
65 |
#ifdef __cplusplus |
66 |
extern "C" { |
67 |
#endif |
68 |
|
69 |
int pcsc_loadlib (int scard_support); |
70 |
void pcsc_free_readers (pcsc_reader_t rd); |
71 |
const char * pcsc_get_reader (pcsc_reader_t rd, int idx, int *ret_nrd); |
72 |
int pcsc_scan_readers (pcsc_reader_t *ret_rd); |
73 |
int pcsc_get_card_status (void); |
74 |
|
75 |
#ifdef __cplusplus |
76 |
} |
77 |
#endif |
78 |
|
79 |
#endif /*WPT_CARD_H*/ |