Mercurial > hg > xemacs-beta
comparison src/tls.h @ 5814:a216b3c2b09e
Add TLS support. See xemacs-patches message with ID
<CAHCOHQk6FNm2xf=XiGEpPq43+7WOzNZ=SuD9V79o3wb9WVCTrQ@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Tue, 07 Oct 2014 21:16:10 -0600 |
parents | |
children | d59bfb050ca8 |
comparison
equal
deleted
inserted
replaced
5813:36dddf9d90d1 | 5814:a216b3c2b09e |
---|---|
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), NULL | |
85 #define tls_negotiate(x,y,z) NULL | |
86 #define make_tls_input_stream(x) \ | |
87 signal_error (Qtls_error, "TLS support unavailable", Qnil), NULL | |
88 #define make_tls_output_stream(x) \ | |
89 signal_error (Qtls_error, "TLS support unavailable", Qnil), NULL | |
90 #define tls_get_fd(x, y) -1 | |
91 #define tls_read(w,x,y,z) -1 | |
92 #define tls_write(w,x,y,z) -1 | |
93 #define tls_close(x) -1 | |
94 #endif /* WITH_TLS */ | |
95 | |
96 #endif /* INCLUDED_tls_h_ */ |