增加获取全局流ID的接口
调整总控注册为TCP入口
This commit is contained in:
@@ -110,7 +110,7 @@ static Maat_rule_t *tsg_policy_decision_criteria(Maat_rule_t *result, int result
|
||||
return p_result;
|
||||
}
|
||||
|
||||
extern "C" char TSG_MASTER_TCPALL_ENTRY(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet)
|
||||
extern "C" char TSG_MASTER_TCP_ENTRY(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet)
|
||||
{
|
||||
int send_log=0,identify_flag=0;
|
||||
int ret=0,hit_num=0,ip_policy=0;
|
||||
@@ -126,15 +126,10 @@ extern "C" char TSG_MASTER_TCPALL_ENTRY(struct streaminfo *a_tcp, void **pme, in
|
||||
Maat_rule_t all_result[MAX_RESULT_NUM];
|
||||
policy_priority_label_t *priority_label=NULL;
|
||||
|
||||
switch(a_tcp->pktstate)
|
||||
switch(a_tcp->opstate)
|
||||
{
|
||||
case OP_STATE_PENDING:
|
||||
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_LINKS], 0, FS_OP_ADD, 1);
|
||||
case OP_STATE_DATA:
|
||||
if((a_tcp->ptcpdetail->pdata==NULL) || (a_tcp->ptcpdetail->datalen<=0) || (a_tcp->dir==DIR_DOUBLE && a_tcp->curdir==DIR_S2C))
|
||||
{
|
||||
return APP_STATE_GIVEME;
|
||||
}
|
||||
|
||||
ret=tsg_scan_nesting_addr(g_tsg_maat_feather, a_tcp, PROTO_MAX, &mid, all_result+hit_num, MAX_RESULT_NUM-hit_num);
|
||||
if(ret>0)
|
||||
@@ -144,26 +139,22 @@ extern "C" char TSG_MASTER_TCPALL_ENTRY(struct streaminfo *a_tcp, void **pme, in
|
||||
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HIT_ADDR], 0, FS_OP_ADD, 1);
|
||||
}
|
||||
|
||||
|
||||
if(a_tcp->curdir==DIR_C2S)
|
||||
memset(&identify_info, 0, sizeof(identify_info));
|
||||
|
||||
ret=tsg_scan_shared_policy(g_tsg_maat_feather,
|
||||
a_tcp->ptcpdetail->pdata,
|
||||
a_tcp->ptcpdetail->datalen,
|
||||
all_result+hit_num,
|
||||
MAX_RESULT_NUM-hit_num,
|
||||
&identify_info,
|
||||
&mid,
|
||||
g_tsg_para.logger,
|
||||
thread_seq);
|
||||
if(ret>0)
|
||||
{
|
||||
memset(&identify_info, 0, sizeof(identify_info));
|
||||
|
||||
ret=tsg_scan_shared_policy(g_tsg_maat_feather,
|
||||
a_tcp->ptcpdetail->pdata,
|
||||
a_tcp->ptcpdetail->datalen,
|
||||
all_result+hit_num,
|
||||
MAX_RESULT_NUM-hit_num,
|
||||
&identify_info,
|
||||
&mid,
|
||||
g_tsg_para.logger,
|
||||
thread_seq);
|
||||
if(ret>0)
|
||||
{
|
||||
hit_num+=ret;
|
||||
identify_flag=1;
|
||||
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HIT_SHARE], 0, FS_OP_ADD, 1);
|
||||
}
|
||||
hit_num+=ret;
|
||||
identify_flag=1;
|
||||
FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_HIT_SHARE], 0, FS_OP_ADD, 1);
|
||||
}
|
||||
|
||||
p_result=tsg_policy_decision_criteria(all_result, hit_num);
|
||||
@@ -239,6 +230,7 @@ extern "C" char TSG_MASTER_TCPALL_ENTRY(struct streaminfo *a_tcp, void **pme, in
|
||||
tsg_send_log(g_tsg_log_instance, TLD_handle, &log_msg, thread_seq);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OP_STATE_DATA:
|
||||
case OP_STATE_CLOSE:
|
||||
default:
|
||||
@@ -272,6 +264,7 @@ extern "C" int TSG_MASTER_INIT()
|
||||
printf("MESA_create_runtime_log_handle failed ...\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
MESA_load_profile_int_def(tsg_conffile, "SYSTEM", "DEVICE_ID", &g_tsg_para.device_id, 0);
|
||||
|
||||
MESA_load_profile_string_def(tsg_conffile, "SYSTEM", "POLICY_PRIORITY_LABEL", label_buff, sizeof(label_buff), "POLICY_PRIORITY");
|
||||
|
||||
@@ -35,6 +35,7 @@ typedef struct _policy_priority_label
|
||||
|
||||
typedef struct _tsg_para
|
||||
{
|
||||
int device_id;
|
||||
int ip_addr_table_id;
|
||||
int subscribe_id_table_id;
|
||||
int priority_project_id;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "tsg_send_log.h"
|
||||
#include "tsg_send_log_internal.h"
|
||||
|
||||
char TSG_SEND_LOG_VERSION_20191119=0;
|
||||
char TSG_SEND_LOG_VERSION_20191120=0;
|
||||
tsg_log_instance_t g_tsg_log_instance;
|
||||
|
||||
const id2field_t tld_type[TLD_TYPE_MAX]={{TLD_TYPE_UNKNOWN, TLD_TYPE_UNKNOWN, "UNKOWN"},
|
||||
@@ -30,6 +30,22 @@ const id2field_t tld_type[TLD_TYPE_MAX]={{TLD_TYPE_UNKNOWN, TLD_TYPE_UNKNOWN, "
|
||||
|
||||
extern "C" int MESA_get_dev_ipv4(const char *device, int *ip_add);
|
||||
|
||||
|
||||
unsigned long long tsg_get_stream_id(struct streaminfo * a_stream)
|
||||
{
|
||||
int ret=0;
|
||||
int device_id_size=sizeof(unsigned long long);
|
||||
unsigned long long device_id=(unsigned long long)g_tsg_para.device_id;
|
||||
|
||||
ret=MESA_get_stream_opt(a_stream, MSO_GLOBAL_STREAM_ID, (void *)device_id, &device_id_size);
|
||||
if(ret==0)
|
||||
{
|
||||
return device_id;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TLD_cancel(TLD_handle_t handle)
|
||||
{
|
||||
int thread_id=0;
|
||||
@@ -159,6 +175,11 @@ int TLD_append_streaminfo(struct _tsg_log_instance *_instance, struct _tld_handl
|
||||
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_STREAM_DIR].name, (void *)(long)a_stream->dir, TLD_TYPE_LONG);
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_ADDRESS_TYPE].name, (void *)(long)addr_type, TLD_TYPE_LONG);
|
||||
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_C2S_PKT_NUM].name, (void *)(long)a_stream->ptcpdetail->clientpktnum, TLD_TYPE_LONG);
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_C2S_BYTE_NUM].name, (void *)(long)a_stream->ptcpdetail->clientbytes, TLD_TYPE_LONG);
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_S2C_PKT_NUM].name, (void *)(long)a_stream->ptcpdetail->serverpktnum, TLD_TYPE_LONG);
|
||||
TLD_append((TLD_handle_t)_handle, _instance->id2field[LOG_COMMON_S2C_BYTE_NUM].name, (void *)(long)a_stream->ptcpdetail->serverbytes, TLD_TYPE_LONG);
|
||||
|
||||
|
||||
addr_proto=(char *)layer_addr_prefix_ntop(a_stream);
|
||||
|
||||
Reference in New Issue
Block a user