Merge branch 'master' of http://git.komect.net/ISG/secogateway
This commit is contained in:
commit
1f24b1df75
|
@ -65,9 +65,11 @@ int interface_get_server(server * srv ,char * data_in,interface_sg *data_out,cJS
|
|||
cJSON *json_data = cJSON_GetObjectItem(json, "resultCode");
|
||||
if(json_data == NULL){data_out->resultCode ="";}
|
||||
else{data_out->resultCode = json_data->valuestring;}
|
||||
|
||||
json_data = cJSON_GetObjectItem(json, "message");
|
||||
if(json_data == NULL){data_out->message ="";}
|
||||
else{data_out->message =json_data ->valuestring;}
|
||||
|
||||
if(strcmp(data_out->resultCode , "0")) {goto end;} //返回0,直接跳出
|
||||
|
||||
cJSON * Array = cJSON_GetObjectItem(json, "data"); //从root中获得jsonarray
|
||||
|
@ -160,13 +162,14 @@ int interface_get_server(server * srv ,char * data_in,interface_sg *data_out,cJS
|
|||
|
||||
//cJSON *ipv6data = cJSON_GetObjectItem(ArrayItem, "ipv6");
|
||||
cJSON * ipv6Array = cJSON_GetObjectItem(ArrayItem, "ipv6"); //从root中获得jsonarray
|
||||
if(ipv6Array == NULL){
|
||||
data_out->data[i]._arripv6 = 0; //ipv6数组不存在
|
||||
int ipv6_size = cJSON_GetArraySize(ipv6Array); //读取数组大小
|
||||
data_out->data[i]._arripv6 = ipv6_size;
|
||||
if(ipv6_size == 0){
|
||||
data_out->data[i].ipv6_data[0].ipv6_ipaddr = "";
|
||||
data_out->data[i].ipv6_data[0].ipv6_prefixlen ="";
|
||||
}
|
||||
else{
|
||||
int ipv6_size = cJSON_GetArraySize(ipv6Array); //读取数组大小
|
||||
data_out->data[i]._arripv6 = ipv6_size;
|
||||
for(int j=0;j<ipv6_size;j++){
|
||||
for(int j=0;j<ipv6_size;j++){
|
||||
cJSON *ArrayItemtem = cJSON_GetArrayItem(ipv6Array,j); //分别读取数组中每一个object对象。
|
||||
json_data = cJSON_GetObjectItem(ArrayItemtem, "addr");
|
||||
if(json_data == NULL){data_out->data[i].ipv6_data[j].ipv6_ipaddr = "";}
|
||||
|
@ -175,14 +178,10 @@ int interface_get_server(server * srv ,char * data_in,interface_sg *data_out,cJS
|
|||
json_data = cJSON_GetObjectItem(ArrayItemtem, "prefixlen");
|
||||
if(json_data == NULL){data_out->data[i].ipv6_data[j].ipv6_prefixlen ="";}
|
||||
else{data_out->data[i].ipv6_data[j].ipv6_prefixlen = json_data->valuestring;}
|
||||
|
||||
}
|
||||
}
|
||||
if(data_out->data[i]._arripv6 == 0){ //初始为空,防止野指针
|
||||
data_out->data[i].ipv6_data[0].ipv6_ipaddr = "";
|
||||
data_out->data[i].ipv6_data[0].ipv6_prefixlen ="";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
end:
|
||||
|
@ -553,7 +552,6 @@ char * interface_conip_send_web(server *srv,interface_conip_ws *data_in){
|
|||
cJSON *Arrayconip2 = cJSON_CreateObject(); //创建一个对象将对象
|
||||
cJSON_AddNumberToObject(Arrayconip2, "family", data_in->data[i].condata[1].family);
|
||||
cJSON_AddStringToObject(Arrayconip2, "ipaddr",data_in->data[i].condata[1].ipaddr);
|
||||
|
||||
cJSON_AddStringToObject(Arrayconip2, "prefixlen",data_in->data[i].condata[1].prefixlen);
|
||||
cJSON_AddItemToArray(iptypeArray, Arrayconip2);//将该对象依次添加到数组里
|
||||
|
||||
|
@ -854,7 +852,7 @@ char * interface_conip_process(server *srv,char * data_in,void *point){
|
|||
//printf("发送请求interface服务端数据: \n");
|
||||
interface_ss server_send_data;
|
||||
server_send_data.config_type = 5; //获取接口所有数据
|
||||
server_send_data.ifname = " ";
|
||||
server_send_data.ifname = "";
|
||||
char * json_data = interface_send_server(&server_send_data);//向服务端发送请求
|
||||
if( json_data ==NULL){log_error_write(srv, __FILE__, __LINE__, "s", "SERVER端打包数据出错-CONIP");return NULL; }
|
||||
if (p_d && p_d->web_cfg_exec){
|
||||
|
|
Loading…
Reference in New Issue