session: Add plugin priority
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Wed, 26 Sep 2012 09:05:46 +0000 (11:05 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 27 Sep 2012 08:28:28 +0000 (10:28 +0200)
Support several session configuration plugins at runtime.
Set the default priority to low for the current policy plugin.

include/session.h
plugins/session_policy.c

index fb2f39092cf2096945e00eaa39de71a74673d586..deff0fc5efd4ed0c6244f3ee626f4b67924c54e6 100644 (file)
 extern "C" {
 #endif
 
+#define CONNMAN_SESSION_POLICY_PRIORITY_LOW      -100
+#define CONNMAN_SESSION_POLICY_PRIORITY_DEFAULT     0
+#define CONNMAN_SESSION_POLICY_PRIORITY_HIGH      100
+
 /*
  * The session are identified through the pid is only a temporary solution
  */
 struct connman_session_policy {
        const char *name;
+       int priority;
        int (*get_bool) (const char *id, const char *key, connman_bool_t *val);
        int (*get_string) (const char *id, const char *key, char **val);
 };
index b001ea83c8733c4c44bc844305974540d8630553..acbf154af96ec9c244439a5fb15d7c69ae0d0ccf 100644 (file)
@@ -61,6 +61,7 @@ static int policy_get_string(const char *id, const char *key, char **val)
 
 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,
 };