This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/interface/tfe_connection.h
2018-08-01 17:47:38 +08:00

53 lines
1.2 KiB
C

#define TFE_STRING_MAX 2048
#define TFE_SYMBOL_MAX 64
struct tfe_conn_ctx
{
sockaddr_t dst;
struct pxy_conn_desc src;
struct pxy_conn_desc dst;
int cur_dir//1: c2s; 2:s2c
char* sni;
};
struct tfe_conn_inner
{
int a;
struct tfe_conn_ctx conn_desc;
void **proto_arg;
};
//Return 1 for identify as its ttraffic;
//Return 0 for unknown traffic;
typedef int proto_pend_cb_t(const struct tfe_conn_ctx* c, struct evbuffer *data, void **pme);
enum tfe_proto_action
{
PROTO_ATCION_FORWARD,
PROTO_ACTION_DEFER,
PROTO_ACTION_STEAL,
PROTO_ACTION_PASSTHROUGH,
PROTO_ACTION_CLOSE
};
typedef tfe_proto_action proto_read_cb_t(const struct tfe_conn_ctx* ctx, struct evbuffer *data, void **pme);
typedef void proto_close_cb_t(const struct tfe_conn_ctx* ctx, int ev, void **pme);
//typedef int proto_onwrite_cb_t(struct tfe_conn_ctx*, struct evbuffer *data, void **pme);
struct tfe_proto_module
{
char symbol[TFE_SYMBOL_MAX];
proto_pend_cb_t *on_pend;
proto_read_cb_t *on_read;
proto_close_cb_t *on_close;
// proto_onwrite_cb_t *onwrite;
};
int tfe_io_write(struct pxy_conn_desc* dest,int dir,struct evbuffer *data);
int tfe_xxx_proto_init(struct tfe_proto_module*m);