适配tfe_stream_addr;为了编译通过,注释mirror_stream.cpp中的代码;

This commit is contained in:
zhengchao
2018-09-04 11:36:22 +08:00
parent 046569828c
commit 4d1e9034c9
7 changed files with 59 additions and 61 deletions

View File

@@ -1,41 +1,53 @@
#include "mirror_stream.h"
#include <tfe_stream.h>
#include <tfe_plugin.h>
#include <assert.h>
int decrypt_mirror_init(void *proxy)
int decrypt_mirror_init(struct tfe_proxy * proxy)
{
const char* filepath="./conf/decrypt_mirror.conf";
int thread_num=2;//todo: aquire from proxy;
int mirro_stream_init(thread_num, filepath);
int thread_num=2, ret=0;//todo: aquire from proxy;
ret=mirror_stream_init(thread_num, filepath);
assert(ret==0);
return 0;
}
enum tfe_stream_action decrypt_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thread_id,
enum tfe_conn_dir dir, const unsigned char * data, size_t len, void ** pme)
int decrypt_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thread_id,
enum tfe_conn_dir dir, void ** pme)
{
struct layer_addr* addr=NULL; //=stream->addr;
int ret=0;
ret=mirror_stream_open(thread_id, addr, pme);
ret=mirror_stream_open(thread_id, stream->addr, pme);
assert(ret==0);
return ACTION_FORWARD_DATA;
return 0;
}
enum tfe_stream_action decrypt_mirror_on_data_cb(const struct tfe_stream * stream, unsigned int thread_id,
enum tfe_conn_dir dir, const unsigned char * data, size_t len, void ** pme)
{
int ret=0;
ret=mirror_stream_write(thread_id, data,len, pme, thread_id);
ret=mirror_stream_write(dir, data,len, pme, thread_id);
return ACTION_FORWARD_DATA;
}
void decrypt_mirror_on_close_cb(const struct tfe_stream * stream, unsigned int thread_id,
enum tfe_stream_close_reason reason, void ** pme)
{
int ret=0;
ret=mirror_stream_close(pme, thread_id);
mirror_stream_close(pme, thread_id);
return;
}
void decrypt_mirror_deinit(void)
void decrypt_mirror_deinit(struct tfe_proxy * proxy)
{
return;
}
struct tfe_plugin decrypt_mirror_spec={
.symbol=NULL,
.type = TFE_PLUGIN_TYPE_BUSINESS,
.proto = APP_PROTO_HTTP1, //???
.on_init = decrypt_mirror_init,
.on_deinit = decrypt_mirror_deinit,
.on_open = decrypt_mirror_on_open_cb,
.on_data = decrypt_mirror_on_data_cb,
.on_close = decrypt_mirror_on_close_cb};
TFE_PLUGIN_REGISTER(decrypt_mirror,decrypt_mirror_spec)