TSG-10006: 兼容三、四级(N)地址库

This commit is contained in:
liuxueli
2022-05-18 11:41:41 +08:00
parent f7c0f018be
commit 4899c9e96a
3 changed files with 45 additions and 10 deletions

View File

@@ -406,6 +406,8 @@ const void *get_struct_project(const struct streaminfo *a_stream, int project_id
//parent_app_name.app_name
int tsg_app_id2name(int app_id, char *app_name, int app_name_len, int is_joint_parent);
//return 18 or 19: subdivision_addr
int tsg_get_location_type(void);
void location_free_data(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp);
void ASN_number_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp);
void subscriber_id_free(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void* argp);

View File

@@ -2930,3 +2930,8 @@ int tsg_set_fqdn_category_id(const struct streaminfo *a_stream, unsigned int *ca
return 0;
}
int tsg_get_location_type(void)
{
return g_tsg_para.location_field_num;
}

View File

@@ -348,6 +348,17 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea
return 0;
}
int location_type=tsg_get_location_type();
switch(location_type)
{
case 18:
len+=string_cat(buff+len, buff_len-len, location_info->city_full);
buff[len++]=',';
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
buff[len++]=',';
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
break;
case 19:
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
buff[len++]='.';
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
@@ -359,6 +370,10 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea
buff[len++]='.';
len+=string_cat(buff+len, buff_len-len, location_info->subdivision_addr);
}
break;
default:
return 0;
}
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
@@ -2074,8 +2089,21 @@ int tsg_send_payload(struct tsg_log_instance_t *instance, int topic_id, char *pa
);
return -1;
}
else
{
update_percent(_instance, topic_id, LOG_COLUMN_STATUS_SUCCESS, thread_id);
MESA_handle_runtime_log(_instance->logger,
RLOG_LV_DEBUG,
"TSG_SEND_LOG",
"log send successfully %s: %s",
_instance->service2topic[topic_id].name,
payload
);
}
update_percent(_instance, topic_id, LOG_COLUMN_STATUS_MAX, thread_id);
return 0;