增加HTTP解析层目录结构,增加插件自注册功能。
* 增加HTTP解析层目录结构,集成CMakeLists.txt编译文件; * 调整编译顺序,先编译插件再编译平台; * 增加TFE_PLUGIN_REGISTER宏,在TFE启动时自注册插件; * 修改了stream_open接口,在插件流初始化接口不传入数据。
This commit is contained in:
@@ -0,0 +1 @@
|
||||
add_subdirectory(http)
|
||||
|
||||
4
plugin/protocol/http/CMakeLists.txt
Normal file
4
plugin/protocol/http/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
add_library(http src/http.cpp)
|
||||
target_link_libraries(http common)
|
||||
target_link_libraries(http http-parser-static)
|
||||
79
plugin/protocol/http/src/http.cpp
Normal file
79
plugin/protocol/http/src/http.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include <MESA/MESA_list_queue.h>
|
||||
#include <tfe_stream.h>
|
||||
#include <tfe_utils.h>
|
||||
#include <tfe_plugin.h>
|
||||
#include <tfe_http.h>
|
||||
#include <http_parser.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <sys/queue.h>
|
||||
}
|
||||
|
||||
struct http_plugin
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct http_plugin __g_http_plugin;
|
||||
struct http_plugin * g_http_plugin = &__g_http_plugin;
|
||||
|
||||
int http_plugin_init(struct tfe_proxy * proxy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void http_plugin_deinit(struct tfe_proxy * proxy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TAILQ_HEAD(http_session_private_list, http_session_private);
|
||||
struct http_session_private
|
||||
{
|
||||
TAILQ_ENTRY(http_session_private) s_next;
|
||||
struct tfe_http_session s_public;
|
||||
};
|
||||
|
||||
struct http_connection_private
|
||||
{
|
||||
struct layer_addr * layer_addr;
|
||||
struct http_session_private_list session_private_list;
|
||||
};
|
||||
|
||||
struct http_half_private
|
||||
{
|
||||
struct tfe_http_half head;
|
||||
};
|
||||
|
||||
int http_connection_entry_open(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
enum tfe_conn_dir dir, void ** pme)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum tfe_stream_action http_connection_entry_data(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
enum tfe_conn_dir dir, const unsigned char * data, size_t len, void ** pme)
|
||||
{
|
||||
return ACTION_FORWARD_DATA;
|
||||
}
|
||||
|
||||
void http_connection_entry_close(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
enum tfe_stream_close_reason reason, void ** pme)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static struct tfe_plugin __http_plugin_info =
|
||||
{
|
||||
.symbol = "HTTP",
|
||||
.type = TFE_PLUGIN_TYPE_PROTOCOL,
|
||||
.proto = APP_PROTO_HTTP1,
|
||||
.on_init = http_plugin_init,
|
||||
.on_deinit = http_plugin_deinit,
|
||||
.on_open = http_connection_entry_open,
|
||||
.on_data = http_connection_entry_data,
|
||||
.on_close = http_connection_entry_close
|
||||
};
|
||||
|
||||
TFE_PLUGIN_REGISTER(HTTP, __http_plugin_info)
|
||||
Reference in New Issue
Block a user