Added assuan_socket_connect_fd() and assuan_set_finish_handler().
[libpwmd.git] / types.h
blob57b496c8913cd163e33b88edc64b60309d5bda92
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2006-2008 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
19 #ifndef TYPES_H
20 #define TYPES_H
22 #include <assuan.h>
24 #ifdef HAVE_LIBGNUTLS
25 #include <gnutls/gnutls.h>
26 #endif
28 typedef enum {
29 ASYNC_CMD_NONE,
30 #ifdef HAVE_LIBGNUTLS
31 ASYNC_CMD_DNS,
32 ASYNC_CMD_CONNECT,
33 #endif
34 ASYNC_CMD_OPEN,
35 ASYNC_CMD_SAVE,
36 } pwmd_async_cmd_t;
38 #ifdef HAVE_LIBGNUTLS
39 typedef struct {
40 char *host;
41 unsigned port;
42 char *cert;
43 char *key;
44 char *ca;
45 int fd;
46 int verify;
47 char *priority;
48 gpg_error_t rc;
49 ares_channel chan;
50 int async;
51 struct hostent *he;
52 } pwmd_tcp_conn_t;
53 #endif
55 struct pwm_s {
56 assuan_context_t ctx;
57 #ifdef HAVE_LIBGNUTLS
58 gnutls_session_t session;
59 gnutls_certificate_credentials_t x509;
60 pwmd_tcp_conn_t *tcp_conn;
61 #endif
62 int fd;
63 pwmd_async_t state;
64 pwmd_async_cmd_t cmd;
65 #ifdef WITH_PINENTRY
66 pid_t pid;
67 assuan_context_t pctx;
68 gpg_error_t pin_error;
69 #endif
70 int is_open_cmd;
71 int use_pinentry;
72 int pinentry_tries;
73 int ntries;
74 char *pinentry_path;
75 char *pinentry_tty;
76 char *pinentry_term;
77 char *pinentry_display;
78 char *title;
79 char *prompt;
80 char *desc;
81 char *password;
82 char *filename;
83 pwmd_password_fn passfunc;
84 void *passdata;
85 pwmd_status_fn status_func;
86 void *status_data;
87 pwmd_inquire_fn inquire_func;
88 void *inquire_data;
91 typedef struct {
92 size_t len;
93 void *buf;
94 } membuf_t;
96 #endif