comparison src/tls.h @ 5922:4b055de36bb9 cygwin

merging heads 2
author Henry Thompson <ht@markup.co.uk>
date Fri, 27 Feb 2015 17:47:15 +0000
parents d59bfb050ca8
children
comparison
equal deleted inserted replaced
5921:68639fb08af8 5922:4b055de36bb9
1 /* Transport Layer Security implementation -- header file.
2 Copyright (C) 2014 Jerry James
3
4 This file is part of XEmacs.
5
6 XEmacs is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation, either version 3 of the License, or (at your
9 option) any later version.
10
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
18
19 /* Synched up with: Not in FSF. */
20
21 /* Written by Jerry James. */
22
23 #ifndef INCLUDED_tls_h_
24 #define INCLUDED_tls_h_
25
26 extern Lisp_Object Qtls_error;
27
28 void syms_of_tls (void);
29 void vars_of_tls (void);
30 void init_tls (void);
31
32 #ifdef WITH_TLS
33
34 #ifdef HAVE_NSS
35 #include <prio.h>
36
37 #define TLS_SETUP_SOCK 0
38
39 typedef struct tls_state
40 {
41 PRFileDesc *tls_file_desc;
42 int tls_refcount;
43 } tls_state_t;
44 #endif
45
46 #ifdef HAVE_GNUTLS
47 #include <gnutls/gnutls.h>
48
49 #define TLS_SETUP_SOCK 1
50
51 typedef struct tls_state
52 {
53 gnutls_session_t tls_session;
54 int tls_refcount;
55 } tls_state_t;
56 #endif
57
58 #ifdef HAVE_OPENSSL
59 # include <openssl/ssl.h>
60
61 #define TLS_SETUP_SOCK 1
62
63 typedef struct tls_state
64 {
65 SSL *tls_connection;
66 int tls_refcount;
67 } tls_state_t;
68 #endif
69
70 tls_state_t *tls_open (int, const Extbyte *);
71 tls_state_t *tls_negotiate (int, const Extbyte *, Lisp_Object);
72 void tls_close_connection (tls_state_t *);
73 Lisp_Object make_tls_output_stream (tls_state_t *);
74 Lisp_Object make_tls_input_stream (tls_state_t *);
75 int tls_get_fd (tls_state_t *);
76 Bytecount tls_read (tls_state_t *, unsigned char *, Bytecount, unsigned int);
77 Bytecount tls_write (tls_state_t *, const unsigned char *, Bytecount,
78 unsigned int);
79 int tls_close (tls_state_t *);
80 #else /* WITH_TLS */
81 typedef int tls_state_t;
82 #define TLS_SETUP_SOCK 1
83 #define tls_open(x,y) ({ \
84 signal_error (Qtls_error, "TLS support unavailable", Qnil); \
85 NULL; })
86 #define tls_negotiate(x,y,z) NULL
87 #define make_tls_input_stream(x) ({ \
88 signal_error (Qtls_error, "TLS support unavailable", Qnil); \
89 NULL; })
90 #define make_tls_output_stream(x) ({ \
91 signal_error (Qtls_error, "TLS support unavailable", Qnil); \
92 NULL; })
93 #define tls_get_fd(x) -1
94 #define tls_read(w,x,y,z) -1
95 #define tls_write(w,x,y,z) -1
96 #define tls_close(x) -1
97 #endif /* WITH_TLS */
98
99 #endif /* INCLUDED_tls_h_ */