TSG-14938 TFE支持新控制报文格式; 调整代码结构

This commit is contained in:
wangmenglan
2023-04-28 16:18:32 +08:00
parent 8a7c196c20
commit 8de8ec1c5f
22 changed files with 16372 additions and 1069 deletions

View File

@@ -6,15 +6,104 @@ extern "C"
{
#endif
struct packet_io *packet_io_create(const char *profile, int thread_num, cpu_set_t *coremask);
void packet_io_destory(struct packet_io *handle);
#include "tfe_addr_tuple4.h"
struct tap_ctx
{
int tap_s;
int tap_c;
int tap_fd;
int eventfd;
int eventfd_c;
int eventfd_s;
struct io_uring_instance *io_uring_fd;
struct io_uring_instance *io_uring_c;
struct io_uring_instance *io_uring_s;
int buff_size;
char *buff;
};
struct acceptor_thread_ctx
{
pthread_t tid;
int thread_index;
struct tap_ctx *tap_ctx;
struct session_table *session_table;
struct sf_metrics *sf_metrics;
struct packet_io *ref_io;
struct global_metrics *ref_metrics;
struct policy_enforcer *ref_enforcer;
struct tfe_proxy *ref_proxy;
struct acceptor_kni_v4 *ref_acceptor_ctx;
int session_table_need_reset;
};
struct packet_info
{
int is_e2i_dir;
struct addr_tuple4 tuple4;
char *header_data;
int header_len;
};
struct session_ctx
{
int policy_ids;
uint64_t session_id;
char *session_addr;
char client_mac[6];
char server_mac[6];
struct packet_info c2s_info;
struct packet_info s2c_info;
struct metadata *raw_meta_i2e;
struct metadata *raw_meta_e2i;
struct metadata *ctrl_meta;
struct tfe_cmsg *cmsg;
struct acceptor_thread_ctx *ref_thread_ctx;
};
struct acceptor_kni_v4
{
int firewall_sids;
int proxy_sids;
int sce_sids;
int nr_worker_threads;
int cpu_affinity_mask[TFE_THREAD_MAX];
cpu_set_t coremask;
struct packet_io *io;
struct global_metrics *metrics;
struct acceptor_thread_ctx work_threads[TFE_THREAD_MAX];
struct tfe_proxy *ref_proxy;
};
int is_enable_iouring(struct packet_io *handle);
void tfe_tap_ctx_destory(struct tap_ctx *handler);
struct tap_ctx *tfe_tap_ctx_create(void *ctx);
int packet_io_thread_init(struct packet_io *handle, struct acceptor_thread_ctx *thread_ctx);
void packet_io_thread_wait(struct packet_io *handle, struct acceptor_thread_ctx *thread_ctx, int timeout_ms);
void packet_io_destory(struct packet_io *handle);
struct packet_io *packet_io_create(const char *profile, int thread_num, cpu_set_t *coremask);
int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, void *ctx);
void handle_raw_packet_from_tap(const char *data, int len, void *args);
void handle_decryption_packet_from_tap(const char *data, int len, void *args);
void handle_raw_packet_from_tap(const char *data, int len, void *args);
#ifdef __cpluscplus
}