diff options
-rw-r--r-- | plugins/session_policy_ivi.c | 43 |
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: |