vpn: Extend vpn driver struct with save support
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 31 Oct 2011 13:31:40 +0000 (15:31 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 7 Nov 2011 16:40:08 +0000 (17:40 +0100)
Add provider save function and register it in the
vpn driver initialization.

plugins/vpn.c
plugins/vpn.h

index 26e2b09dec4263f274f33ae6c93cca81b78de6ca..79ec305f5a07b54644f24c233469c9efc8131de7 100644 (file)
@@ -375,6 +375,20 @@ static int vpn_remove(struct connman_provider *provider)
        return 0;
 }
 
+static int vpn_save (struct connman_provider *provider, GKeyFile *keyfile)
+{
+       struct vpn_driver_data *vpn_driver_data;
+       const char *name;
+
+       name = connman_provider_get_driver_name(provider);
+       vpn_driver_data = g_hash_table_lookup(driver_hash, name);
+       if (vpn_driver_data != NULL &&
+                       vpn_driver_data->vpn_driver->save != NULL)
+               return vpn_driver_data->vpn_driver->save(provider, keyfile);
+
+       return 0;
+}
+
 int vpn_register(const char *name, struct vpn_driver *vpn_driver,
                        const char *program)
 {
@@ -394,6 +408,7 @@ int vpn_register(const char *name, struct vpn_driver *vpn_driver,
        data->provider_driver.connect = vpn_connect;
        data->provider_driver.probe = vpn_probe;
        data->provider_driver.remove = vpn_remove;
+       data->provider_driver.save = vpn_save;
 
        if (driver_hash == NULL) {
                driver_hash = g_hash_table_new_full(g_str_hash,
index 6392aca48bfe4d06d206e63f6ad414179e76a16b..9542ebf134ef0e93e07b7b44e93fa0ae2b94d0b1 100644 (file)
@@ -35,6 +35,7 @@ struct vpn_driver {
                        struct connman_task *task, const char *if_name);
        void (*disconnect) (void);
        int (*error_code) (int exit_code);
+       int (*save) (struct connman_provider *provider, GKeyFile *keyfile);
 };
 
 int vpn_register(const char *name, struct vpn_driver *driver,