xref: /netbsd-src/external/ibm-public/postfix/dist/src/tlsproxy/tlsproxy.h (revision 33881f779a77dce6440bdc44610d94de75bebefe)
1 /*	$NetBSD: tlsproxy.h,v 1.2 2020/03/18 19:05:21 christos Exp $	*/
2 
3 /*++
4 /* NAME
5 /*	tlsproxy 3h
6 /* SUMMARY
7 /*	tlsproxy internal interfaces
8 /* SYNOPSIS
9 /*	#include <tlsproxy.h>
10 /* DESCRIPTION
11 /* .nf
12 
13  /*
14   * Utility library.
15   */
16 #include <vstream.h>
17 #include <nbbio.h>
18 
19  /*
20   * TLS library.
21   */
22 #include <tls.h>
23 
24  /*
25   * Internal interface.
26   */
27 typedef struct {
28     int     flags;			/* see below */
29     int     req_flags;			/* request flags, see tls_proxy.h */
30     int     is_server_role;		/* avoid clumsy handler code */
31     char   *service;			/* argv[0] */
32     VSTREAM *plaintext_stream;		/* local peer: postscreen(8), etc. */
33     NBBIO  *plaintext_buf;		/* plaintext buffer */
34     int     ciphertext_fd;		/* remote peer */
35     EVENT_NOTIFY_FN ciphertext_timer;	/* kludge */
36     int     timeout;			/* read/write time limit */
37     int     handshake_timeout;		/* in-handshake time limit */
38     int     session_timeout;		/* post-handshake time limit */
39     char   *remote_endpt;		/* printable remote endpoint */
40     char   *server_id;			/* cache management */
41     TLS_APPL_STATE *appl_state;		/* libtls state */
42     TLS_SESS_STATE *tls_context;	/* libtls state */
43     int     ssl_last_err;		/* TLS I/O state */
44     TLS_CLIENT_PARAMS *tls_params;	/* globals not part of init_props */
45     TLS_SERVER_INIT_PROPS *server_init_props;
46     TLS_SERVER_START_PROPS *server_start_props;
47     TLS_CLIENT_INIT_PROPS *client_init_props;
48     TLS_CLIENT_START_PROPS *client_start_props;
49 } TLSP_STATE;
50 
51 #define TLSP_FLAG_DO_HANDSHAKE	(1<<0)
52 #define TLSP_FLAG_NO_MORE_CIPHERTEXT_IO (1<<1)	/* overrides DO_HANDSHAKE */
53 
54 extern TLSP_STATE *tlsp_state_create(const char *, VSTREAM *);
55 extern void tlsp_state_free(TLSP_STATE *);
56 
57 /* LICENSE
58 /* .ad
59 /* .fi
60 /*	The Secure Mailer license must be distributed with this software.
61 /* AUTHOR(S)
62 /*	Wietse Venema
63 /*	IBM T.J. Watson Research
64 /*	P.O. Box 704
65 /*	Yorktown Heights, NY 10598, USA
66 /*
67 /*	Wietse Venema
68 /*	Google, Inc.
69 /*	111 8th Avenue
70 /*	New York, NY 10011, USA
71 /*--*/
72