[Bugfix][T106BUG-68][T106BUG-169]fix qser_data_call_info_get can't get infomation

Only Configure: No
Affected branch: master
Affected module: data
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I2de167624ce6ebaf709ef3170aaaf9892a72a321
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index f017ef6..55070ef 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -31,28 +31,188 @@
 
 void lynq_ipv4_aton_urc(lynq_data_call_response_v11_t *libdata,qser_data_call_state_s *data_res)
 {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+    
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 addresses = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.ip));
+    }
+
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 pri_dns = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 sec_dns = %s", tmp_char);
+        inet_aton(tmp_char, &(data_res->v4.sec_dns));
+    }
+    //get gateway
+    inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.gateway));
+
+#else
     inet_aton(libdata->addresses,&(data_res->v4.ip));
     inet_aton(libdata->gateways,&(data_res->v4.gateway));
     inet_aton(libdata->dnses,&(data_res->v4.pri_dns));
     inet_aton(libdata->dnses,&(data_res->v4.sec_dns));
+#endif
     return ;
 }
 
 void lynq_ipv6_inet_pton_urc(lynq_data_call_response_v11_t *libdata,qser_data_call_state_s *data_res)
 {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 addresses = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.ip));
+    }
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 pri_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 sec_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.sec_dns));
+    }
+    inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.gateway));
+#else
     inet_pton(AF_INET6,libdata->addresses,&(data_res->v6.ip));
     inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.gateway));
     inet_pton(AF_INET6,libdata->dnses,&(data_res->v6.pri_dns));
     inet_pton(AF_INET6,libdata->dnses,&(data_res->v6.sec_dns));
+#endif
+
+    return ;
+}
+
+void lynq_ipv4v6_inet_pton_urc(lynq_data_call_response_v11_t *libdata,qser_data_call_state_s *data_res)
+{
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 addresses = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.ip));
+    }
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 addresses = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.ip));
+    }
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 pri_dns = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 sec_dns = %s", tmp_char);
+        inet_aton(tmp_char, &(data_res->v4.sec_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 pri_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 sec_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.sec_dns));
+    }
+    //get gateway
+    inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.gateway));
+
     return ;
 }
 
 void lynq_ipv4_aton_getinfo(lynq_data_call_response_v11_t *libdata,qser_data_call_info_s *data_res)
 {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+    
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 addresses = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.addr.ip));
+    }
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 pri_dns = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.addr.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 sec_dns = %s", tmp_char);
+        inet_aton(tmp_char, &(data_res->v4.addr.sec_dns));
+    }
+    //get gateway
+    LYINFLOG("ipv4 gateways = %s", libdata->gateways);
+    inet_aton(libdata->gateways,&(data_res->v4.addr.gateway));
+
+    LYINFLOG("v4.ip=%s", inet_ntoa(data_res->v4.addr.ip));
+    LYINFLOG("v4.pri_dns=%s", inet_ntoa(data_res->v4.addr.pri_dns));
+    LYINFLOG("v4.sec_dns=%s", inet_ntoa(data_res->v4.addr.sec_dns));
+#else
     inet_aton(libdata->addresses,&(data_res->v4.addr.ip));
     inet_aton(libdata->gateways,&(data_res->v4.addr.gateway));
     inet_aton(libdata->dnses,&(data_res->v4.addr.pri_dns));
     inet_aton(libdata->dnses,&(data_res->v4.addr.sec_dns));
+#endif
     data_res->v4.stats.pkts_tx = 0;
     data_res->v4.stats.pkts_rx = 0;
     data_res->v4.stats.bytes_tx = 0;
@@ -64,10 +224,123 @@
 
 void lynq_ipv6_inet_pton_getinfo(lynq_data_call_response_v11_t *libdata,qser_data_call_info_s *data_res)
 {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 addresses = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.ip));
+    }
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 pri_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 sec_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.sec_dns));
+    }
+    inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.addr.gateway));
+#else
     inet_pton(AF_INET6,libdata->addresses,&(data_res->v6.addr.ip));
     inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.addr.gateway));
     inet_pton(AF_INET6,libdata->dnses,&(data_res->v6.addr.pri_dns));
     inet_pton(AF_INET6,libdata->dnses,&(data_res->v6.addr.sec_dns));
+#endif
+    data_res->v6.stats.pkts_tx = 0;
+    data_res->v6.stats.pkts_rx = 0;
+    data_res->v6.stats.bytes_tx = 0;
+    data_res->v6.stats.bytes_rx = 0;
+    data_res->v6.stats.pkts_dropped_tx = 0;
+    data_res->v6.stats.pkts_dropped_rx = 0;
+    return ;
+}
+void lynq_ipv4v6_inet_pton_getinfo(lynq_data_call_response_v11_t *libdata,qser_data_call_info_s *data_res)
+{
+    char *tmp_char = NULL;
+    char *addresses = NULL;
+    char *dnses = NULL;
+    const char addresses_separator[2] = "/";
+    const char dnses_separator[2] = " ";
+
+    char buf_ip[64] = {0};
+    char buf_gateway[64] = {0};
+    char buf_pri_dns[64] = {0};
+    char buf_sec_dns[64] = {0};
+
+    addresses = libdata->addresses;
+    dnses = libdata->dnses;
+    //get addresses
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 addresses = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.addr.ip));
+    }
+    tmp_char = strsep(&addresses, addresses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 addresses = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.ip));
+    }
+    //get dnses
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 pri_dns = %s", tmp_char);
+        inet_aton(tmp_char,&(data_res->v4.addr.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv4 sec_dns = %s", tmp_char);
+        inet_aton(tmp_char, &(data_res->v4.addr.sec_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 pri_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.pri_dns));
+    }
+    tmp_char = strsep(&dnses, dnses_separator);
+    if(tmp_char != NULL)
+    {
+        LYINFLOG("ipv6 sec_dns = %s", tmp_char);
+        inet_pton(AF_INET6, tmp_char, &(data_res->v6.addr.sec_dns));
+    }
+    //get gateway
+    inet_pton(AF_INET6,libdata->gateways,&(data_res->v6.addr.gateway));
+
+    LYINFLOG("v4.ip=%s", inet_ntoa(data_res->v4.addr.ip));
+    LYINFLOG("v4.pri_dns=%s", inet_ntoa(data_res->v4.addr.pri_dns));
+    LYINFLOG("v4.sec_dns=%s", inet_ntoa(data_res->v4.addr.sec_dns));
+
+    inet_ntop(AF_INET6, &(data_res->v6.addr.ip), buf_ip, sizeof(buf_ip));
+    inet_ntop(AF_INET6, &(data_res->v6.addr.gateway), buf_gateway, sizeof(buf_gateway));
+    inet_ntop(AF_INET6, &(data_res->v6.addr.pri_dns), buf_pri_dns, sizeof(buf_pri_dns));
+    inet_ntop(AF_INET6, &(data_res->v6.addr.sec_dns), buf_sec_dns, sizeof(buf_sec_dns));
+    LYINFLOG("v6.ip=%s, v6.gateway=%s, v6.pri_dns=%s, v6.sec_dns=%s\n"
+        , buf_ip, buf_gateway, buf_pri_dns, buf_sec_dns);
+    data_res->v4.stats.pkts_tx = 0;
+    data_res->v4.stats.pkts_rx = 0;
+    data_res->v4.stats.bytes_tx = 0;
+    data_res->v4.stats.bytes_rx = 0;
+    data_res->v4.stats.pkts_dropped_tx = 0;
+    data_res->v4.stats.pkts_dropped_rx = 0;
+
     data_res->v6.stats.pkts_tx = 0;
     data_res->v6.stats.pkts_rx = 0;
     data_res->v6.stats.bytes_tx = 0;
@@ -565,7 +838,11 @@
         }
         else if (data_cb_state.ip_family == QSER_DATA_CALL_TYPE_IPV4V6)
         {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+            lynq_ipv4v6_inet_pton_urc(&data_urc_info,&data_cb_state);
+#else
             lynq_ipv6_inet_pton_urc(&data_urc_info,&data_cb_state);
+#endif
         }
         else
         {
@@ -719,14 +996,14 @@
     {
         info->profile_idx = profile_idx;
         info->ip_family = ip_family;
-        if (strcmp(data_call_info.type,"IPV4"))
+        if (strncmp(data_call_info.type,"IPV4", strlen("IPV4") + 1) == 0)
         {
             strcpy(info->v4.name,data_call_info.ifname);
             datacall_ipv4_status_judge(data_call_info.status,info);
             LYINFLOG("[IPV4]addresses:%s,gateways:%s,dnses:%s",data_call_info.addresses,data_call_info.gateways,data_call_info.dnses);
             lynq_ipv4_aton_getinfo(&data_call_info,info);
         }
-        else if (strcmp(data_call_info.type,"IPV6"))
+        else if (strncmp(data_call_info.type,"IPV6", strlen("IPV6") + 1) == 0)
         {
             strcpy(info->v6.name,data_call_info.ifname);
 
@@ -734,16 +1011,23 @@
             LYINFLOG("[IPV6]addresses:%s,gateways:%s,dnses:%s",data_call_info.addresses,data_call_info.gateways,data_call_info.dnses);
             lynq_ipv6_inet_pton_getinfo(&data_call_info,info);
         }
-        else if (strcmp(data_call_info.type,"IPV4V6"))
+        else if (strncmp(data_call_info.type,"IPV4V6", strlen("IPV4V6") + 1) == 0)
         {
             strcpy(info->v4.name,data_call_info.ifname);
             datacall_ipv4_status_judge(data_call_info.status,info);
             LYINFLOG("[IPV4V6]addresses:%s,gateways:%s,dnses:%s",data_call_info.addresses,data_call_info.gateways,data_call_info.dnses);
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
             lynq_ipv4_aton_getinfo(&data_call_info,info);
+#endif
             strcpy(info->v6.name,data_call_info.ifname);
             datacall_ipv6_status_judge(data_call_info.status,info);
             LYINFLOG("[IPV4V6]addresses:%s,gateways:%s,dnses:%s",data_call_info.addresses,data_call_info.gateways,data_call_info.dnses);
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
             lynq_ipv6_inet_pton_getinfo(&data_call_info,info);
+#endif
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+            lynq_ipv4v6_inet_pton_getinfo(&data_call_info,info);
+#endif
         }
         else
         {