From: Daniel Wagner Date: Wed, 26 Sep 2012 09:03:29 +0000 (+0200) Subject: session: Rename session_config to session_policy X-Git-Tag: 1.8~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=864d1fda21f25216d9dc592f8c2d034d3723bddf;p=platform%2Fupstream%2Fconnman.git session: Rename session_config to session_policy --- diff --git a/include/session.h b/include/session.h index 5aa3e5e..fb2f390 100644 --- a/include/session.h +++ b/include/session.h @@ -31,14 +31,14 @@ extern "C" { /* * The session are identified through the pid is only a temporary solution */ -struct connman_session_config { +struct connman_session_policy { const char *name; int (*get_bool) (const char *id, const char *key, connman_bool_t *val); int (*get_string) (const char *id, const char *key, char **val); }; -int connman_session_config_register(struct connman_session_config *config); -void connman_session_config_unregister(struct connman_session_config *config); +int connman_session_policy_register(struct connman_session_policy *config); +void connman_session_policy_unregister(struct connman_session_policy *config); int connman_session_update_bool(const char *id, const char *key, connman_bool_t val); diff --git a/plugins/session_policy.c b/plugins/session_policy.c index 626d9bb..b001ea8 100644 --- a/plugins/session_policy.c +++ b/plugins/session_policy.c @@ -33,7 +33,7 @@ #include #include -static int config_get_bool(const char *id, const char *key, connman_bool_t *val) +static int policy_get_bool(const char *id, const char *key, connman_bool_t *val) { DBG("id %s key %s", id, key); @@ -47,7 +47,7 @@ static int config_get_bool(const char *id, const char *key, connman_bool_t *val) return 0; } -static int config_get_string(const char *id, const char *key, char **val) +static int policy_get_string(const char *id, const char *key, char **val) { DBG("id %s key %s", id, key); @@ -59,28 +59,28 @@ static int config_get_string(const char *id, const char *key, char **val) return 0; } -static struct connman_session_config session_config = { +static struct connman_session_policy session_policy = { .name = "session policy configuration", - .get_bool = config_get_bool, - .get_string = config_get_string, + .get_bool = policy_get_bool, + .get_string = policy_get_string, }; -static int session_config_init(void) +static int session_policy_init(void) { int err; - err = connman_session_config_register(&session_config); + err = connman_session_policy_register(&session_policy); if (err < 0) return err; return 0; } -static void session_config_exit(void) +static void session_policy_exit(void) { - connman_session_config_unregister(&session_config); + connman_session_policy_unregister(&session_policy); } CONNMAN_PLUGIN_DEFINE(session_policy, "Session policy configuration plugin", VERSION, CONNMAN_PLUGIN_PRIORITY_DEFAULT, - session_config_init, session_config_exit) + session_policy_init, session_policy_exit) diff --git a/src/session.c b/src/session.c index 96b2e59..24fdf9a 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 struct connman_session_policy *session_policy; enum connman_session_trigger { CONNMAN_SESSION_TRIGGER_UNKNOWN = 0, @@ -252,24 +252,24 @@ 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 policy_get_bool(const char *id, const char *key, connman_bool_t *val) { - if (session_config == NULL) { + if (session_policy == NULL) { *val = FALSE; return -EINVAL; } - return (*session_config->get_bool)(id, key, val); + return (*session_policy->get_bool)(id, key, val); } -static int config_get_string(const char *id, const char *key, char **val) +static int policy_get_string(const char *id, const char *key, char **val) { - if (session_config == NULL) { + if (session_policy == NULL) { *val = NULL; return -EINVAL; } - return (*session_config->get_string)(id, key, val); + return (*session_policy->get_string)(id, key, val); } static void cleanup_bearer_info(gpointer data, gpointer user_data) @@ -1486,9 +1486,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); + policy_get_bool(owner, "Priority", &priority); + policy_get_bool(owner, "EmergencyCall", &ecall_app); + policy_get_string(owner, "RoamingPolicy", &roaming_policy_str); roaming_policy = string2roamingpolicy(roaming_policy_str); session->owner = g_strdup(owner); @@ -1812,34 +1812,34 @@ int connman_session_update_string(const char *id, const char *key, return -EINVAL; } -int connman_session_config_register(struct connman_session_config *config) +int connman_session_policy_register(struct connman_session_policy *policy) { - DBG("name %s", config->name); + DBG("name %s", policy->name); - if (session_config != NULL) { - connman_warn("A session configuration plugin '%s' is " + if (session_policy != NULL) { + connman_warn("A session policy plugin '%s' is " "already registerd. Skipping registration " "of plugin '%s'", - session_config->name, config->name); + session_policy->name, policy->name); return -EALREADY; } - session_config = config; + session_policy = policy; return 0; } -void connman_session_config_unregister(struct connman_session_config *config) +void connman_session_policy_unregister(struct connman_session_policy *policy) { - DBG("name %s", config->name); + DBG("name %s", policy->name); - if (config != session_config) { - connman_warn("Trying to unregister session configuration " - "plugin '%s'", config->name); + if (policy != session_policy) { + connman_warn("Trying to unregister session policy " + "plugin '%s'", policy->name); return; } - session_config = NULL; + session_policy = NULL; } int __connman_session_init(void)