Remove pwmd_tls_error().
[libpwmd.git] / src / types.h
blobbab5f9b1b479c0f88af150f57d5d99b874b7b8f4
1 /*
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
3 2016
4 Ben Kibbey <bjk@luxsci.net>
6 This file is part of libpwmd.
8 Libpwmd is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 Libpwmd is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Libpwmd. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef TYPES_H
22 #define TYPES_H
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
28 #include <libpwmd.h>
29 #include <pthread.h>
30 #include <assuan.h>
32 #ifdef WITH_SSH
33 #include "ssh.h"
34 #endif
36 #ifdef WITH_GNUTLS
37 #include "tls.h"
38 #endif
40 #ifdef ENABLE_NLS
41 #ifdef HAVE_SETLOCALE
42 #include <locale.h>
43 #endif
44 #include "gettext.h"
45 #define N_(msgid) dgettext("libpwmd", msgid)
46 #else
47 #define N_(msgid) (msgid)
48 #endif
50 #define N_ARRAY(a) (sizeof(a)/sizeof(a[0]))
52 typedef enum
54 PWMD_IPV6, PWMD_IPV4, PWMD_IP_ANY
55 } pwmd_ip_version_t;
57 #if defined(WITH_SSH) || defined(WITH_GNUTLS)
58 struct tcp_s
60 char *host;
61 unsigned port;
62 int *fd;
63 gpg_error_t rc;
64 struct addrinfo *addrs;
65 struct addrinfo *addr;
66 pthread_cond_t dns_cond;
67 pthread_mutex_t dns_mutex;
68 #ifdef WITH_SSH
69 struct ssh_s *ssh;
70 #endif
71 #ifdef WITH_GNUTLS
72 struct tls_s *tls;
73 #endif
75 #endif
77 #define OPT_LOCK_ON_OPEN 0x0001
78 #define OPT_SIGPIPE 0x0002
80 struct pwm_s
82 assuan_context_t ctx;
83 #if defined(WITH_SSH) || defined(WITH_GNUTLS)
84 struct tcp_s *tcp;
85 #ifdef WITH_GNUTLS
86 int tls_error;
87 #endif
88 #endif
89 /* Options set with pwmd_setopt(). */
90 pwmd_ip_version_t prot;
91 pwmd_knownhost_cb_t kh_cb;
92 int needs_passphrase;
93 void *kh_data;
94 int use_agent;
95 int tls_verify;
96 int socket_timeout;
97 int fd;
98 int cancel;
99 int connected;
100 #ifdef WITH_PINENTRY
101 pid_t pinentry_pid; // for local pinentry timeouts
102 assuan_context_t pctx;
103 #endif
104 char *pinentry_path;
105 char *pinentry_tty;
106 char *pinentry_term;
107 char *pinentry_display;
108 char *pinentry_lcctype;
109 char *pinentry_lcmessages;
110 char *pinentry_error;
111 char *pinentry_prompt;
112 char *pinentry_desc;
113 int pinentry_tries; // local pinentry
114 int pinentry_try; // local pinentry
115 char *passphrase_hint;
116 char *passphrase_info;
117 char *filename;
118 int pinentry_timeout;
119 int current_pinentry_timeout;
120 int disable_pinentry;
121 int local_pinentry;
122 int pinentry_disabled; // for sending the disable command
123 pwmd_status_cb_t status_func;
124 void *status_data;
125 pwmd_inquire_cb_t inquire_func;
126 void *inquire_data;
127 size_t inquire_total;
128 size_t inquire_sent;
129 size_t inquire_maxlen;
130 #ifdef WITH_QUALITY
131 gpg_error_t (*_inquire_func) (void *, const char *);
132 void *_inquire_data;
133 #endif
134 char *name;
135 unsigned opts;
136 int override_inquire;
137 void *user_data;
138 unsigned version; // of pwmd
141 gpg_error_t _assuan_command (pwm_t * pwm, assuan_context_t ctx,
142 char **result, size_t * len, const char *cmd);
143 gpg_error_t _connect_finalize (pwm_t * pwm);
144 #if defined(WITH_SSH) || defined(WITH_GNUTLS)
145 void free_tcp (pwm_t *);
146 gpg_error_t tcp_connect_common (pwm_t * pwm);
147 #endif
149 #endif