summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-11-02 17:26:22 +0100
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-11-23 13:47:24 +0100
commitc428442146285cac169ea7a29b0fe7d928fda997 (patch)
treeec8764f3d638bbda5e63153ff08f6eab39d08883 /plugins
parent45262413ee024ee540f603a55cea33b1ba352c23 (diff)
downloadconnman-c428442146285cac169ea7a29b0fe7d928fda997.tar.gz
connman-c428442146285cac169ea7a29b0fe7d928fda997.tar.bz2
connman-c428442146285cac169ea7a29b0fe7d928fda997.zip
session_policy_ivi: Add hash table to track idents
Introduce the second hash table which tracks the config object lifetime based on the file existens. The parsing of the file and creation of the config object is part of the next patch.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/session_policy_ivi.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/session_policy_ivi.c b/plugins/session_policy_ivi.c
index b5c3685a..039f3b4e 100644
--- a/plugins/session_policy_ivi.c
+++ b/plugins/session_policy_ivi.c
@@ -24,6 +24,7 @@
#endif
#include <errno.h>
+#include <string.h>
#include <glib.h>
@@ -35,6 +36,8 @@
#include <connman/session.h>
#include <connman/dbus.h>
+#define POLICYDIR STORAGEDIR "/session_policy_ivi"
+
static DBusConnection *connection;
static GHashTable *policy_hash;
@@ -238,6 +241,42 @@ static struct connman_session_policy session_policy_ivi = {
.destroy = policy_ivi_destroy,
};
+static int load_policy(struct policy_data *policy)
+{
+ return 0;
+}
+
+static int read_policies(void)
+{
+ GDir *dir;
+ int err = 0;
+
+ DBG("");
+
+ dir = g_dir_open(POLICYDIR, 0, NULL);
+ if (dir != NULL) {
+ const gchar *file;
+
+ while ((file = g_dir_read_name(dir)) != NULL) {
+ struct policy_data *policy;
+
+ policy = create_policy(file);
+ if (policy == NULL) {
+ err = -ENOMEM;
+ break;
+ }
+
+ err = load_policy(policy);
+ if (err < 0)
+ break;
+ }
+
+ g_dir_close(dir);
+ }
+
+ return err;
+}
+
static int session_policy_ivi_init(void)
{
int err;
@@ -266,6 +305,10 @@ static int session_policy_ivi_init(void)
goto err;
}
+ err = read_policies();
+ if (err < 0)
+ goto err;
+
return 0;
err: