perf: 删除无效代码;修改变量命名;减少内存分配

This commit is contained in:
luwenpeng
2023-11-23 16:52:06 +08:00
parent cbac7fea29
commit bda50d79af
19 changed files with 2937 additions and 472 deletions

View File

@@ -112,16 +112,10 @@ struct selected_chaining
char *session_addr;
};
struct selected_chainings
{
struct selected_chaining *chaining_raw;
struct selected_chaining *chaining_decrypted;
};
const char *traffic_type_to_string(enum traffic_type traffic_type);
const char *forward_type_to_string(enum forward_type forward_type);
const char *action_desc_to_string(enum action_desc action_desc);
const char *encapsulate_method_to_string(enum encapsulate_method encap_method);
const char *traffic_type_tostring(enum traffic_type traffic_type);
const char *forward_type_tostring(enum forward_type forward_type);
const char *action_desc_tostring(enum action_desc action_desc);
const char *encapsulate_method_tostring(enum encapsulate_method encap_method);
struct selected_chaining *selected_chaining_create(int chaining_size, uint64_t session_id, char *session_addr);
void selected_chaining_destory(struct selected_chaining *chaining);
@@ -131,14 +125,16 @@ void selected_chaining_uniq(struct selected_chaining *chaining);
// return NULL : error
// return !NULL : success
struct policy_enforcer *policy_enforcer_create(const char *instance, const char *profile, int thread_num, void *logger);
struct policy_enforcer *policy_enforcer_create(const char *instance, const char *profile, int thread_num);
void policy_enforcer_destory(struct policy_enforcer *enforcer);
// return 0 : success
// return -1 : error
int policy_enforcer_register(struct policy_enforcer *enforcer);
int policy_enforce_chaining_size(struct policy_enforcer *enforcer);
void policy_enforce_select_chainings(struct policy_enforcer *enforcer, struct selected_chainings *chainings, struct session_ctx *s_ctx, struct packet *data_pkt, uint64_t rule_id, int dir_is_i2e);
// direction 1: E2I
// direction 0: I2E
void policy_enforce_select_chainings(struct policy_enforcer *enforcer, struct session_ctx *s_ctx, struct packet *data_pkt, uint64_t rule_id, int direction);
#ifdef __cpluscplus
}