80 lines
1.6 KiB
C++
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)
|