Version 3.0.12.
[pwmd.git] / src / pinentry.h
blob33f4fadd9894abe8c366622ac79241900df8bea6
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
3 Ben Kibbey <bjk@luxsci.net>
5 This file is part of pwmd.
7 Pwmd is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 Pwmd is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Pwmd. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef PINENTRY_H
21 #define PINENTRY_H
23 typedef enum
25 PINENTRY_OPEN,
26 PINENTRY_SAVE,
27 PINENTRY_SAVE_CONFIRM,
28 PINENTRY_FAIL_CONFIRM
29 } pinentry_cmd_t;
31 struct pinentry_option_s
33 char *title;
34 char *desc;
35 char *prompt;
36 char *ttyname;
37 char *ttytype;
38 char *display;
39 char *lc_ctype;
40 char *lc_messages;
41 int timeout;
44 struct pinentry_s
46 char *filename;
47 assuan_context_t ctx;
48 struct pinentry_option_s pinentry_opts;
49 int which;
50 char *name;
51 int has_lock;
52 int enable;
53 membuf_t data;
54 gpg_error_t (*inquire_cb) (void *data, const char *line);
55 void *inquire_data;
58 pthread_mutex_t pin_mutex;
59 struct client_s;
61 gpg_error_t pinentry_fork (assuan_context_t ctx);
62 void cleanup_pinentry (struct pinentry_s *pin);
63 gpg_error_t pinentry_getpin (struct pinentry_s *pin, char **result,
64 pinentry_cmd_t which);
65 void pinentry_unlock (struct pinentry_s *pin);
66 gpg_error_t pinentry_lock (assuan_context_t ctx, struct pinentry_s *pin);
67 void *pinentry_timeout_thread (void *arg);
68 gpg_error_t pinentry_iterate (struct client_s *cl, int read_ready);
69 struct pinentry_s *pinentry_init (const char *filename);
70 void pinentry_deinit (struct pinentry_s *);
71 void pinentry_set_defaults (struct pinentry_option_s *opts);
72 void reset_pin_defaults (struct pinentry_s *pin);
73 void pinentry_free_opts (struct pinentry_option_s *opts);
74 gpg_error_t pinentry_merge_options (struct pinentry_option_s *dst,
75 struct pinentry_option_s *src);
77 #endif