Update build error according to resturctuing
authornshero.lee <nshero.lee@samsung.com>
Wed, 20 Dec 2017 00:23:43 +0000 (09:23 +0900)
committernshero.lee <nshero.lee@samsung.com>
Wed, 20 Dec 2017 00:23:43 +0000 (09:23 +0900)
Signed-off-by: nshero.lee <nshero.lee@samsung.com>
include/sa_types.h
include/setup_network.h
include/setup_system.h
src/adaptor.c
src/input_file.c
src/setup_network.c
src/setup_system.c

index 03fd23fa547628c74bcf30ebb098671633ae3289..a5fdb7dc967c124b1bd00e860ffa325d4a61da2b 100644 (file)
@@ -173,41 +173,41 @@ typedef struct {
 } sa_eth_s;
 
 /**
- * @struct sa_network_s
- * @brief  This struct contains network information in the config
+ * @struct sa_proxy_s
+ * @brief  This struct contains proxy information 
  *
- * The sa_network_s struct encapsulate wifi, ethernet and proxy information in the one data
+ * The sa_network_s struct encapsulate httpproxyHost and httpProxyPort information in the one data
  *
  */
 typedef struct {
-       sa_wifi_s *wifi;
-       sa_eth_s *eth;
        char httpProxyHost[255+1];
-       int httpProxyPort;
-} sa_network_s;
+       int httpProxyPort; 
+} sa_proxy_s;
 
 /**
- * @struct sa_network_activate_pararms_s
- * @brief  This struct contains update params for activation of network
+ * @struct sa_network_s
+ * @brief  This struct contains network information in the config
  *
- * The sa_network_activate_pararms_s struct encapsulate network type and network info to update in the one data
+ * The sa_network_s struct encapsulate wifi, ethernet and proxy information in the one data
  *
  */
 typedef struct {
-       sa_network_type_e type;
-       sa_network_s *network;
-} sa_network_activate_pararms_s;
+       sa_wifi_s *wifi;
+       sa_eth_s *eth;
+} sa_network_s;
+
 
 /**
- * @struct sa_systemdata_s
+ * @struct sa_system_s
  * @brief  This struct contains system data information in the config
  *
- * The sa_systemdata_s struct encapsulate device name information in the one data
+ * The sa_system_s struct encapsulate device name information in the one data
  *
  */
 typedef struct {
        char deviceName[255+1];
-} sa_systemdata_s;
+       sa_proxy_s *proxy;
+} sa_system_s;
 
 /**
  * @struct sa_config_s
@@ -219,7 +219,7 @@ typedef struct {
 typedef struct {
        char version[127+1];
        sa_network_s *networkData;
-       sa_systemdata_s *systemData;
+       sa_system_s *systemData;
 } sa_config_s;
 
 #endif                                                 /* __SA_TYPES_H__ */
index 4b8ef9cb25f37252aff068c6a46ceaf1209b22b0..2b432c9f013494e08f7978d408322051f8479179 100644 (file)
 int sa_network_get_state(sa_network_state_e *conn_state, sa_network_type_e *conn_type);
 
 /**
- * @fn        int sa_network_activate(sa_network_s *info)
- * @brief     This function to activate connection with info
+ * @fn        int sa_network_set_connection(sa_network_s *info)
+ * @brief     This function to set connection with info
+   @param     conn_type                        [in] type of connection
  * @return    int               return of function
  */
-int sa_network_activate(sa_network_s *info);
+int sa_network_set_connection(sa_network_s *info);
+
+/**
+ * @fn        int sa_network_get_connection(sa_network_s *info)
+ * @brief     This function to get connection with info
+ * @param     conn_type                        [out] connection info
+ * @return    int               return of function
+ */
+int sa_network_get_connection(sa_network_s *info);
 
 /**
  * @fn        int sa_network_deactivate(void)
index 8ba3a7053df96618a5aa209c0492ae48bc3c6c4f..8d0834dda7bc9bbf389fb8907c1292249dd41f9c 100644 (file)
 #define __SETUP_SYSTEMDATA_H__
 
 /**
- * @fn        int sa_systemdata_get_config_info(char *path, sa_config_s *config)
- * @brief     This function to get config info
- * @param     file                                 [in] config path and name
- * @param     sa_config_s                  [out] fill config info 
- * @return    int                                      return of function
+ * @fn        int sa_system_set_proxy(sa_network_s *info)
+ * @brief     This function to set connection with info
+   @param     conn_type                        [in] proxy info to set
+ * @return    int               return of function
  */
-int sa_systemdata_get_config_info(char *flle, sa_config_s *config);
+int sa_system_set_proxy(sa_proxy_s *info);
+
+/**
+ * @fn        int sa_system_get_proxy(sa_network_s *info)
+ * @brief     This function to get connection with info
+ * @param     conn_type                        [out] proxy info to get
+ * @return    int               return of function
+ */
+int sa_system_get_proxy(sa_proxy_s *info);
 
 #endif/* __SETUP_SYSTEMDATA_H__ */
index fb5f8f7092653d5ebc7bb2572839bb0d4cbfed4d..45f3d001b32ec0bdf51dd04fcd2c07f05b2cea17 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include <sys/types.hini#include <sys/inotify.h>
-#include <sys/msg.h>
 #include "sa_common.h"
 #include "sa_types.h"
-#include "setup_systemdata.h"
+#include "setup_system.h"
 #include "setup_network.h"
 #include "input_file.h"
 
+#define NETWORK_CHECK_RETRY_MAX 10
+
 static char *__print_connection_state(sa_network_state_e state)
 {
        switch (state) {
@@ -70,7 +70,7 @@ static void __print_config_network_static_info(sa_network_static_s *staticInfo)
 static void __print_config_info(sa_config_s *config)
 {
        sa_network_s *network = NULL;
-       sa_systemdata_s *systemData = NULL;
+       sa_system_s *systemData = NULL;
        sa_wifi_s *wifi = NULL;
        sa_eth_s *eth = NULL;
 
@@ -100,21 +100,21 @@ static void __print_config_info(sa_config_s *config)
                                if (eth->dhcpEnabled == 0)
                                        __print_config_network_static_info(wifi->staticInfo);
                        }
-
-                       if (network->httpProxyHost != NULL)
-                               _D("Network::httpProxyHost [%s]", network->httpProxyHost);
-                       _D("Network::HttpProxyHost [%d]", network->httpProxyPort);
                }
 
                systemData = config->systemData;
                if (systemData != NULL) {
                        if (systemData->deviceName != NULL)
                                _D("SystemData::deviceName[%s]", systemData->deviceName);
+                       if (systemData->proxy != NULL) {
+                               _D("systemData::httpProxyHost [%s]", systemData->proxy->httpProxyHost);
+                               _D("systemData::HttpProxyPort [%d]", systemData->proxy->httpProxyPort);
+                       }
                }
        }
 }
 
-static void __release_network_resource(sa_network_s * network)
+static void __release_network_resource(sa_network_s *network)
 {
        if (network != NULL) {
                if (network->wifi != NULL)
@@ -125,13 +125,20 @@ static void __release_network_resource(sa_network_s * network)
                                free(network->eth->staticInfo);
                }
 
-               if (network->httpProxyHost != NULL)
-                       free(network->httpProxyHost);
-
                free(network);
        }
 }
 
+static void __release_system_resource(sa_system_s *system)
+{
+       if (system != NULL) {
+               if (system->proxy != NULL)
+                       free(system->proxy);
+
+               free(system);
+       }
+}
+
 static void __release_config_resource(sa_config_s *config)
 {
 
@@ -140,14 +147,15 @@ static void __release_config_resource(sa_config_s *config)
                        __release_network_resource(config->networkData);
 
                if (config->systemData != NULL)
-                       free(config->systemData);
+                       __release_system_resource(config->systemData);
 
                free(config);
        }
 }
 
-static int __parsing_config(void)
+static int __parsing_config(sa_config_s *config)
 {
+       sa_error_e ret = SA_ERROR_NONE;
        // memory will be allocated from interface layer
        ret = sa_inputfile_get_config_info(config);
        if (ret == SA_ERROR_NONE) {
@@ -163,8 +171,13 @@ static int __parsing_config(void)
        return ret;
 }
 
-static int __activate_network(void)
+static int __activate_network(sa_network_s *network)
 {
+       sa_error_e ret = SA_ERROR_NONE;
+       sa_network_type_e conn_type;
+       sa_network_state_e conn_state;
+       int index = 0;
+
        if (ret == SA_ERROR_NONE) {
                for (index = 0; index < NETWORK_CHECK_RETRY_MAX; index++) {
                        ret = sa_network_get_state(&conn_state, &conn_type);
@@ -184,8 +197,8 @@ static int __activate_network(void)
        }
 
        if (ret == SA_ERROR_NONE && conn_state != SA_NETWORK_STATE_CONNECTED) {
-               if (config->networkData != NULL) {
-                       ret = sa_network_activate(config->networkData);
+               if (network != NULL) {
+                       ret = sa_network_set_connection(network);
                }
                
        }
@@ -201,10 +214,10 @@ void __monitor_file_state_cb(sa_file_state_e state, void *param1, void *param2)
        case SA_FILE_STATE_REGISTERED:
                _D("SA_FILE_STATE_REGISTERED");
                // parsing config 
-               if (__parsing_config(config)) {
+               if (SA_ERROR_NONE == __parsing_config(config)) {
                        // activate network
                        if (config != NULL) {
-                               ret = __activate_network(config->networkData);  
+                               __activate_network(config->networkData);        
                        }
                        __release_config_resource(config);
                }
@@ -213,17 +226,14 @@ void __monitor_file_state_cb(sa_file_state_e state, void *param1, void *param2)
                _D("SA_FILE_STATE_CHANGED");
                break;
        default:
-               _W("Not Supported");
+               _W("Not Support");
                break;
        }
 }
 
 int main(int argc, char *argv[])
-{
-       sa_config_s *config = NULL;     
+{      
        sa_error_e ret = SA_ERROR_NONE;
-       sa_file_status_e file_state = 0;
-       int index = 0;
 
        _D("start setup-adaptor");
        
@@ -239,4 +249,4 @@ int main(int argc, char *argv[])
        }
 
        return 0;
-}
+}
\ No newline at end of file
index 3174c5414b2d9a6d0ed5ca37cbd8620d4e8949e7..8fc83505c604e298b484fe0919bef850b8643436 100644 (file)
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/inotify.h>
-
+#include <fcntl.h>
+#include <json.h>
 #include "sa_common.h"
 #include "sa_types.h"
 #include "input_file.h"
 
 #define CONFIG_FILE "/etc/setup-adaptor/config.json"
-#define NETWORK_CHECK_RETRY_MAX 10
 #define EVENT_SIZE     (sizeof(struct inotify_event))
 #define BUF_LEN        (1024 * (EVENT_SIZE + 16))
 
@@ -34,15 +34,15 @@ static void *__config_main_loop(void *arg)
 {
        int fd;
        int wd;
-       file_status_cb callback = NULL;
+       file_state_cb callback;
        char buffer[BUF_LEN];
 
        _D("__config_main_loop start\n");
 
-       callback = (file_status_cb)arg;
+       callback = (file_state_cb)arg;
 
-       if (config_path != NULL) {
-               _E("Config is null to register event");
+       if (callback != NULL) {
+               _E("Ccallback is null for event");
                return NULL;
        }
 
@@ -53,7 +53,7 @@ static void *__config_main_loop(void *arg)
                return NULL;
        }
 
-       wd = inotify_add_watch(fd, config_path, IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO | IN_MOVE_SELF);
+       wd = inotify_add_watch(fd, CONFIG_FILE, IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO | IN_MOVE_SELF);
 
        while (1) {
                int length, i = 0;
@@ -98,10 +98,10 @@ static void *__config_main_loop(void *arg)
 
        pthread_exit((void *)0);
 
-       return;
+       return NULL;
 }
 
-static int __init_event_listener(file_status_cb callback)
+static int __init_event_listener(file_state_cb callback)
 {
        pthread_t p_thread;
 
@@ -173,27 +173,34 @@ static char *json_get_string_from_obj(json_object *inputObj, char *key)
        _D("string object [%s]", ret_buf);
        return ret_buf;
 }
-static int __parse_network_proxy(json_object *inputObj, sa_network_s *network)
+static int __parse_system_proxy(json_object *inputObj, sa_system_s *system)
 {
        char *httpProxyHost = NULL;
        int httpProxyPort;
+       int ret = 0;
 
-       if (inputObj == NULL || network == NULL) {
-               _E("__parse_network_proxy input error");
+       if (inputObj == NULL || system == NULL) {
+               _E("__parse_system_proxy input error");
                return -1;
        }
 
-       //httpProxyHost
-       httpProxyHost = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYHOST);
-       if (httpProxyHost != NULL) {
-               memcpy(network->httpProxyHost, httpProxyHost, MIN(strlen(httpProxyHost), sizeof(network->httpProxyHost)-1));
-               free(httpProxyHost);
-               httpProxyHost = NULL;
+       system->proxy = (sa_proxy_s *)malloc(sizeof(sa_proxy_s));
+       if (system->proxy != NULL) {
+               //httpProxyHost
+               httpProxyHost = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYHOST);
+               if (httpProxyHost != NULL) {
+                       memcpy(system->proxy->httpProxyHost, httpProxyHost, MIN(strlen(httpProxyHost), sizeof(system->proxy->httpProxyHost)-1));
+                       free(httpProxyHost);
+                       httpProxyHost = NULL;
+               }
+               //httpProxyPort
+               httpProxyPort = json_get_int_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYPORT);
+       } else {
+               ret = -1;
+               _E("system->proxy malloc fail");
        }
 
-       //httpProxyPort
-       httpProxyPort = json_get_int_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYPORT);
-       
+       return ret;
 }
 
 static int __parse_network_static_info(json_object *inputObj, sa_network_static_s *staticInfo)
@@ -366,9 +373,6 @@ static int __parse_network_data(json_object *inputObj, sa_network_s *network)
                }
        }
 
-       // parse proxy
-       __parse_network_proxy(inputObj, network);
-
        // if both of network interfaces are failed, it would return -1
        if (wifiRet != 0 && ethRet != 0) {
                _E("__parse_network_data fail");        
@@ -379,14 +383,18 @@ static int __parse_network_data(json_object *inputObj, sa_network_s *network)
 }
 
 
-static int __parse_system_data(json_object *inputObj, sa_systemdata_s *system)
+static int __parse_system_data(json_object *inputObj, sa_system_s *system)
 {
+       int ret = 0;
        if (inputObj == NULL || system == NULL) {
                _E("__parse_system_data input error");
                return -1;
        }
 
-       return 0;
+       // parse proxy
+       ret = __parse_system_proxy(inputObj, system);
+
+       return ret ;
 }
 
 
@@ -444,7 +452,7 @@ static int __parse_config(char *file, sa_config_s *setupConfig)
                                                if (json_object_object_get_ex(configObj, SA_CONFIG_SYSTEMDATA, &systemObj)) {
                                                        if (json_object_get_type(systemObj) == json_type_object) {
                                                                // malloc
-                                                               setupConfig->systemData = (sa_systemdata_s *)malloc(sizeof(sa_systemdata_s));
+                                                               setupConfig->systemData = (sa_system_s *)malloc(sizeof(sa_system_s));
                                                                ret = __parse_system_data(systemObj, setupConfig->systemData);
                                                        }
                                                }
@@ -490,7 +498,7 @@ sa_error_e sa_inputfile_get_config_info(sa_config_s *config)
                return SA_ERROR_NOT_AVAILABLE;
        }
        // parsing and fill into struct
-       ret = __parse_config(file, config);
+       ret = __parse_config(CONFIG_FILE, config);
        if (ret != 0) {
                _E("Config parsing error");
                return SA_ERROR_PARSING;
@@ -501,12 +509,12 @@ sa_error_e sa_inputfile_get_config_info(sa_config_s *config)
 
 sa_file_state_e sa_inputfile_get_config_state(void)
 {
-       sa_file_state_e ret = SA_FILE_STATUS_NOT_EXISTED;
+       sa_file_state_e ret = SA_FILE_STATE_NOT_EXISTED;
 
        if (access(CONFIG_FILE, F_OK) != -1) {
-               ret = SA_FILE_STATUS_EXIST;
+               ret = SA_FILE_STATE_EXIST;
        } else {
-               ret = SA_FILE_STATUS_NOT_EXISTED;
+               ret = SA_FILE_STATE_NOT_EXISTED;
        }
 
        return ret;
index 824482b5c8afbc60d161593948099938629f8e81..8aea5cc339f3a38840b6b75d2a04fd0f4042bfa4 100644 (file)
 #include <stdlib.h>
 #include "sa_common.h"
 #include "sa_types.h"
-#include "sa_network.h"
+#include "setup_network.h"
 #include "net_connection.h"
 #include "wifi-manager.h"
 
-
 static const char *__print_wifi_state(connection_wifi_state_e state)
 {
        switch (state) {
index cd0e69d91ef52869c045cb885559f54c6ba78c6c..e6e7f5df25ff02f502e24cd53fc121680531f3a9 100644 (file)
  * limitations under the License.
  */
 #include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <json.h>
 #include "sa_common.h"
 #include "sa_types.h"
-#include "sa_systemdata.h"
+#include "setup_system.h"
 
-
-static int json_get_int_from_obj(json_object *inputObj, char *key)
-{
-       struct json_object *bodyObj;
-       enum json_type type;
-       int ret = 0;
-
-       type = json_object_get_type(inputObj);
-
-       if (type == json_type_object) {
-               if (json_object_object_get_ex(inputObj, key, &bodyObj)) {
-                       ret = json_object_get_int(bodyObj);
-               } 
-       }
-       return ret;
-}
-
-static int json_get_boolean_from_obj(json_object *inputObj, char *key)
-{
-       struct json_object *bodyObj;
-       enum json_type type;
-       int ret = 0;
-
-       type = json_object_get_type(inputObj);
-
-       if (type == json_type_object) {
-               if (json_object_object_get_ex(inputObj, key, &bodyObj)) {
-                       ret = json_object_get_boolean(bodyObj);
-               } 
-       }
-       return ret;
-}
-
-static char *json_get_string_from_obj(json_object *inputObj, char *key)
-{
-       const char *buf = NULL;
-       char *ret_buf = NULL;
-       json_object *elementObj = NULL;
-       int i = 0, j = 0;
-
-       if (json_object_object_get_ex(inputObj, key, &elementObj)) {
-               buf = json_object_to_json_string_ext(elementObj, JSON_C_TO_STRING_SPACED | JSON_C_TO_STRING_PRETTY);
-               ret_buf = malloc(strlen(buf) - 1);
-               if (ret_buf != NULL) {
-                       memset(ret_buf, 0x00, strlen(buf) - 1); // "<-- exclude
-                       for (i = 1, j = 0; i < strlen(buf) - 1; i++) {  // "\ <-- exclude
-                               if (buf[i] == '\\')
-                                       continue;
-                               ret_buf[j++] = buf[i];
-                       }
-               } else {
-                       return NULL;
-               }
-       } else {
-               return NULL;
-       }
-
-       _D("string object [%s]", ret_buf);
-       return ret_buf;
-}
-static int __parse_network_proxy(json_object *inputObj, sa_network_s *network)
-{
-       char *httpProxyHost = NULL;
-       int httpProxyPort;
-
-       if (inputObj == NULL || network == NULL) {
-               _E("__parse_network_proxy input error");
-               return -1;
-       }
-
-       //httpProxyHost
-       httpProxyHost = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYHOST);
-       if (httpProxyHost != NULL) {
-               memcpy(network->httpProxyHost, httpProxyHost, MIN(strlen(httpProxyHost), sizeof(network->httpProxyHost)-1));
-               free(httpProxyHost);
-               httpProxyHost = NULL;
-       }
-
-       //httpProxyPort
-       httpProxyPort = json_get_int_from_obj(inputObj, SA_CONFIG_NETWORKDATA_HTTPPROXYPORT);
-       
-}
-
-static int __parse_network_static_info(json_object *inputObj, sa_network_static_s *staticInfo)
-{
-       char *ipAddress = NULL;
-       char *netmask = NULL;
-       char *defaultGateway = NULL;
-       char *primaryDnsServer = NULL;
-       char *secondaryDnsServer = NULL;
-
-       if (inputObj == NULL || staticInfo == NULL) {
-               _E("__parse_network_static_info input error");
-               return -1;
-       }
-
-       //ipAddress
-       ipAddress = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_IPADDRESS);
-       if (ipAddress != NULL) {
-               memcpy(staticInfo->ipAddress, ipAddress, MIN(strlen(ipAddress), sizeof(staticInfo->ipAddress)-1));
-               free(ipAddress);
-               ipAddress = NULL;
-       }
-
-       //netmask
-       netmask = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_NETMASK);
-       if (netmask != NULL) {
-               memcpy(staticInfo->netmask, netmask, MIN(strlen(netmask), sizeof(staticInfo->netmask)-1));
-               free(netmask);
-               netmask = NULL;
-       }
-
-       //defaultGateway
-       defaultGateway = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_DEFAULTGATEWAY);
-       if (defaultGateway != NULL) {
-               memcpy(staticInfo->defaultGateway, defaultGateway, MIN(strlen(defaultGateway), sizeof(staticInfo->defaultGateway)-1));
-               free(defaultGateway);
-               defaultGateway = NULL;
-       }
-       
-       //primaryDnsServer
-       primaryDnsServer = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_PRIMARYDNSSERVER);
-       if (primaryDnsServer != NULL) {
-               memcpy(staticInfo->primaryDnsServer, primaryDnsServer, MIN(strlen(primaryDnsServer), sizeof(staticInfo->primaryDnsServer)-1));
-               free(primaryDnsServer);
-               primaryDnsServer = NULL;
-       }
-       
-       //secondaryDnsServer
-       secondaryDnsServer = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_SECONDARYDNSSERVER);
-       if (secondaryDnsServer != NULL) {
-               memcpy(staticInfo->secondaryDnsServer, secondaryDnsServer, MIN(strlen(secondaryDnsServer), sizeof(staticInfo->secondaryDnsServer)-1));
-               free(secondaryDnsServer);
-               secondaryDnsServer = NULL;
-       }
-
-       return 0;
-}
-
-static int __parse_network_eth(json_object *inputObj, sa_eth_s *eth)
-{
-       int ret = 0;
-
-       if (inputObj == NULL || eth == NULL) {
-               _E("__parse_network_eth input error");
-               return -1;
-       }
-
-       // enabled
-       eth->enabled = json_get_boolean_from_obj(inputObj, SA_CONFIG_NETWORKDATA_ENABLED);
-
-       // dhcpEnabled
-       eth->dhcpEnabled = json_get_boolean_from_obj(inputObj, SA_CONFIG_NETWORKDATA_DHCPENABLED);
-       if (eth->dhcpEnabled == FALSE) {
-               eth->staticInfo = (sa_network_static_s *)malloc(sizeof(sa_network_static_s));
-               if (eth->staticInfo != NULL) {
-                       ret = __parse_network_static_info(inputObj, eth->staticInfo);
-               } else {
-                       ret = -1;
-               }
-       } else {
-               _D("dhcp is true");
-       }
-
-       return ret;
-}
-
-static int __parse_network_wifi(json_object *inputObj, sa_wifi_s *wifi)
-{
-       char *ssid = NULL;
-       char *password = NULL;
-       int ret = 0;
-
-       if (inputObj == NULL || wifi == NULL) {
-               _E("__parse_network_wifi input error");
-               return -1;
-       }
-       // enabled
-       wifi->enabled = json_get_boolean_from_obj(inputObj, SA_CONFIG_NETWORKDATA_ENABLED);
-
-       // ssid
-       ssid = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_WIFI_SSID);
-       if (ssid != NULL) {
-               memcpy(wifi->ssid, ssid, MIN(strlen(ssid), sizeof(wifi->ssid)-1));
-               free(ssid);
-               ssid = NULL;
-       } else {
-               ret = -1;
-       }
-
-       // password
-       password = json_get_string_from_obj(inputObj, SA_CONFIG_NETWORKDATA_WIFI_PASSWORD);
-       if (password != NULL) {
-               memcpy(wifi->password, password, MIN(strlen(password), sizeof(wifi->password)-1));
-               free(password);
-               password = NULL;
-       } else {
-               ret = -1;
-       }
-
-       // dhcpEnabled
-       wifi->dhcpEnabled = json_get_boolean_from_obj(inputObj, SA_CONFIG_NETWORKDATA_DHCPENABLED);
-       if (wifi->dhcpEnabled == FALSE) {
-               wifi->staticInfo = (sa_network_static_s *)malloc(sizeof(sa_network_static_s));
-               if (wifi->staticInfo != NULL) {
-                       ret = __parse_network_static_info(inputObj, wifi->staticInfo);
-               } else {
-                       ret = -1;
-               }
-       } else {
-               _D("dhcp is true");
-       }
-
-       return ret;
-}
-
-static int __parse_network_data(json_object *inputObj, sa_network_s *network)
-{
-       struct json_object *wifiObj = NULL;
-       struct json_object *ethernetObj = NULL;
-       int wifiRet = 0, ethRet = 0;
-
-       if (inputObj == NULL || network == NULL) {
-               _E("__parse_network_data input error");
-               return -1;
-       }
-
-       //parse wifi
-       if (json_object_object_get_ex(inputObj, SA_CONFIG_NETWORKDATA_WIFI, &wifiObj)) {
-               if (json_object_get_type(wifiObj) == json_type_object) {
-                       // malloc
-                       network->wifi = (sa_wifi_s *)malloc(sizeof(sa_wifi_s));
-                       if (network->wifi != NULL) {
-                               wifiRet = __parse_network_wifi(wifiObj, network->wifi);
-                       } else {
-                               _E("network->wifi malloc fail");
-                       }
-               }
-       }
-
-       //parse eth
-       if (json_object_object_get_ex(inputObj, SA_CONFIG_NETWORKDATA_ETHERNET, &ethernetObj)) {
-               if (json_object_get_type(ethernetObj) == json_type_object) {
-                       // malloc
-                       network->eth = (sa_eth_s *)malloc(sizeof(sa_eth_s));
-                       if (network->eth != NULL) {
-                               ethRet = __parse_network_eth(ethernetObj, network->eth);
-                       } else {
-                               _E("network->eth malloc fail"); 
-                       }
-               }
-       }
-
-       // parse proxy
-       __parse_network_proxy(inputObj, network);
-
-       // if both of network interfaces are failed, it would return -1
-       if (wifiRet != 0 && ethRet != 0) {
-               _E("__parse_network_data fail");        
-               return -1;
-       }
-       
-       return 0;
-}
-
-
-static int __parse_system_data(json_object *inputObj, sa_systemdata_s *system)
-{
-       if (inputObj == NULL || system == NULL) {
-               _E("__parse_system_data input error");
-               return -1;
-       }
-
-       return 0;
-}
-
-
-static int __parse_version(json_object *inputObj, sa_config_s *setupConfig)
-{
-       char *version = NULL;
-
-       if (inputObj == NULL || setupConfig == NULL) {
-               _E("__parse_version input error");
-               return -1;
-       }
-
-       version = json_get_string_from_obj(inputObj, SA_CONFIG_VERSION);
-
-       if (version != NULL) {
-               memcpy(setupConfig->version, version, MIN(strlen(version), sizeof(setupConfig->version)-1));
-               free(version);
-               version = NULL;
-       }
-
-       return 0;
-}
-
-static int __parse_config(char *file, sa_config_s *setupConfig)
-{
-       struct json_object *configObj = NULL;
-       struct json_object *networkObj = NULL;
-       struct json_object *systemObj = NULL;
-       char *jsonData = NULL;
-       int readLen = 0;
-       int fd = 0;
-       int len = 0;
-       int ret = 0;
-
-       fd = open(file, O_RDONLY);
-       if (fd) {
-               len = lseek(fd, 0L, SEEK_END);
-
-               if (len > 0) {
-                       lseek(fd, 0L, SEEK_SET);
-                       jsonData = (char *)malloc(len + 1);
-                       if (jsonData != NULL) {
-                               memset(jsonData, 0x00, len + 1);
-                               readLen = read(fd, jsonData, len);
-                               _D("JSON full data[%s]", jsonData);
-
-                               configObj = json_tokener_parse(jsonData);
-
-                               if (configObj != NULL) {
-                                       // parse version
-                                       ret = __parse_version(configObj, setupConfig);
-
-                                       // parse system data
-                                       if (ret == 0) {
-                                               if (json_object_object_get_ex(configObj, SA_CONFIG_SYSTEMDATA, &systemObj)) {
-                                                       if (json_object_get_type(systemObj) == json_type_object) {
-                                                               // malloc
-                                                               setupConfig->systemData = (sa_systemdata_s *)malloc(sizeof(sa_systemdata_s));
-                                                               ret = __parse_system_data(systemObj, setupConfig->systemData);
-                                                       }
-                                               }
-                                       }
-
-                                       // parse network data
-                                       if (ret == 0) {
-                                               if (json_object_object_get_ex(configObj, SA_CONFIG_NETWORKDATA, &networkObj)) {
-                                                       if (json_object_get_type(networkObj) == json_type_object) {
-                                                               // malloc
-                                                               setupConfig->networkData = (sa_network_s *)malloc(sizeof(sa_network_s));
-                                                               ret = __parse_network_data(networkObj, setupConfig->networkData);
-                                                       }
-                                               }                                               
-                                       }
-                               } else {
-                                       ret = -1;
-                                       _E("ConfigObj is not existed");
-                               }
-                               
-                               json_object_put(configObj);
-                               free(jsonData);
-                       } else {
-                               ret = -1;
-                               _E("memory allocation fail for jsonData");
-                       }
-               }
-
-               close(fd);
-       } else {
-               ret = -1;
-               _E("config file can't be opened");
-       }
-
-       return ret;
-}
-
-int sa_systemdata_get_config_info(char *file, sa_config_s *config)
-{
-       sa_error_e ret = SA_ERROR_NONE;
-
-       // check file
-       if (access(file, 0) != 0) {
-               _D("there is no config file");
-               return SA_ERROR_UNKNOWN;
-       }
-       // parsing and fill into struct
-       ret = __parse_config(file, config);
-       if (ret != 0) {
-               _D("ret:DOCKER_STATUS_UNKNOWN --> exit for user recovery");
-               return SA_ERROR_UNKNOWN;
-       }
-
-       return ret;
-}