42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
|
|
#include "mirror_stream.h"
|
||
|
|
#include <tfe_stream.h>
|
||
|
|
|
||
|
|
int decrypt_mirror_init(void *proxy)
|
||
|
|
{
|
||
|
|
const char* filepath="./conf/decrypt_mirror.conf";
|
||
|
|
int thread_num=2;//todo: aquire from proxy;
|
||
|
|
int mirro_stream_init(thread_num, filepath);
|
||
|
|
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)
|
||
|
|
{
|
||
|
|
struct layer_addr* addr=NULL; //=stream->addr;
|
||
|
|
int ret=0;
|
||
|
|
ret=mirror_stream_open(thread_id, addr, pme);
|
||
|
|
assert(ret==0);
|
||
|
|
return ACTION_FORWARD_DATA;
|
||
|
|
}
|
||
|
|
|
||
|
|
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);
|
||
|
|
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);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
void decrypt_mirror_deinit(void)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|