为了保证pinnigl链接计数时间与intecept的链接计数时间保持一致,提供tsg_set_intercept_flow函数
This commit is contained in:
@@ -1,6 +1,16 @@
|
|||||||
#ifndef __TSG_STATISTIC_H__
|
#ifndef __TSG_STATISTIC_H__
|
||||||
#define __TSG_STATISTIC_H__
|
#define __TSG_STATISTIC_H__
|
||||||
|
|
||||||
|
struct _traffic_info
|
||||||
|
{
|
||||||
|
long long con_num;
|
||||||
|
long long in_bytes;
|
||||||
|
long long out_bytes;
|
||||||
|
long long in_packets;
|
||||||
|
long long out_packets;
|
||||||
|
};
|
||||||
|
|
||||||
int tsg_set_policy_flow(struct streaminfo *a_stream, Maat_rule_t *p_result, int thread_seq);
|
int tsg_set_policy_flow(struct streaminfo *a_stream, Maat_rule_t *p_result, int thread_seq);
|
||||||
|
int tsg_set_intercept_flow(Maat_rule_t *p_result, struct _traffic_info *traffic_info, int thread_seq);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -127,15 +127,6 @@ enum TRAFFIC_INFO_IDX
|
|||||||
TRAFFIC_INFO_MAX
|
TRAFFIC_INFO_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _traffic_info
|
|
||||||
{
|
|
||||||
long long con_num;
|
|
||||||
long long in_bytes;
|
|
||||||
long long out_bytes;
|
|
||||||
long long in_packets;
|
|
||||||
long long out_packets;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _tsg_statistic
|
typedef struct _tsg_statistic
|
||||||
{
|
{
|
||||||
int cycle;
|
int cycle;
|
||||||
|
|||||||
@@ -12,6 +12,24 @@
|
|||||||
|
|
||||||
tsg_statis_para_t g_tsg_statis_para;
|
tsg_statis_para_t g_tsg_statis_para;
|
||||||
|
|
||||||
|
int tsg_set_intercept_flow(Maat_rule_t *p_result, struct _traffic_info *traffic_info, int thread_seq)
|
||||||
|
{
|
||||||
|
struct _traffic_info *_info=NULL;
|
||||||
|
|
||||||
|
if(p_result!=NULL && traffic_info!=NULL && thread_seq>=0)
|
||||||
|
{
|
||||||
|
_info=&(g_tsg_statis_para.traffic_info[(unsigned char)p_result->action][thread_seq]);
|
||||||
|
|
||||||
|
_info->con_num+=traffic_info->con_num;
|
||||||
|
_info->in_bytes+=traffic_info->in_bytes;
|
||||||
|
_info->in_packets+=traffic_info->in_packets;
|
||||||
|
_info->out_bytes+=traffic_info->out_bytes;
|
||||||
|
_info->out_packets+=traffic_info->out_packets;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int tsg_set_policy_flow(struct streaminfo *a_stream, Maat_rule_t *p_result, int thread_seq)
|
int tsg_set_policy_flow(struct streaminfo *a_stream, Maat_rule_t *p_result, int thread_seq)
|
||||||
{
|
{
|
||||||
unsigned long long value=0;
|
unsigned long long value=0;
|
||||||
|
|||||||
Reference in New Issue
Block a user