Basic types are not used for the configuration anymore.
struct connman_session_policy {
const char *name;
int priority;
- int (*get_bool) (struct connman_session *session,
- const char *key, connman_bool_t *val);
- int (*get_string) (struct connman_session *session,
- const char *key, char **val);
struct connman_session_config *(*create)(
struct connman_session *session);
void (*destroy)(struct connman_session *session);
GSList *connman_session_allowed_bearers_any(void);
-int connman_session_update_bool(struct connman_session *session, const char *key,
- connman_bool_t val);
-int connman_session_update_string(struct connman_session *session, const char *key,
- const char *val);
#ifdef __cplusplus
}
static GHashTable *config_hash;
-static int policy_get_bool(struct connman_session *session,
- const char *key, connman_bool_t *val)
-{
- DBG("sesion %p key %s", session, key);
-
- if (g_str_equal(key, "Priority") == TRUE)
- *val = FALSE;
- else if (g_str_equal(key, "EmergencyCall") == TRUE)
- *val = FALSE;
- else
- return -EINVAL;
-
- return 0;
-}
-
-static int policy_get_string(struct connman_session *session,
- const char *key, char **val)
-{
- DBG("session %p key %s", session, key);
-
- if (g_str_equal(key, "RoamingPolicy") == TRUE)
- *val = "default";
- else
- return -EINVAL;
-
- return 0;
-}
-
static struct connman_session_config *policy_create(
struct connman_session *session)
{
static struct connman_session_policy session_policy = {
.name = "session policy configuration",
.priority = CONNMAN_SESSION_POLICY_PRIORITY_LOW,
- .get_bool = policy_get_bool,
- .get_string = policy_get_string,
.create = policy_create,
.destroy = policy_destroy,
};
return policy2->priority - policy1->priority;
}
-int connman_session_update_bool(struct connman_session *session, const char *key,
- connman_bool_t val)
-{
- struct session_info *info;
-
- if (session == NULL)
- return -EINVAL;
-
- info = session->info;
- if (info == NULL)
- return 0;
-
- DBG("%s %d", key, val);
-
- return -EINVAL;
-}
-
-int connman_session_update_string(struct connman_session *session, const char *key,
- const char *val)
-{
- struct session_info *info;
-
- if (session == NULL)
- return -EINVAL;
-
- info = session->info;
- if (info == NULL)
- return 0;
-
- DBG("%s %s", key, val);
-
- return -EINVAL;
-}
int connman_session_policy_register(struct connman_session_policy *policy)
{