summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-11-02 17:26:14 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-11-23 13:47:24 +0100
commit562e35614eeb4fb6fde9347c34203e61315846a8 (patch)
tree1d592ad1884044a0f116e8f2bd708cdda51557a1 /src/session.c
parent861a04bab6b19cb275c137f1cdfe559879a79565 (diff)
downloadconnman-562e35614eeb4fb6fde9347c34203e61315846a8.tar.gz
connman-562e35614eeb4fb6fde9347c34203e61315846a8.tar.bz2
connman-562e35614eeb4fb6fde9347c34203e61315846a8.zip
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.
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 77a6c853..68e35626 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)
{