96 lines
2.1 KiB
C
96 lines
2.1 KiB
C
#ifndef _SCE_H
|
|
#define _SCE_H
|
|
|
|
#ifdef __cpluscplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "policy.h"
|
|
#include "packet_io.h"
|
|
#include "session_table.h"
|
|
|
|
#define MAX_THREAD_NUM 128
|
|
|
|
/******************************************************************************
|
|
* Struct For Thread
|
|
******************************************************************************/
|
|
|
|
struct thread_ctx
|
|
{
|
|
pthread_t tid;
|
|
int thread_index;
|
|
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 sce_ctx *ref_sce_ctx;
|
|
|
|
int session_table_need_reset;
|
|
int sf_metrics_need_send;
|
|
int cpu_mask;
|
|
};
|
|
|
|
/******************************************************************************
|
|
* 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;
|
|
|
|
// depending on first control packet
|
|
struct packet_info first_ctrl_pkt;
|
|
struct selected_chaining *chaining;
|
|
|
|
struct thread_ctx *ref_thread_ctx;
|
|
};
|
|
|
|
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;
|
|
int enable_cpu_affinity;
|
|
int cpu_affinity_mask[MAX_THREAD_NUM];
|
|
|
|
struct packet_io *io;
|
|
struct global_metrics *metrics;
|
|
struct policy_enforcer *enforcer;
|
|
struct thread_ctx work_threads[MAX_THREAD_NUM];
|
|
};
|
|
|
|
struct sce_ctx *sce_ctx_create(const char *profile);
|
|
void sce_ctx_destory(struct sce_ctx *ctx);
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|