2018-08-21 19:32:37 +08:00
|
|
|
#pragma once
|
2018-08-23 11:23:05 +08:00
|
|
|
#include <event2/event.h>
|
|
|
|
|
#include <tfe_future.h>
|
2018-10-31 19:44:13 +08:00
|
|
|
#include <tfe_types.h>
|
2018-08-23 19:46:38 +08:00
|
|
|
|
2018-08-27 21:10:45 +08:00
|
|
|
|
2018-08-23 19:46:38 +08:00
|
|
|
|
|
|
|
|
struct ssl_stream;
|
|
|
|
|
|
|
|
|
|
struct ssl_mgr;
|
2018-08-31 10:39:25 +08:00
|
|
|
struct ssl_mgr * ssl_manager_init(const char * ini_profile, const char * section, struct event_base * ev_base_gc,
|
2018-10-17 20:21:21 +08:00
|
|
|
void * logger);
|
2018-08-27 21:10:45 +08:00
|
|
|
void ssl_manager_destroy(struct ssl_mgr * mgr);
|
2019-02-26 19:47:16 +06:00
|
|
|
void ssl_stream_log_error(struct bufferevent * bev, enum tfe_conn_dir dir, struct ssl_mgr* mgr);
|
2018-08-23 19:46:38 +08:00
|
|
|
|
2018-08-27 21:10:45 +08:00
|
|
|
struct ssl_stream * ssl_upstream_create_result_release_stream(future_result_t * result);
|
|
|
|
|
struct bufferevent * ssl_upstream_create_result_release_bev(future_result_t * result);
|
|
|
|
|
void ssl_async_upstream_create(struct future * f, struct ssl_mgr * mgr, evutil_socket_t fd_upstream,
|
2018-11-26 14:54:20 +08:00
|
|
|
evutil_socket_t fd_downstream, unsigned int thread_id);
|
2018-08-23 19:46:38 +08:00
|
|
|
|
2018-08-27 21:10:45 +08:00
|
|
|
struct ssl_stream * ssl_downstream_create_result_release_stream(future_result_t * result);
|
|
|
|
|
struct bufferevent * ssl_downstream_create_result_release_bev(future_result_t * result);
|
2018-11-26 14:54:20 +08:00
|
|
|
void ssl_async_downstream_create(struct future * f, struct ssl_mgr * mgr, struct ssl_stream * upstream,
|
|
|
|
|
evutil_socket_t fd_downstream, int keyring_id, unsigned int thread_id);
|
2018-08-27 21:10:45 +08:00
|
|
|
void ssl_stream_free_and_close_fd(struct ssl_stream * stream, struct event_base * evbase, evutil_socket_t fd);
|
2019-02-18 18:25:19 +06:00
|
|
|
const char* ssl_stream_dump_info(struct ssl_stream *stream, char* buffer, size_t sz);
|
2018-10-31 19:44:13 +08:00
|
|
|
//Follow functions are allowed to call during runtime.
|
|
|
|
|
int ssl_manager_add_trust_ca(struct ssl_mgr* mgr, const char* pem_file);
|
|
|
|
|
int ssl_manager_del_trust_ca(struct ssl_mgr* mgr, const char* pem_file);
|
|
|
|
|
int ssl_manager_add_crl(struct ssl_mgr* mgr, const char* pem_file);
|
|
|
|
|
int ssl_manager_del_crl(struct ssl_mgr* mgr, const char* pem_file);
|
|
|
|
|
void ssl_manager_reset_trust_ca(struct ssl_mgr* mgr);
|
|
|
|
|
|
|
|
|
|
|