暴露TSG_MASTER_INTERNAL_LABEL流标签,供外部插件使用,相应结构体 struct _internal_label
This commit is contained in:
@@ -53,6 +53,19 @@ struct _identify_info
|
|||||||
char domain[MAX_DOAMIN_LEN];
|
char domain[MAX_DOAMIN_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _internal_label
|
||||||
|
{
|
||||||
|
tsg_protocol_t proto;
|
||||||
|
long establish_latency_ms;
|
||||||
|
struct _asn_info *client_asn;
|
||||||
|
struct _asn_info *server_asn;
|
||||||
|
struct _location_info *client_location;
|
||||||
|
struct _location_info *server_location;
|
||||||
|
struct _subscribe_id_info *client_subscribe_id;
|
||||||
|
struct _subscribe_id_info *server_subscribe_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum _PULL_RESULT_TYPE
|
typedef enum _PULL_RESULT_TYPE
|
||||||
{
|
{
|
||||||
PULL_KNI_RESULT,
|
PULL_KNI_RESULT,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char TSG_MASTER_VERSION_20200608=0;
|
char TSG_MASTER_VERSION_20200609=0;
|
||||||
const char *tsg_conffile="tsgconf/main.conf";
|
const char *tsg_conffile="tsgconf/main.conf";
|
||||||
g_tsg_para_t g_tsg_para;
|
g_tsg_para_t g_tsg_para;
|
||||||
|
|
||||||
@@ -524,7 +524,6 @@ extern "C" char TSG_MASTER_TCP_ENTRY(struct streaminfo *a_tcp, void **pme, int t
|
|||||||
{
|
{
|
||||||
int ret=0,hit_num=0;
|
int ret=0,hit_num=0;
|
||||||
struct timespec tv;
|
struct timespec tv;
|
||||||
long establish_latency_ms=0;
|
|
||||||
int state=APP_STATE_GIVEME;
|
int state=APP_STATE_GIVEME;
|
||||||
scan_status_t mid=NULL;
|
scan_status_t mid=NULL;
|
||||||
Maat_rule_t *p_result=NULL;
|
Maat_rule_t *p_result=NULL;
|
||||||
@@ -541,35 +540,39 @@ extern "C" char TSG_MASTER_TCP_ENTRY(struct streaminfo *a_tcp, void **pme, int t
|
|||||||
|
|
||||||
memset(&identify_info, 0, sizeof(identify_info));
|
memset(&identify_info, 0, sizeof(identify_info));
|
||||||
identify_application_protocol(a_tcp, &identify_info, a_packet);
|
identify_application_protocol(a_tcp, &identify_info, a_packet);
|
||||||
|
|
||||||
|
internal_label=(struct _internal_label *)dictator_malloc(1, sizeof(struct _internal_label));
|
||||||
|
memset(internal_label, 0, sizeof(struct _internal_label));
|
||||||
|
internal_label->proto=identify_info.proto;
|
||||||
|
|
||||||
if(identify_info.proto==PROTO_HTTP)
|
if(identify_info.proto==PROTO_HTTP)
|
||||||
{
|
{
|
||||||
internal_label=(struct _internal_label *)dictator_malloc(1, sizeof(struct _internal_label));
|
|
||||||
memset(internal_label, 0, sizeof(struct _internal_label));
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &tv);
|
clock_gettime(CLOCK_REALTIME, &tv);
|
||||||
internal_label->establish_latency_ms=(tv.tv_sec-a_tcp->ptcpdetail->createtime)*1000+tv.tv_nsec/1000/1000;
|
internal_label->establish_latency_ms=(tv.tv_sec-a_tcp->ptcpdetail->createtime)*1000+tv.tv_nsec/1000/1000;
|
||||||
|
}
|
||||||
ret=project_req_add_struct(a_tcp, g_tsg_para.internal_project_id, (const void *)internal_label);
|
|
||||||
if(ret<0)
|
ret=project_req_add_struct(a_tcp, g_tsg_para.internal_project_id, (const void *)internal_label);
|
||||||
{
|
if(ret<0)
|
||||||
MESA_handle_runtime_log(g_tsg_para.logger,
|
{
|
||||||
RLOG_LV_FATAL,
|
MESA_handle_runtime_log(g_tsg_para.logger,
|
||||||
"PROJECT_ADD",
|
RLOG_LV_FATAL,
|
||||||
"Add policy_priority_label failed, establish latency ms: %llu addr: %s",
|
"PROJECT_ADD",
|
||||||
establish_latency_ms,
|
"Add internal_label failed, establish latency ms: %llu proto: %d addr: %s",
|
||||||
printaddr(&a_tcp->addr, thread_seq)
|
internal_label->establish_latency_ms,
|
||||||
);
|
internal_label->proto,
|
||||||
}
|
printaddr(&a_tcp->addr, thread_seq)
|
||||||
else
|
);
|
||||||
{
|
}
|
||||||
MESA_handle_runtime_log(g_tsg_para.logger,
|
else
|
||||||
RLOG_LV_DEBUG,
|
{
|
||||||
"PROJECT_ADD",
|
MESA_handle_runtime_log(g_tsg_para.logger,
|
||||||
"Add policy_priority_label successfully, establish latency ms: %llu addr: %s",
|
RLOG_LV_DEBUG,
|
||||||
establish_latency_ms,
|
"PROJECT_ADD",
|
||||||
printaddr(&a_tcp->addr, thread_seq)
|
"Add internal_label successfully, establish latency ms: %llu proto: %d addr: %s",
|
||||||
);
|
internal_label->establish_latency_ms,
|
||||||
}
|
internal_label->proto,
|
||||||
|
printaddr(&a_tcp->addr, thread_seq)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret=tsg_scan_nesting_addr(g_tsg_maat_feather, a_tcp, identify_info.proto, &mid, all_result+hit_num, MAX_RESULT_NUM-hit_num);
|
ret=tsg_scan_nesting_addr(g_tsg_maat_feather, a_tcp, identify_info.proto, &mid, all_result+hit_num, MAX_RESULT_NUM-hit_num);
|
||||||
@@ -729,6 +732,7 @@ extern "C" char TSG_MASTER_UDP_ENTRY(struct streaminfo *a_udp, void **pme, int t
|
|||||||
Maat_rule_t result[MAX_RESULT_NUM]={0};
|
Maat_rule_t result[MAX_RESULT_NUM]={0};
|
||||||
struct _identify_info identify_info;
|
struct _identify_info identify_info;
|
||||||
struct _master_context *_context=(struct _master_context *)*pme;
|
struct _master_context *_context=(struct _master_context *)*pme;
|
||||||
|
struct _internal_label *internal_label=NULL;
|
||||||
|
|
||||||
switch(a_udp->opstate)
|
switch(a_udp->opstate)
|
||||||
{
|
{
|
||||||
@@ -736,6 +740,32 @@ extern "C" char TSG_MASTER_UDP_ENTRY(struct streaminfo *a_udp, void **pme, int t
|
|||||||
memset(&identify_info, 0, sizeof(identify_info));
|
memset(&identify_info, 0, sizeof(identify_info));
|
||||||
identify_application_protocol(a_udp, &identify_info, a_packet);
|
identify_application_protocol(a_udp, &identify_info, a_packet);
|
||||||
|
|
||||||
|
internal_label=(struct _internal_label *)dictator_malloc(1, sizeof(struct _internal_label));
|
||||||
|
memset(internal_label, 0, sizeof(struct _internal_label));
|
||||||
|
internal_label->proto=identify_info.proto;
|
||||||
|
|
||||||
|
ret=project_req_add_struct(a_udp, g_tsg_para.internal_project_id, (const void *)internal_label);
|
||||||
|
if(ret<0)
|
||||||
|
{
|
||||||
|
MESA_handle_runtime_log(g_tsg_para.logger,
|
||||||
|
RLOG_LV_FATAL,
|
||||||
|
"PROJECT_ADD",
|
||||||
|
"Add internal_label failed, proto: %d addr: %s",
|
||||||
|
internal_label->proto,
|
||||||
|
printaddr(&a_udp->addr, thread_seq)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MESA_handle_runtime_log(g_tsg_para.logger,
|
||||||
|
RLOG_LV_DEBUG,
|
||||||
|
"PROJECT_ADD",
|
||||||
|
"Add internal_label successfully, proto: %d addr: %s",
|
||||||
|
internal_label->proto,
|
||||||
|
printaddr(&a_udp->addr, thread_seq)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ret=tsg_scan_nesting_addr(g_tsg_maat_feather, a_udp, identify_info.proto, &mid, result, MAX_RESULT_NUM);
|
ret=tsg_scan_nesting_addr(g_tsg_maat_feather, a_udp, identify_info.proto, &mid, result, MAX_RESULT_NUM);
|
||||||
if(ret>0)
|
if(ret>0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,19 +101,6 @@ struct _subscribe_id_info
|
|||||||
char subscribe_id[256];
|
char subscribe_id[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct _internal_label
|
|
||||||
{
|
|
||||||
long establish_latency_ms;
|
|
||||||
struct _asn_info *client_asn;
|
|
||||||
struct _asn_info *server_asn;
|
|
||||||
struct _location_info *client_location;
|
|
||||||
struct _location_info *server_location;
|
|
||||||
struct _subscribe_id_info *client_subscribe_id;
|
|
||||||
struct _subscribe_id_info *server_subscribe_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _policy_priority_label
|
typedef struct _policy_priority_label
|
||||||
{
|
{
|
||||||
tsg_protocol_t proto; //enum _tsg_protocol (tsg_types.h)
|
tsg_protocol_t proto; //enum _tsg_protocol (tsg_types.h)
|
||||||
|
|||||||
Reference in New Issue
Block a user