TSG-22707 tfe adapts to maat interface changes

This commit is contained in:
fengweihao
2024-09-29 20:01:49 +08:00
parent a94b7d55b5
commit a032f97535
16 changed files with 909 additions and 1361 deletions

View File

@@ -125,7 +125,7 @@ static int http_lua_log_debug(struct elua_vm *vm)
p += snprintf(p, sizeof(buff) - (p - buff), " %s", in);
}
TFE_LOG_DEBUG(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, message:%20s", tsg_ctx->config_id, tsg_ctx->profile_id, buff);
TFE_LOG_DEBUG(tsg_ctx->local_logger, "policy_id:%s, profile_id:%s, message:%20s", tsg_ctx->config_uuid_str, tsg_ctx->profile_uuid_str, buff);
http_free_params(out_lua_argv);
return 1;
@@ -161,7 +161,7 @@ static int http_lua_log_info(struct elua_vm *vm)
p += snprintf(p, sizeof(buff) - (p - buff), " %s", in);
}
TFE_LOG_INFO(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, message:%s", tsg_ctx->config_id, tsg_ctx->profile_id, buff);
TFE_LOG_INFO(tsg_ctx->local_logger, "policy_id:%s, profile_id:%s, message:%s", tsg_ctx->config_uuid_str, tsg_ctx->profile_uuid_str, buff);
http_free_params(out_lua_argv);
return 1;
@@ -197,7 +197,7 @@ static int http_lua_log_error(struct elua_vm *vm)
p += snprintf(p, sizeof(buff) - (p - buff), " %s", in);
}
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, message:%s", tsg_ctx->config_id, tsg_ctx->profile_id, buff);
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%s, profile_id:%s, message:%s", tsg_ctx->config_uuid_str, tsg_ctx->profile_uuid_str, buff);
http_free_params(out_lua_argv);
return 1;
@@ -683,7 +683,7 @@ static int http_lua_get_body(struct elua_vm *vm)
if(tsg_ctx->http_body == NULL)
{
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, message:%s", tsg_ctx->config_id, tsg_ctx->profile_id, "Can't to get req/resp body data");
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%s, profile_id:%s, message:%s", tsg_ctx->config_uuid_str, tsg_ctx->profile_uuid_str, "Can't to get req/resp body data");
return 0;
}
@@ -829,14 +829,14 @@ finish:
return 0;
}
size_t execute_lua_script_rule(struct tsg_lua_script *lua_script, int profile_id, struct elua_context *elua_ctx, unsigned int thread_id, void *user_data)
size_t execute_lua_script_rule(struct tsg_lua_script *lua_script, char *profile_uuid_str, struct elua_context *elua_ctx, unsigned int thread_id, void *user_data)
{
int ret=0;
char *profile_msg=NULL;
size_t msg_len=0; int timeout=0;
struct elua_script **escript=NULL;
ret=lua_script->http_lua_profile(profile_id, &escript, &profile_msg, &msg_len, &timeout);
ret=lua_script->http_lua_profile(profile_uuid_str, &escript, &profile_msg, &msg_len, &timeout);
if(ret<0)
{
return ret;
@@ -856,7 +856,7 @@ size_t execute_lua_script_rule(struct tsg_lua_script *lua_script, int profile_id
struct tsg_script_ctx *tsg_ctx= (struct tsg_script_ctx *)user_data;
if(tsg_ctx != NULL && tsg_ctx->local_logger != NULL)
{
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%d, profile_id:%d, error_code:%d, error: %s", tsg_ctx->config_id, tsg_ctx->profile_id, ret, elua_get_last_error_string(lua_script->http_lua_handle[thread_id]));
TFE_LOG_ERROR(tsg_ctx->local_logger, "policy_id:%s, profile_id:%s, error_code:%d, error: %s", tsg_ctx->config_uuid_str, tsg_ctx->profile_uuid_str, ret, elua_get_last_error_string(lua_script->http_lua_handle[thread_id]));
}
}
if(profile_msg != NULL)