This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/plugin/protocol/http/src/http.cpp
Lu Qiuwen 081d79416a 增加HTTP解析层目录结构,增加插件自注册功能。
* 增加HTTP解析层目录结构,集成CMakeLists.txt编译文件;
* 调整编译顺序,先编译插件再编译平台;
* 增加TFE_PLUGIN_REGISTER宏,在TFE启动时自注册插件;
* 修改了stream_open接口,在插件流初始化接口不传入数据。
2018-09-03 16:38:05 +08:00

80 lines
1.6 KiB
C++

#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)