diff options
| author | 刘学利 <[email protected]> | 2023-08-06 10:45:19 +0000 |
|---|---|---|
| committer | 刘学利 <[email protected]> | 2023-08-06 10:45:19 +0000 |
| commit | 79ca2d2ac4150af89807928370e79a4d84a016f7 (patch) | |
| tree | f05b637477aa53a9d77c3decce87a85f913e2852 /inc | |
| parent | e089f98c5a01532fc4c72536fbce55455969ed06 (diff) | |
TSG-16060: 支持statistics policyv6.1.0
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/statistics_metrics.h | 39 | ||||
| -rw-r--r-- | inc/tsg_label.h | 1 | ||||
| -rw-r--r-- | inc/tsg_rule.h | 4 | ||||
| -rw-r--r-- | inc/tsg_send_log.h | 2 | ||||
| -rw-r--r-- | inc/tsg_statistic.h | 15 |
5 files changed, 57 insertions, 4 deletions
diff --git a/inc/statistics_metrics.h b/inc/statistics_metrics.h new file mode 100644 index 0000000..290e67c --- /dev/null +++ b/inc/statistics_metrics.h @@ -0,0 +1,39 @@ +#pragma once + +enum STATISTICS_DIMENSION +{ + DIMENSION_MAAT_RULE=0, + DIMENSION_MAAT_STATE, + DIMENSION_FQDN, + DIMENSION_CATEGORY_ID, + DIMENSION_APPLICATION, + DIMENSION_MAX +}; + +#ifndef MAX_CATEGORY_ID_NUM +#define MAX_CATEGORY_ID_NUM 8 +#endif +struct server_fqdn_category +{ + int n_ids; + unsigned int ids[MAX_CATEGORY_ID_NUM]; +}; + +struct statistics_dimensions +{ + enum STATISTICS_DIMENSION type; + union + { + char *server_fqdn; + char *application; + struct maat_state *maat_state; + struct matched_policy_rules *policy; + struct server_fqdn_category *category; + }; +}; + +int session_dimension_server_fqdn_sync(const struct streaminfo *a_stream, char *server_fqdn); +int session_dimension_application_sync(const struct streaminfo *a_stream, char *application); +int session_dimension_maat_state_sync(const struct streaminfo *a_stream, struct maat_state *state); +int session_dimension_maat_rule_sync(const struct streaminfo *a_stream, struct matched_policy_rules *policy); +int session_dimension_category_id_sync(const struct streaminfo *a_stream, unsigned int *category_id, int n_category_id); diff --git a/inc/tsg_label.h b/inc/tsg_label.h index 47fc406..8e371e8 100644 --- a/inc/tsg_label.h +++ b/inc/tsg_label.h @@ -2,7 +2,6 @@ #include <stddef.h> -#define MAX_CATEGORY_ID_NUM 8 #define MAX_STR_FIELD_LEN 64 #define MAX_VLAN_ID_NUM 32 diff --git a/inc/tsg_rule.h b/inc/tsg_rule.h index 9a0b632..927b38c 100644 --- a/inc/tsg_rule.h +++ b/inc/tsg_rule.h @@ -12,7 +12,8 @@ #define TSG_ACTION_S_CHAINING 0x40 #define TSG_ACTION_BYPASS 0x60 #define TSG_ACTION_SHUNT 0x80 -#define TSG_ACTION_MAX 0x80 +#define TSG_ACTION_STATISTICS 0x81 +#define TSG_ACTION_MAX 0x81 enum TSG_SERVICE { @@ -22,6 +23,7 @@ enum TSG_SERVICE TSG_SERVICE_SHAPING=6, TSG_SERVICE_PRE_SIGNATURE=7, TSG_SERVICE_SIGNATURE=8, + TSG_SERVICE_STATISTICS=10, TSG_SERVICE_MAX }; diff --git a/inc/tsg_send_log.h b/inc/tsg_send_log.h index 5951be8..5de883f 100644 --- a/inc/tsg_send_log.h +++ b/inc/tsg_send_log.h @@ -47,7 +47,7 @@ int TLD_append_streaminfo(struct tsg_log_instance_t *instance, struct TLD_handle int TLD_cancel(struct TLD_handle_t *handle); //return topic_id; return >=0 if success,otherwise return -1; -int tsg_register_topic(struct tsg_log_instance_t *instance, const char *topic_name); +int tsg_register_topic(struct tsg_log_instance_t *instance, char *topic_name); int tsg_send_payload(struct tsg_log_instance_t *instance, int topic_id, char *payload, int payload_len, int thread_id); int tsg_send_log(struct tsg_log_instance_t *instance, struct TLD_handle_t *handle, const struct streaminfo *a_stream, enum LOG_TYPE log_type, struct maat_rule *rules, size_t n_rules, int thread_id); diff --git a/inc/tsg_statistic.h b/inc/tsg_statistic.h index 976f7ce..42d6272 100644 --- a/inc/tsg_statistic.h +++ b/inc/tsg_statistic.h @@ -28,7 +28,7 @@ struct traffic_packet_info uint64_t c2s_pkts; uint64_t s2c_pkts; uint64_t c2s_fragments; - uint64_t s2c_fragments; + uint64_t s2c_fragments; uint64_t c2s_tcp_ooorder_pkts; uint64_t s2c_tcp_ooorder_pkts; uint64_t c2s_tcp_retransmitted_pkts; @@ -49,4 +49,17 @@ int tsg_set_statistic_opt(int value, enum _STATISTIC_OPT_TYPE type, int thread_s int tsg_set_application_metrics(const struct streaminfo *a_stream, const char *l4_protocol, const char *app_full_path, struct traffic_packet_info *app_statis, int thread_seq); +//statistics policy +int tsg_set_statistics_policy(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); + +int tsg_set_statistics_fqdn(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); +int tsg_set_statistics_fqdn_category(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); +int tsg_set_statistics_client_object(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); +int tsg_set_statistics_server_object(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); +int tsg_set_statistics_application(const struct streaminfo *a_stream, struct maat_rule *p_result, int thread_seq); + +// statistics object +int tsg_set_statistics_object(const struct streaminfo *a_stream, struct maat_hit_group *group, long long *item_id, int n_item_id, int thread_seq); + + #endif |
