Merge tag 'upstream/1.40' into tizen.
[platform/upstream/connman.git] / vpn / main.c
index ae9c945..e4f4a10 100755 (executable)
 
 #define CONFIGMAINFILE CONFIGDIR "/connman-vpn.conf"
 
-#define DEFAULT_INPUT_REQUEST_TIMEOUT 300 * 1000
-#define DEFAULT_BROWSER_LAUNCH_TIMEOUT 300 * 1000
-
 static GMainLoop *main_loop = NULL;
 
 static unsigned int __terminated = 0;
 
-static struct {
-       unsigned int timeout_inputreq;
-       unsigned int timeout_browserlaunch;
-} connman_vpn_settings  = {
-       .timeout_inputreq = DEFAULT_INPUT_REQUEST_TIMEOUT,
-       .timeout_browserlaunch = DEFAULT_BROWSER_LAUNCH_TIMEOUT,
-};
-
-static GKeyFile *load_config(const char *file)
-{
-       GError *err = NULL;
-       GKeyFile *keyfile;
-
-       keyfile = g_key_file_new();
-
-       g_key_file_set_list_separator(keyfile, ',');
-
-       if (!g_key_file_load_from_file(keyfile, file, 0, &err)) {
-               if (err->code != G_FILE_ERROR_NOENT) {
-                       connman_error("Parsing %s failed: %s", file,
-                                                               err->message);
-               }
-
-               g_error_free(err);
-               g_key_file_free(keyfile);
-               return NULL;
-       }
-
-       return keyfile;
-}
-
-static void parse_config(GKeyFile *config, const char *file)
-{
-       GError *error = NULL;
-       int timeout;
-
-       if (!config)
-               return;
-
-       DBG("parsing %s", file);
-
-       timeout = g_key_file_get_integer(config, "General",
-                       "InputRequestTimeout", &error);
-       if (!error && timeout >= 0)
-               connman_vpn_settings.timeout_inputreq = timeout * 1000;
-
-       g_clear_error(&error);
-}
-
-static int config_init(const char *file)
-{
-       GKeyFile *config;
-
-       config = load_config(file);
-       parse_config(config, file);
-       if (config)
-               g_key_file_free(config);
-
-       return 0;
-}
-
 static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
                                                        gpointer user_data)
 {
@@ -193,7 +129,6 @@ static gchar *option_plugin = NULL;
 static gchar *option_noplugin = NULL;
 static bool option_detach = true;
 static bool option_version = false;
-static bool option_routes = false;
 
 static bool parse_debug(const char *key, const char *value,
                                        gpointer user_data, GError **error)
@@ -220,19 +155,17 @@ static GOptionEntry options[] = {
        { "nodaemon", 'n', G_OPTION_FLAG_REVERSE,
                                G_OPTION_ARG_NONE, &option_detach,
                                "Don't fork daemon to background" },
-       { "routes", 'r', 0, G_OPTION_ARG_NONE, &option_routes,
-                               "Create/delete VPN routes" },
        { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
                                "Show version information and exit" },
        { NULL },
 };
 
+#if defined TIZEN_EXT
 bool connman_setting_get_bool(const char *key)
 {
        return false;
 }
 
-#if defined TIZEN_EXT
 unsigned int connman_setting_get_uint(const char *key)
 {
        return 0;
@@ -242,7 +175,11 @@ int connman_setting_get_int(const char *key)
 {
        return 0;
 }
-#endif
+
+char *connman_setting_get_string(const char *key)
+{
+        return NULL;
+}
 
 char **connman_setting_get_string_list(const char *key)
 {
@@ -254,6 +191,12 @@ unsigned int *connman_setting_get_uint_list(const char *key)
        return NULL;
 }
 
+unsigned int connman_timeout_browser_launch(void)
+{
+       return 0;
+}
+#endif
+
 /*
  * This function will be called from generic src/agent.c code so we have
  * to use connman_ prefix instead of vpn_ one.
@@ -263,16 +206,6 @@ unsigned int connman_timeout_input_request(void)
        return __vpn_settings_get_timeout_inputreq();
 }
 
-unsigned int connman_timeout_browser_launch(void)
-{
-       return connman_vpn_settings.timeout_browserlaunch;
-}
-
-const char *connman_option_get_string(const char *key)
-{
-       return NULL;
-}
-
 int main(int argc, char *argv[])
 {
        GOptionContext *context;
@@ -360,7 +293,7 @@ int main(int argc, char *argv[])
 
        __connman_inotify_init();
        __connman_agent_init();
-       __vpn_provider_init(option_routes);
+       __vpn_provider_init();
        __vpn_manager_init();
        __vpn_ipconfig_init();
        __vpn_rtnl_init();