[Feature][ZXW-33]merge ZXW 0428 version
Change-Id: I11f167edfea428d9fab198ff00ff1364932d1b0b
diff --git a/ap/app/zte_comm/sntp/sntp.c b/ap/app/zte_comm/sntp/sntp.c
index 61c5dc0..976f610 100755
--- a/ap/app/zte_comm/sntp/sntp.c
+++ b/ap/app/zte_comm/sntp/sntp.c
@@ -110,7 +110,7 @@
strncpy(buf, "error other", sizeof(buf) - 1);
}
//sc_cfg_set(SNTP_ERROR_STATE,buf);
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_set_error_state: %s \n", buf);
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_set_error_state: %s \n", buf);
}
void zte_sntp_set_process_result(int result)
@@ -134,12 +134,12 @@
g_sntp_success_count++;
sc_cfg_set("need_clear_traffic_data", "yes");//½â¾öÈç¹ûÉ豸ͨµçʱ¼äûÓдﵽһÌì´¥·¢sntp£¬ÔÚ¿çÔµÄʱºò¾Í²»ÄÜÇå³ýÔÂÁ÷Á¿Í³¼Æ
- slog(MISC_PRINT, SLOG_NORMAL,"[SNTP] zte_sntp_set_process_result = success \r\n");
+ slog(MISC_PRINT, SLOG_NORMAL,"[SNTP] sntp_set_process_result = success \r\n");
zte_sntp_success_notify();
} else {
sc_cfg_set(SNTP_PROCESS_RESULT, "failure");
//sc_cfg_set(SNTP_SYN_DONE, "0");
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_set_process_result = fail \r\n");
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_set_process_result = fail \r\n");
}
time(&now_time);//ÒÔÃëΪµ¥Î»
@@ -173,7 +173,7 @@
int ip_index = 0;
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_get_group_addr_by_name start\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_get_group_addr_by_name start\n");
struct addrinfo hints = { 0 };
struct addrinfo *result = NULL;
@@ -219,7 +219,7 @@
}
}
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_get_group_addr_by_name, get ip count = %d \n", ip_index);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_get_group_addr_by_name, get ip count = %d \n", ip_index);
freeaddrinfo(result);
return (ip_index == 0) ? SNTP_RESULT_FAIL : ip_index;
@@ -240,11 +240,11 @@
snprintf(ntp_server_name, sizeof(ntp_server_name), "sntp_other_server%d", server_index);
sc_cfg_get(ntp_server_name, ntp_server, max_len);
}
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_get_ntp_server, %s == %s\n", ntp_server_name, ntp_server);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_get_ntp_server, %s == %s\n", ntp_server_name, ntp_server);
}
if (ntp_server[0] == '\0') {
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_get_ntp_server, ntpServer == NULL, server_index = %d \n", server_index);
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_get_ntp_server, ntpServer == NULL, server_index = %d \n", server_index);
return SNTP_RESULT_INVALID_SERVER;
}
@@ -264,10 +264,10 @@
if (result != SNTP_RESULT_OK) {
return SNTP_RESULT_FAIL;
}
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_get_one_ntp_server_ip, ntp_server: %s; server_index = %d\n", ntpServer, server_index);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_get_one_ntp_server_ip, ntp_server: %s; server_index = %d\n", ntpServer, server_index);
if (inet_addr(ntpServer) == INADDR_NONE) {
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_get_one_ntp_server_ip start getnameinfo\n");
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_get_one_ntp_server_ip start getnameinfo\n");
result = zte_sntp_get_group_addr_by_name(ntpServer, ip_addr, max_len);
#if 0
if (result == SNTP_RESULT_FAIL) {
@@ -275,7 +275,7 @@
}
#endif
} else {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_get_one_ntp_server_ip, single IP: %s \n", ntpServer);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_get_one_ntp_server_ip, single IP: %s \n", ntpServer);
ip_addr[0] = inet_addr(ntpServer);
result = 1;
}
@@ -324,7 +324,7 @@
strcpy(buf, temp->sntp_server_ip);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_get_default_ip_addr, %s =%s \n", sntp_default, buf);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_get_default_ip_addr, %s =%s \n", sntp_default, buf);
if (strlen(buf) == 0) {
continue;
}
@@ -389,7 +389,7 @@
//int count = 0;
INIT_LIST_HEAD(&sntp_server_head);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_default_server_ip_addr\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_default_server_ip_addr\n");
struct sntp_server *tmp = NULL;
@@ -542,7 +542,7 @@
if (sem_id != -1) {
result = sem_p(sem_id);
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_handle_time, sem_p, sem_id = %d, result = %d\r\n", sem_id, result);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_handle_time, sem_p, sem_id = %d, result = %d\r\n", sem_id, result);
}
if (0 == settimeofday(&tp, NULL)) {
@@ -566,7 +566,7 @@
if (sem_id != -1) {
result = sem_v(sem_id);
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_parse_time, sem_v, sem_id = %d, result = %d\r\n", sem_id, result);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_parse_time, sem_v, sem_id = %d, result = %d\r\n", sem_id, result);
}
return SNTP_RESULT_OK;
@@ -679,14 +679,14 @@
sem_id = get_sem(TIME_SEM_KEY_1);
if (sem_id != -1) {
result = sem_p(sem_id);
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_parse_time, sem_p, sem_id = %d, result = %d\r\n", sem_id, result);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_parse_time, sem_p, sem_id = %d, result = %d\r\n", sem_id, result);
}
zte_sntp_handle_time(time_tv);
zte_sntp_set_clear_traffic_data_nv_flag();
if (sem_id != -1) {
result = sem_v(sem_id);
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_parse_time, sem_v, sem_id = %d, result = %d\r\n", sem_id, result);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_parse_time, sem_v, sem_id = %d, result = %d\r\n", sem_id, result);
}
return SNTP_RESULT_OK;
@@ -723,7 +723,7 @@
int i = 0;
int count = 0;
char IPdotdec[20] = {0};
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_sendto, need send ip count = %d\n", ip_count);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_sendto, need send ip count = %d\n", ip_count);
//tz = zte_sntp_get_timezone();
toAddr.sin_family = AF_INET;
@@ -745,15 +745,15 @@
count++;
toAddr.sin_addr.s_addr = ip_addr[i];
inet_ntop(AF_INET, &toAddr.sin_addr, IPdotdec, 16);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_sendto Send, i = %d, IP: %s \n", i, IPdotdec);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_sendto Send, i = %d, IP: %s \n", i, IPdotdec);
retValue = sendto(sock_fd, &sntp_header, sizeof(SNTP_HEADER), 0,
(struct sockaddr *)&toAddr, addrLen);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_sendto Send addrLen = %d . \n", addrLen);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_sendto Send success %d chars, need send %d chars\n", retValue, sizeof(SNTP_HEADER));
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_sendto Send addrLen = %d . \n", addrLen);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_sendto Send success %d chars, need send %d chars\n", retValue, sizeof(SNTP_HEADER));
//sleep(50);
}
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_socket_sendto Send success %d ip!!!!!!!\n", count);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_socket_sendto Send success %d ip!!!!!!!\n", count);
return SNTP_RESULT_OK;
}
@@ -767,7 +767,7 @@
long after_time = 0;
time(&before_time);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_select start to select ======before_time = %ld\n", before_time);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_select start to select ======before_time = %ld\n", before_time);
FD_ZERO(&readfds);
FD_SET(sock_fd, &readfds);
@@ -802,7 +802,7 @@
struct sockaddr_in recvAddr;
SNTP_HEADER sntp_header = {0};
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_recvfrom...Received msg ... \n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_recvfrom...Received msg ... \n");
addrLen = sizeof(struct sockaddr);
memset(&sntp_header, 0, sizeof(sntp_header));
retValue = recvfrom(sock_fd, (char*)&sntp_header, sizeof(SNTP_HEADER), 0, (struct sockaddr*)&recvAddr, &addrLen);
@@ -852,7 +852,7 @@
if(curr_server_index >= SNTP_MAX_SERVER_NUM)
{
zte_sntp_set_error_state(SNTP_ERROR_ALL_SERVER_INVALID);
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_get_ntp_server_ip: all server invalide, return \n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_get_ntp_server_ip: all server invalide, return \n");
break;
}
@@ -872,7 +872,7 @@
result = zte_sntp_socket_sendto(sock_fd, ip_addr, ip_count);
if (result == SNTP_RESULT_FAIL) {
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_socket_sendto failed!\n");
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_socket_sendto failed!\n");
break;
}
@@ -887,14 +887,14 @@
if (result == SNTP_RESULT_FAIL) {
break;
}
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_process_for_webui=========success!\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_process_for_webui=========success!\n");
break;
}
if (curr_server_index >= sntp_server_count) {
zte_sntp_set_error_state(SNTP_ERROR_ALL_SERVER_INVALID);
result = SNTP_RESULT_FAIL;
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_get_ntp_server_ip: all server invalide, return \n");
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_get_ntp_server_ip: all server invalide, return \n");
}
zte_sntp_socket_close(sock_fd);
zte_sntp_set_process_result(result);
@@ -918,7 +918,7 @@
}
for (curr_server_index = 0; curr_server_index < sntp_server_count; curr_server_index++) {
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_process_for_background first_use_default_ip= %d!\n", first_use_default_ip);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_process_for_background first_use_default_ip= %d!\n", first_use_default_ip);
memset(ip_addr, 0, sizeof(ip_addr));
if (first_use_default_ip) {
ip_count = zte_sntp_get_default_ip_addr(ip_addr, sntp_default_server_count);
@@ -932,7 +932,7 @@
if (ip_count == 0) {
first_use_default_ip = FALSE;
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_process_for_background ip_count == 0!\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_process_for_background ip_count == 0!\n");
continue;
}
@@ -944,7 +944,7 @@
result = zte_sntp_socket_select(sock_fd);
if (result == SNTP_RESULT_CONTINUE) {
first_use_default_ip = FALSE;
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_socket_select,SNTP_RESULT_CONTINUE curr_server_index = %d!\n", curr_server_index);
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_socket_select,SNTP_RESULT_CONTINUE curr_server_index = %d!\n", curr_server_index);
continue;
} else if (result == SNTP_RESULT_FAIL) {
break;
@@ -954,13 +954,13 @@
if (result == SNTP_RESULT_FAIL) {
break;
}
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] zte_sntp_process_for_background=========success!\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP] sntp_process_for_background=========success!\n");
break;
}
if (curr_server_index >= sntp_server_count) {
zte_sntp_set_error_state(SNTP_ERROR_ALL_SERVER_INVALID);
result = SNTP_RESULT_FAIL;
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_get_ntp_server_ip: all server invalide, return \n");
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_get_ntp_server_ip: all server invalide, return \n");
}
zte_sntp_socket_close(sock_fd);
zte_sntp_set_process_result(result);
@@ -1000,14 +1000,14 @@
//if(0 == strcmp(buf, "WEBUI"))
if (g_sntp_cmd_from == 0) {
if (zte_sntp_check_ip() == 0) {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_thread_process, cmd form WEBUI!\n");
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_thread_process, cmd form WEBUI!\n");
zte_sntp_process_for_webui();
} else {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_thread_process, cmd form background!\n");
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_thread_process, cmd form background!\n");
zte_sntp_process_for_background();
}
} else {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_thread_process, cmd form background!\n");
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_thread_process, cmd form background!\n");
zte_sntp_process_for_background();
}
}
@@ -1113,7 +1113,7 @@
tmp->src_id = stMsg->src_id;
list_add_tail(&tmp->list, &wait_sync_sntp);
- slog(MISC_PRINT, SLOG_ERR, "[SNTP] zte_sntp_register_id = %d\n", stMsg->src_id);
+ slog(MISC_PRINT, SLOG_ERR, "[SNTP] sntp_register_id = %d\n", stMsg->src_id);
sc_cfg_get(SNTP_PROCESS_RESULT, result_buf, sizeof(result_buf));
if (strcmp(result_buf, "success") == 0) {
@@ -1125,14 +1125,14 @@
void zte_sntp_success_notify()
{
struct sntp_sync_queue *temp = NULL;
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] enter zte_sntp_success_notify!\n");
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] enter sntp_success_notify!\n");
//¿Ï¶¨´æÔÚÐèҪ֪ͨµÄÄ£¿é
ipc_send_message(MODULE_ID_SNTP, MODULE_ID_RTC_SERVICE, MSG_CMD_SNTP_SUCCESS, 0, NULL, 0);
//²»Ò»¶¨´æÔÚͨ¹ý×¢²áÐèҪ֪ͨµÄÄ£¿é
list_for_each_entry(temp, &wait_sync_sntp, list) {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_notify_process_id = %d\n", temp->src_id);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_notify_process_id = %d\n", temp->src_id);
ipc_send_message(MODULE_ID_SNTP, temp->src_id, MSG_CMD_SNTP_SUCCESS, 0, NULL, 0);
}
}
@@ -1143,7 +1143,7 @@
struct sntp_sync_queue *temp1 = NULL;
list_for_each_entry_safe(temp, temp1, &wait_sync_sntp, list) {
if (temp->src_id == stMsg->src_id) {
- slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] zte_sntp_unregister_id = %d\n", temp->src_id);
+ slog(MISC_PRINT, SLOG_DEBUG, "[SNTP] sntp_unregister_id = %d\n", temp->src_id);
list_del(&temp->list);
free(temp);
break;
@@ -1371,7 +1371,7 @@
slog(MISC_PRINT, SLOG_DEBUG,"[SNTP]MSG_CMD_SNTP_SET_TIME\n");
sntp_set_time(&stMsg);
} else if (stMsg.usMsgCmd == MSG_CMD_SNTP_START) {
- slog(MISC_PRINT, SLOG_DEBUG,"[SNTP]zte_sntp_start\n");
+ slog(MISC_PRINT, SLOG_DEBUG,"[SNTP]sntp_start\n");
g_sntp_cmd_from = 0;
zte_sntp_start();
} else if (stMsg.usMsgCmd == MSG_CMD_SNTP_REGISTER) {