#include "mirror_stream.h" #include #include #include int decrypt_mirror_init(struct tfe_proxy * proxy) { const char* filepath="./conf/tfe/decrypt_mirror.conf"; int thread_num=2, ret=0;//todo: aquire from proxy; ret=mirror_stream_init(thread_num, filepath); // assert(ret==0); return 0; } int decrypt_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thread_id, enum tfe_conn_dir dir, void ** pme) { int ret=0; ret=mirror_stream_open(thread_id, stream->addr, pme); // assert(ret==0); 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(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) { mirror_stream_close(pme, thread_id); return; } void decrypt_mirror_deinit(struct tfe_proxy * proxy) { return; } struct tfe_plugin decrypt_mirror_spec={ .symbol=NULL, .type = TFE_PLUGIN_TYPE_BUSINESS, .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)