From: Daniel Wagner <daniel.wag...@bmw-carit.de> And support per session configuration plugin. Obviously, this patch itsel is not complete. The code for assigning a configuration plugin to session->config follows in the next patches. --- src/session.c | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-)
diff --git a/src/session.c b/src/session.c index 4c5b55c..7e6d2c5 100644 --- a/src/session.c +++ b/src/session.c @@ -36,7 +36,7 @@ static DBusConnection *connection; static GHashTable *session_hash; static connman_bool_t sessionmode; static struct connman_session *ecall_session; -static struct connman_session_config *session_config; +static GSList *config_list; enum connman_session_trigger { CONNMAN_SESSION_TRIGGER_UNKNOWN = 0, @@ -103,6 +103,8 @@ struct connman_session { char *notify_path; guint notify_watch; + struct connman_session_config *config; + connman_bool_t append_all; struct session_info *info; struct session_info *info_last; @@ -253,24 +255,27 @@ static char *service2bearer(enum connman_service_type type) return ""; } -static int config_get_bool(const char *id, const char *key, connman_bool_t *val) +static int config_get_bool(struct connman_session *session, const char *id, + const char *key, connman_bool_t *val) { - if (session_config == NULL) { + if (session->config == NULL) { *val = FALSE; return -EINVAL; } - return (*session_config->get_bool)(id, key, val); + return (*session->config->get_bool)(id, key, val); } -static int config_get_string(const char *id, const char *key, char **val) +static int config_get_string(struct connman_session *session, const char *id, + const char *key, char **val) { - if (session_config == NULL) { + if (session->config == NULL) { *val = NULL; return -EINVAL; } - return (*session_config->get_string)(id, key, val); + return (*session->config->get_string)(id, key, val); +} } static struct connman_session *session_lookup_by_id(const char *id) @@ -339,30 +344,12 @@ int connman_session_config_register(struct connman_session_config *config) { DBG("name %s", config->name); - if (session_config != NULL) { - connman_warn("A session configuration plugin '%s' is " - "already registerd. Skipping registration " - "of plugin '%s'", - session_config->name, config->name); - return -EALREADY; - } - - session_config = config; - return 0; } void connman_session_config_unregister(struct connman_session_config *config) { DBG("name %s", config->name); - - if (config != session_config) { - connman_warn("Trying to unregister session configuration " - "plugin '%s'", config->name); - return; - } - - session_config = NULL; } static void cleanup_bearer_info(gpointer data, gpointer user_data) @@ -1607,9 +1594,9 @@ int __connman_session_create(DBusMessage *msg) info = session->info; info_last = session->info_last; - config_get_bool(owner, "Priority", &priority); - config_get_bool(owner, "EmergencyCall", &ecall_app); - config_get_string(owner, "RoamingPolicy", &roaming_policy_str); + config_get_bool(session, owner, "Priority", &priority); + config_get_bool(session, owner, "EmergencyCall", &ecall_app); + config_get_string(session, owner, "RoamingPolicy", &roaming_policy_str); roaming_policy = string2roamingpolicy(roaming_policy_str); session->owner = g_strdup(owner); -- 1.7.12.315.g682ce8b _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman