Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00030 #ifndef _TLS_SERVER_H
00031 #define _TLS_SERVER_H
00032
00033 #include <stdio.h>
00034 #include "../../tcp_conn.h"
00035 #include "tls_domain.h"
00036 #include "tls_ct_wrq.h"
00037
00038 enum tls_conn_states {
00039 S_TLS_NONE = 0,
00040 S_TLS_ACCEPTING,
00041 S_TLS_CONNECTING,
00042 S_TLS_ESTABLISHED
00043 };
00044
00045 struct tls_rd_buf {
00046 unsigned int pos;
00047 unsigned int size;
00048 unsigned char buf[1];
00049 };
00050
00051
00052 #define F_TLS_CON_WR_WANTS_RD 1
00053 #define F_TLS_CON_HANDSHAKED 2
00054 #define F_TLS_CON_RENEGOTIATION 4
00055
00056 struct tls_extra_data {
00057 tls_domains_cfg_t* cfg;
00058 SSL* ssl;
00059 BIO* rwbio;
00060
00061
00062 tls_ct_q* ct_wq;
00063 struct tls_rd_buf* enc_rd_buf;
00064 unsigned int flags;
00065 enum tls_conn_states state;
00066 };
00067
00068
00069
00070 #define tls_write_wants_read(tls_ed) (tls_ed->flags & F_TLS_CON_WR_WANTS_RD)
00071
00072
00073
00074
00075
00076 int tls_h_tcpconn_init(struct tcp_connection *c, int sock);
00077
00078
00079
00080
00081 void tls_h_tcpconn_clean(struct tcp_connection *c);
00082
00083
00084
00085
00086 void tls_h_close(struct tcp_connection *c, int fd);
00087
00088 int tls_encode_f(struct tcp_connection *c,
00089 const char ** pbuf, unsigned int* plen,
00090 const char** rest_buf, unsigned int* rest_len,
00091 snd_flags_t* send_flags) ;
00092
00093 int tls_read_f(struct tcp_connection *c, int* flags);
00094
00095 int tls_h_fix_read_conn(struct tcp_connection *c);
00096
00097 int tls_connect(struct tcp_connection *c, int* error);
00098 int tls_accept(struct tcp_connection *c, int* error);
00099 #endif