r23796: main COPYING file for samba4, plus some formatting varients
[samba.git] / source4 / lib / tls / tls.h
1 /* 
2    Unix SMB/CIFS implementation.
3
4    transport layer security handling code
5
6    Copyright (C) Andrew Tridgell 2005
7    
8    This program 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 3 of the License, or
11    (at your option) any later version.
12    
13    This program 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.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef _TLS_H_
23 #define _TLS_H_
24
25 #include "lib/socket/socket.h"
26
27 /*
28   call tls_initialise() once per task to startup the tls subsystem
29 */
30 struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx);
31
32 /*
33   call tls_init_server() on each new server connection
34
35   the 'plain_chars' parameter is a list of chars that when they occur
36   as the first character from the client on the connection tell the
37   tls code that this is a non-tls connection. This can be used to have
38   tls and non-tls servers on the same port. If this is NULL then only
39   tls connections will be allowed
40 */
41 struct socket_context *tls_init_server(struct tls_params *parms,
42                                     struct socket_context *sock, 
43                                     struct fd_event *fde,
44                                     const char *plain_chars);
45
46 /*
47   call tls_init_client() on each new client connection
48 */
49 struct socket_context *tls_init_client(struct socket_context *sock, 
50                                     struct fd_event *fde);
51
52 /*
53   return True if a connection used tls
54 */
55 BOOL tls_enabled(struct socket_context *tls);
56
57
58 /*
59   true if tls support is compiled in
60 */
61 BOOL tls_support(struct tls_params *parms);
62
63 const struct socket_ops *socket_tls_ops(enum socket_type type);
64
65 #endif