Add pwmd_deinit().
[libpwmd.git] / src / tls.h
blob6fce29dd087558ab3b5f325856abaa1e70937ba1
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2012
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 TLS_H
22 #define TLS_H
24 #ifdef WITH_GNUTLS
25 #include <gnutls/gnutls.h>
26 #include <gnutls/x509.h>
27 #endif
29 struct tls_s {
30 char *cert;
31 char *key;
32 char *ca;
33 int verify;
34 char *priority;
35 gnutls_session_t session;
36 gnutls_certificate_credentials_t x509;
39 ssize_t write_hook_tls(struct tls_s *, assuan_fd_t fd, const void *data,
40 size_t len);
41 ssize_t read_hook_tls(struct tls_s *, assuan_fd_t fd, void *data, size_t len);
42 void tls_free(struct tls_s *);
43 gpg_error_t _parse_tls_url(const char *str, char **host, int *port);
44 gpg_error_t _do_tls_connect(pwm_t *pwm, const char *host, int port,
45 const char *cert, const char *key, const char *cacert,
46 const char *prio, int verify);
48 #endif