service: Add setter for config information
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Tue, 5 Jun 2012 08:24:04 +0000 (11:24 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 11 Jun 2012 10:01:48 +0000 (13:01 +0300)
Save config information (file name and section id) for
provisioned services. The information is used to remove the
service when config file is removed.

src/connman.h
src/service.c

index 388e6fb..5f55263 100644 (file)
@@ -622,6 +622,8 @@ int __connman_service_disconnect_all(void);
 void __connman_service_auto_connect(void);
 
 void __connman_service_provision_changed(const char *ident);
+void __connman_service_set_config(struct connman_service *service,
+                               const char *file_id, const char *section);
 
 const char *__connman_service_type2string(enum connman_service_type type);
 enum connman_service_type __connman_service_string2type(const char *str);
index 6d4f46e..b210dff 100644 (file)
@@ -118,6 +118,8 @@ struct connman_service {
        connman_bool_t do_split_routing;
        connman_bool_t new_service;
        connman_bool_t hidden_service;
+       char *config_file;
+       char *config_entry;
 };
 
 struct find_data {
@@ -3994,6 +3996,8 @@ static void service_free(gpointer user_data)
        g_free(service->private_key_file);
        g_free(service->private_key_passphrase);
        g_free(service->phase2);
+       g_free(service->config_file);
+       g_free(service->config_entry);
 
        if (service->stats.timer != NULL)
                g_timer_destroy(service->stats.timer);
@@ -5447,6 +5451,19 @@ void __connman_service_provision_changed(const char *ident)
        g_sequence_foreach(service_list, provision_changed, (void *)ident);
 }
 
+void __connman_service_set_config(struct connman_service *service,
+                               const char *file_id, const char *entry)
+{
+       if (service == NULL)
+               return;
+
+       g_free(service->config_file);
+       service->config_file = g_strdup(file_id);
+
+       g_free(service->config_entry);
+       service->config_entry = g_strdup(entry);
+}
+
 /**
  * __connman_service_get:
  * @identifier: service identifier