78 lines
2.1 KiB
C
78 lines
2.1 KiB
C
#ifndef DELIVER_PROCESS_H
|
|
#define DELIVER_PROCESS_H
|
|
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <tfe_stream.h>
|
|
|
|
|
|
#define DELIVER_DIR_C2S 0x01
|
|
#define DELIVER_DIR_S2C 0x02
|
|
|
|
|
|
struct origin_stream_addr
|
|
{
|
|
struct sockaddr* client;
|
|
struct sockaddr* server;
|
|
};
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
Description:deliver read config from filepath to init;
|
|
Paraments:
|
|
thread_num:[IN],total process data thread num
|
|
filepath:[IN], conf file path,read use MESA_prof_load;
|
|
Return:
|
|
0:succes
|
|
<0:error
|
|
***************************************************************************/
|
|
int mirror_stream_init(int thread_num, const char* filepath);
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
Description:call this function before send a new session data
|
|
Paraments:
|
|
thread_seq:[IN], thread seq
|
|
addr:[IN],addr of the session to be send
|
|
pme:[OUT],buffer alive in the session,deliver malloc and free *pme;
|
|
Return:
|
|
0:succes
|
|
<0:error
|
|
***************************************************************************/
|
|
int mirror_stream_open(struct origin_stream_addr* addr,void** pme);
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
Description:call this function when send session data
|
|
Paraments:
|
|
cur_dir:[IN], direction of current data,definition in DELIVER_DIR_***
|
|
thread_seq:[IN],thread seq
|
|
buflen:[IN],buffer len,tcp payload len;
|
|
buf:[IN],data fo the session to be send,tcp payload
|
|
pme:[OUT]
|
|
Return:
|
|
0:succes
|
|
<0:error
|
|
***************************************************************************/
|
|
int mirror_stream_write(enum tfe_conn_dir cur_dir,const unsigned char * data, size_t len, void** pme,int thread_seq);
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
Description:call this function after send all of session data
|
|
Paraments:
|
|
thread_seq:[IN], thread seq
|
|
pme:[OUT]; free *pme when deliver_end()
|
|
Return:
|
|
0:succes
|
|
<0:error
|
|
***************************************************************************/
|
|
void mirror_stream_close(void** pme, int thread_id);
|
|
|
|
|
|
#endif
|
|
|