session: Move the default config create part back to core
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Tue, 2 Oct 2012 14:04:59 +0000 (16:04 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Tue, 2 Oct 2012 14:22:31 +0000 (16:22 +0200)
include/session.h
plugins/session_policy.c
src/session.c

index b8f7a51..63e077b 100644 (file)
@@ -79,6 +79,8 @@ void connman_session_policy_unregister(struct connman_session_policy *config);
 GSList *connman_session_allowed_bearers_any(void);
 void connman_session_free_bearers(GSList *bearers);
 
+struct connman_session_config *connman_session_create_default_config(void);
+
 #ifdef __cplusplus
 }
 #endif
index 5c2c418..98d984a 100644 (file)
@@ -42,20 +42,10 @@ static struct connman_session_config *policy_create(
 
        DBG("session %p", session);
 
-       config = g_try_new0(struct connman_session_config, 1);
+       config = connman_session_create_default_config();
        if (config == NULL)
                return NULL;
 
-       config->priority = FALSE;
-       config->roaming_policy = CONNMAN_SESSION_ROAMING_POLICY_DEFAULT;
-       config->type = CONNMAN_SESSION_TYPE_ANY;
-       config->ecall = FALSE;
-       config->allowed_bearers = connman_session_allowed_bearers_any();
-       if (config->allowed_bearers == NULL) {
-               g_free(config);
-               return NULL;
-       }
-
        g_hash_table_replace(config_hash, session, config);
 
        return config;
index fe1f503..de25f78 100644 (file)
@@ -326,6 +326,27 @@ void connman_session_policy_unregister(struct connman_session_policy *policy)
        remove_policy(policy);
 }
 
+struct connman_session_config *connman_session_create_default_config(void)
+{
+       struct connman_session_config *config;
+
+       config = g_try_new0(struct connman_session_config, 1);
+       if (config == NULL)
+               return NULL;
+
+       config->priority = FALSE;
+       config->roaming_policy = CONNMAN_SESSION_ROAMING_POLICY_DEFAULT;
+       config->type = CONNMAN_SESSION_TYPE_ANY;
+       config->ecall = FALSE;
+       config->allowed_bearers = connman_session_allowed_bearers_any();
+       if (config->allowed_bearers == NULL) {
+               g_free(config);
+               return NULL;
+       }
+
+       return config;
+}
+
 static enum connman_session_type apply_policy_on_type(
                        enum connman_session_type policy,
                        enum connman_session_type type)