From: Daniel Wagner Date: Fri, 2 Nov 2012 16:26:14 +0000 (+0100) Subject: session: Add sessions config update function X-Git-Tag: 1.10~134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=562e35614eeb4fb6fde9347c34203e61315846a8;p=platform%2Fupstream%2Fconnman.git session: Add sessions config update function Give a policy plugin a way to inform the session core that some of the config values have changed. This could be done in a more clever way, e.g. figure out only to update the necessary info entries but we keep it for now as simple and assume everthing has changed. --- diff --git a/include/session.h b/include/session.h index b93fbc7..f75b751 100644 --- a/include/session.h +++ b/include/session.h @@ -75,6 +75,8 @@ struct connman_session_policy { int connman_session_policy_register(struct connman_session_policy *config); void connman_session_policy_unregister(struct connman_session_policy *config); +int connman_session_config_update(struct connman_session *session); + struct connman_session_config *connman_session_create_default_config(void); #ifdef __cplusplus diff --git a/src/session.c b/src/session.c index 77a6c85..68e3562 100644 --- a/src/session.c +++ b/src/session.c @@ -1341,6 +1341,46 @@ static void session_changed(struct connman_session *session, session_notify(session); } +int connman_session_config_update(struct connman_session *session) +{ + struct session_info *info = session->info; + GSList *allowed_bearers; + int err; + + DBG("session %p", session); + + /* + * We update all configuration even though only one entry + * might have changed. We can still optimize this later. + */ + + err = apply_policy_on_bearers( + session->policy_config->allowed_bearers, + info->config.allowed_bearers, + &allowed_bearers); + if (err < 0) + return err; + + g_slist_free(info->config.allowed_bearers); + info->config.allowed_bearers = allowed_bearers; + + info->config.type = apply_policy_on_type( + session->policy_config->type, + info->config.type); + + info->config.roaming_policy = session->policy_config->roaming_policy; + + info->config.ecall = session->policy_config->ecall; + if (info->config.ecall == TRUE) + ecall_session = session; + + info->config.priority = session->policy_config->priority; + + session_changed(session, CONNMAN_SESSION_TRIGGER_SETTING); + + return 0; +} + static DBusMessage *connect_session(DBusConnection *conn, DBusMessage *msg, void *user_data) {