2020-08-19 16:56:10 +08:00
|
|
|
#ifndef __TSG_LABEL_H__
|
|
|
|
|
#define __TSG_LABEL_H__
|
|
|
|
|
|
2020-09-28 17:13:39 +08:00
|
|
|
#define MAX_CATEGORY_ID_NUM 8
|
2020-08-19 16:56:10 +08:00
|
|
|
#define MAX_STR_FIELD_LEN 64
|
|
|
|
|
|
2020-12-14 16:25:55 +06:00
|
|
|
#define MAX_RESULT_NUM 8
|
|
|
|
|
#define MAX_DOAMIN_LEN 2048
|
|
|
|
|
|
2020-08-19 16:56:10 +08:00
|
|
|
typedef enum _tsg_protocol
|
|
|
|
|
{
|
|
|
|
|
PROTO_UNKONWN=0,
|
|
|
|
|
PROTO_IPv4=1,
|
|
|
|
|
PROTO_IPv6,
|
|
|
|
|
PROTO_TCP,
|
|
|
|
|
PROTO_UDP,
|
|
|
|
|
PROTO_HTTP,
|
|
|
|
|
PROTO_MAIL,
|
|
|
|
|
PROTO_DNS,
|
|
|
|
|
PROTO_FTP,
|
|
|
|
|
PROTO_SSL,
|
|
|
|
|
PROTO_SIP,
|
|
|
|
|
PROTO_BGP,
|
|
|
|
|
PROTO_STREAMING_MEDIA,
|
|
|
|
|
PROTO_QUIC,
|
2020-08-24 16:37:20 +08:00
|
|
|
PROTO_SSH,
|
2020-09-02 19:44:15 +08:00
|
|
|
PROTO_SMTP,
|
|
|
|
|
PROTO_IMAP,
|
|
|
|
|
PROTO_POP3,
|
2020-08-19 16:56:10 +08:00
|
|
|
PROTO_MAX
|
|
|
|
|
}tsg_protocol_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct _asn_info_t
|
|
|
|
|
{
|
|
|
|
|
int ref_cnt;
|
|
|
|
|
int addr_type;
|
|
|
|
|
int table_id;
|
|
|
|
|
char start_ip[MAX_STR_FIELD_LEN];
|
|
|
|
|
char end_ip[MAX_STR_FIELD_LEN];
|
|
|
|
|
char asn[MAX_STR_FIELD_LEN];
|
|
|
|
|
char organization[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _location_info_t
|
|
|
|
|
{
|
|
|
|
|
int geoname_id;
|
|
|
|
|
int table_id;
|
|
|
|
|
int ref_cnt;
|
|
|
|
|
int addr_type;
|
|
|
|
|
double latitude;
|
|
|
|
|
double longitude;
|
|
|
|
|
double coords;
|
|
|
|
|
char start_ip[MAX_STR_FIELD_LEN];
|
|
|
|
|
char end_ip[MAX_STR_FIELD_LEN];
|
|
|
|
|
char language[MAX_STR_FIELD_LEN];
|
|
|
|
|
char continent_abbr[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char continent_full[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char country_abbr[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char country_full[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char province_abbr[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char province_full[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char city_full[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
char time_zone[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _subscribe_id_info_t
|
|
|
|
|
{
|
|
|
|
|
int ref_cnt;
|
|
|
|
|
int table_id;
|
|
|
|
|
char subscribe_id[MAX_STR_FIELD_LEN*4];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _session_attribute_label_t
|
|
|
|
|
{
|
2020-09-28 17:13:39 +08:00
|
|
|
int fqdn_category_id_num;
|
2020-08-19 16:56:10 +08:00
|
|
|
tsg_protocol_t proto;
|
|
|
|
|
long establish_latency_ms;
|
|
|
|
|
struct _asn_info_t *client_asn;
|
|
|
|
|
struct _asn_info_t *server_asn;
|
|
|
|
|
struct _location_info_t *client_location;
|
|
|
|
|
struct _location_info_t *server_location;
|
|
|
|
|
struct _subscribe_id_info_t *client_subscribe_id;
|
|
|
|
|
struct _subscribe_id_info_t *server_subscribe_id;
|
2020-09-11 18:06:09 +08:00
|
|
|
char *ja3_fingerprint;
|
2020-09-28 17:13:39 +08:00
|
|
|
unsigned int fqdn_category_id[MAX_CATEGORY_ID_NUM];
|
2020-08-19 16:56:10 +08:00
|
|
|
};
|
|
|
|
|
|
2020-12-14 16:25:55 +06:00
|
|
|
typedef struct _policy_priority_label
|
|
|
|
|
{
|
|
|
|
|
tsg_protocol_t proto; //enum _tsg_protocol (tsg_types.h)
|
|
|
|
|
int domain_len;
|
|
|
|
|
int result_type; //enum _PULL_RESULT_TYPE (tsg_rule.h)
|
|
|
|
|
int result_num;
|
|
|
|
|
char domain[MAX_DOAMIN_LEN];
|
|
|
|
|
Maat_rule_t result[MAX_RESULT_NUM];
|
|
|
|
|
}policy_priority_label_t;
|
|
|
|
|
|
2020-08-19 16:56:10 +08:00
|
|
|
#endif
|