2023-02-10 14:22:40 +08:00
|
|
|
#ifndef _SCE_H
|
|
|
|
|
#define _SCE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "policy.h"
|
|
|
|
|
#include "packet_io.h"
|
|
|
|
|
#include "session_table.h"
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* Struct For Thread
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
struct thread_ctx
|
|
|
|
|
{
|
2023-02-21 09:58:31 +08:00
|
|
|
pthread_t tid;
|
2023-02-10 14:22:40 +08:00
|
|
|
int thread_index;
|
|
|
|
|
struct session_table *session_table;
|
2023-02-28 19:03:35 +08:00
|
|
|
struct sf_metrics *sf_metrics;
|
2023-02-10 14:22:40 +08:00
|
|
|
|
|
|
|
|
struct packet_io *ref_io;
|
|
|
|
|
struct global_metrics *ref_metrics;
|
|
|
|
|
struct policy_enforcer *ref_enforcer;
|
2023-02-17 17:45:39 +08:00
|
|
|
struct sce_ctx *ref_sce_ctx;
|
|
|
|
|
|
|
|
|
|
int session_table_need_reset;
|
2023-02-28 19:03:35 +08:00
|
|
|
int sf_metrics_need_send;
|
2023-02-10 14:22:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* Struct For Session
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
struct packet_info
|
|
|
|
|
{
|
|
|
|
|
int dir_is_e2i;
|
|
|
|
|
struct addr_tuple4 tuple4;
|
|
|
|
|
char *addr_string;
|
|
|
|
|
|
|
|
|
|
char *header_data;
|
|
|
|
|
int header_len;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct session_ctx
|
|
|
|
|
{
|
|
|
|
|
struct fixed_num_array policy_ids;
|
|
|
|
|
uint64_t session_id;
|
|
|
|
|
|
|
|
|
|
char raw_pkt_i2e_route_ctx[64];
|
|
|
|
|
char raw_pkt_e2i_route_ctx[64];
|
|
|
|
|
|
|
|
|
|
struct sids raw_pkt_i2e_sids;
|
|
|
|
|
struct sids raw_pkt_e2i_sids;
|
2023-02-21 09:58:31 +08:00
|
|
|
|
2023-02-10 14:22:40 +08:00
|
|
|
// depending on first control packet
|
|
|
|
|
struct packet_info first_ctrl_pkt;
|
|
|
|
|
struct selected_chaining *chaining;
|
2023-02-24 14:43:47 +08:00
|
|
|
|
|
|
|
|
struct thread_ctx *ref_thread_ctx;
|
2023-02-10 14:22:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct session_ctx *session_ctx_new();
|
|
|
|
|
void session_ctx_free(struct session_ctx *ctx);
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* Struct For SCE
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
struct sce_ctx
|
|
|
|
|
{
|
|
|
|
|
int firewall_sids;
|
|
|
|
|
int nr_worker_threads;
|
|
|
|
|
|
|
|
|
|
struct packet_io *io;
|
|
|
|
|
struct global_metrics *metrics;
|
|
|
|
|
struct policy_enforcer *enforcer;
|
|
|
|
|
struct thread_ctx work_threads[128];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct sce_ctx *sce_ctx_create(const char *profile);
|
|
|
|
|
void sce_ctx_destory(struct sce_ctx *ctx);
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|