fqdn服务划分接口适配修改
This commit is contained in:
@@ -13,9 +13,6 @@ struct maat_table_info
|
||||
{
|
||||
int id;
|
||||
const char *name;
|
||||
Maat_plugin_EX_new_func_t *new_func;
|
||||
Maat_plugin_EX_dup_func_t *dup_func;
|
||||
Maat_plugin_EX_free_func_t *free_func;
|
||||
};
|
||||
static Maat_feather_t static_maat = NULL;
|
||||
static tfe_kafka_logger_t *kafka_logger = NULL;
|
||||
@@ -235,16 +232,11 @@ finish:
|
||||
}
|
||||
|
||||
static struct maat_table_info maat_pub_tables[TABLE_TYPE_MAX] = {
|
||||
// TABLE_SECURITY_SOURCE_ASN
|
||||
{0, "TSG_SECURITY_SOURCE_ASN", NULL, NULL, NULL},
|
||||
// TABLE_SECURITY_DESTINATION_ASN
|
||||
{0, "TSG_SECURITY_DESTINATION_ASN", NULL, NULL, NULL},
|
||||
// TABLE_SECURITY_SOURCE_LOCATION
|
||||
{0, "TSG_SECURITY_SOURCE_LOCATION", NULL, NULL, NULL},
|
||||
// TABLE_SECURITY_DESTINATION_LOCATION
|
||||
{0, "TSG_SECURITY_DESTINATION_LOCATION", NULL, NULL, NULL},
|
||||
// TABLE_OBJ_SUBSCRIBER_ID
|
||||
{0, "TSG_OBJ_SUBSCRIBER_ID", NULL, NULL, NULL}};
|
||||
{0, "TSG_SECURITY_SOURCE_ASN"},
|
||||
{0, "TSG_SECURITY_DESTINATION_ASN"},
|
||||
{0, "TSG_SECURITY_SOURCE_LOCATION"},
|
||||
{0, "TSG_SECURITY_DESTINATION_LOCATION"},
|
||||
{0, "TSG_OBJ_SUBSCRIBER_ID"}};
|
||||
|
||||
static int register_maat_table()
|
||||
{
|
||||
@@ -256,12 +248,6 @@ static int register_maat_table()
|
||||
TFE_LOG_ERROR(g_default_logger, "Maat table %s register failed.", maat_pub_tables[i].name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (maat_pub_tables[i].new_func || maat_pub_tables[i].dup_func || maat_pub_tables[i].free_func)
|
||||
{
|
||||
Maat_ip_plugin_EX_register(static_maat, maat_pub_tables[i].id, maat_pub_tables[i].new_func,
|
||||
maat_pub_tables[i].free_func, maat_pub_tables[i].dup_func, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -67,6 +67,49 @@ int tfe_scan_subscribe_id(const struct tfe_stream *stream, struct Maat_rule_t *r
|
||||
return hit_cnt_ip;
|
||||
}
|
||||
|
||||
int tfe_scan_fqdn_cat(const struct tfe_stream *stream, struct Maat_rule_t *result, scan_status_t *scan_mid,
|
||||
int hit_cnt, unsigned int thread_id, void *logger, int table_id)
|
||||
{
|
||||
int scan_ret = 0, i, fqdn_len =0;
|
||||
uint16_t opt_out_size;
|
||||
int category_num = 0, hit_cnt_fqdn = 0;
|
||||
char category_id_num[24] = {0};
|
||||
char category_id_val[TFE_SYMBOL_MAX] = {0};
|
||||
|
||||
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
||||
if (cmsg != NULL)
|
||||
{
|
||||
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_FQDN_ID, (unsigned char *)category_id_val, sizeof(category_id_val), &opt_out_size);
|
||||
if (scan_ret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "fetch fqdn cat id from cmsg failed, ret: %d", scan_ret);
|
||||
}
|
||||
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_FQDN_NUM, (unsigned char *)category_id_num, sizeof(category_id_num), &opt_out_size);
|
||||
if (scan_ret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "fetch fqdn cat id from cmsg failed, ret: %d", scan_ret);
|
||||
}
|
||||
category_num = atoll(category_id_num);
|
||||
}
|
||||
|
||||
for(i = 0; i< category_num && i < 8; i++)
|
||||
{
|
||||
int fqdn_id =0;
|
||||
char fqdn_val[16]={0};
|
||||
|
||||
snprintf(fqdn_val, sizeof(int), "%s", category_id_val + fqdn_len);
|
||||
fqdn_id = atoi(fqdn_val);
|
||||
scan_ret=Maat_scan_intval(tfe_bussiness_resouce_get(STATIC_MAAT), table_id, fqdn_id, result + hit_cnt + hit_cnt_fqdn,
|
||||
MAX_SCAN_RESULT-hit_cnt-hit_cnt_fqdn, scan_mid, (int) thread_id);
|
||||
if(scan_ret>0)
|
||||
{
|
||||
hit_cnt_fqdn+=scan_ret;
|
||||
}
|
||||
fqdn_len += sizeof(int);
|
||||
}
|
||||
return hit_cnt_fqdn;
|
||||
}
|
||||
|
||||
int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *result, scan_status_t *scan_mid,
|
||||
int hit_cnt, unsigned int thread_id, void *logger, const char *addr, char **location_server, char **location_client)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user