Added PWMD_OPTION_VERIFY_HOSTNAME and pwmc option -V. This will verify
[libpwmd.git] / types.h
blobf7d51d77fdce24be2187c80b37442d63f1c18c5e
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 gpg_error_t rc;
47 } pwmd_tcp_conn_t;
48 #endif
50 struct pwm_s {
51 assuan_context_t ctx;
52 #ifdef HAVE_LIBGNUTLS
53 gnutls_session_t session;
54 gnutls_certificate_credentials_t x509;
55 int verify_hostname;
56 pwmd_tcp_conn_t *tcp_conn;
57 #endif
58 int fd;
59 pwmd_async_t state;
60 pwmd_async_cmd_t cmd;
61 #ifdef WITH_PINENTRY
62 pid_t pid;
63 assuan_context_t pctx;
64 gpg_error_t pin_error;
65 #endif
66 int is_open_cmd;
67 int use_pinentry;
68 int pinentry_tries;
69 int ntries;
70 char *pinentry_path;
71 char *pinentry_tty;
72 char *pinentry_term;
73 char *pinentry_display;
74 char *title;
75 char *prompt;
76 char *desc;
77 char *password;
78 char *filename;
79 pwmd_password_fn passfunc;
80 void *passdata;
81 pwmd_status_fn status_func;
82 void *status_data;
83 pwmd_inquire_fn inquire_func;
84 void *inquire_data;
87 typedef struct {
88 size_t len;
89 void *buf;
90 } membuf_t;
92 #endif