整理stream处理流程,适应KNI接口定义。

This commit is contained in:
Lu Qiuwen
2018-08-23 11:23:05 +08:00
committed by Lu
parent 7cccc70b53
commit 405f046b22
10 changed files with 155 additions and 93 deletions

View File

@@ -1,2 +1,7 @@
void* kni_init(const char *unix_domain_path, struct event_base *attach);
#pragma once
struct tfe_proxy;
struct kni_acceptor_ctx;
struct kni_acceptor_ctx * kni_acceptor_init(struct tfe_proxy *proxy, const char *profile, void *logger);
void kni_acceptor_deinit(struct kni_acceptor_ctx *ctx);

View File

@@ -0,0 +1,19 @@
#pragma once
#include <tfe_stream.h>
#include <event2/event.h>
struct tfe_proxy;
struct tfe_proxy_accept_para
{
/* Both upstream and downstream FDs */
evutil_socket_t upstream_fd;
evutil_socket_t downstream_fd;
/* Session Type */
enum tfe_session_proto session_type;
};
struct tfe_proxy * tfe_proxy_new(const char * profile);
int tfe_proxy_fds_accept(struct tfe_proxy * ctx, const struct tfe_proxy_accept_para * para);
void tfe_proxy_run(struct tfe_proxy * proxy);

View File

@@ -1,5 +1,7 @@
#pragma once
#include "tfe_future.h"
#include <event2/event.h>
#include <tfe_future.h>
struct ssl_client_hello
{
@@ -7,11 +9,14 @@ struct ssl_client_hello
char* sni;
char* cipher_suites;
};
struct ssl_client_hello* ssl_get_peek_result(future_result_t* result);
void ssl_free_peek_result(struct ssl_client_hello* client_hello);
void ssl_async_peek_client_hello(struct future* future, evutil_socket_t fd, struct event_base *evbase);
void ssl_async_connect_origin(struct future* future, const struct ssl_client_hello* client_hello, evutil_socket_t fd, const char* sni, struct event_base *evbase);
void ssl_async_connect_origin(struct future* future, const struct ssl_client_hello* client_hello,
evutil_socket_t fd, const char* sni, struct event_base *evbase);
struct ssl_downstream * ssl_downstream_create();
void ssl_upstream_free(struct ssl_upstream * p);

View File

@@ -78,6 +78,8 @@ struct tfe_conn_private
struct tfe_stream_private
{
struct tfe_stream head;
struct tfe_proxy *proxy;
enum tfe_session_proto session_type;
struct tfe_conn_private conn_upstream;
struct tfe_conn_private conn_downstream;
@@ -96,11 +98,14 @@ struct tfe_stream_private
uint8_t is_plugin_opened;
int calling_idx;
size_t forward_bytes;
size_t defere_bytes;
size_t drop_bytes;
enum tfe_app_proto app_proto;
int plugin_num;
struct plugin_ctx * plug_ctx;
unsigned char passthrough; /* 1 if SSL passthrough is active */