includedir = @includedir@/connman
-include_HEADERS = log.h plugin.h driver.h element.h property.h rtnl.h dbus.h
+include_HEADERS = log.h plugin.h security.h driver.h element.h property.h \
+ rtnl.h dbus.h
MAINTAINERCLEANFILES = Makefile.in
--- /dev/null
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __CONNMAN_SECURITY_H
+#define __CONNMAN_SECURITY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <connman/element.h>
+
+#define CONNMAN_SECURITY_PRIORITY_LOW -100
+#define CONNMAN_SECURITY_PRIORITY_DEFAULT 0
+#define CONNMAN_SECURITY_PRIORITY_HIGH 100
+
+struct connman_security {
+ const char *name;
+ int priority;
+ int (*authorize_sender) (const char *sender);
+};
+
+extern int connman_security_register(struct connman_security *security);
+extern void connman_security_unregister(struct connman_security *security);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_SECURITY_H */
sbin_PROGRAMS = connmand
connmand_SOURCES = main.c connman.h log.c plugin.c profile.c element.c \
- storage.c manager.c agent.c rtnl.c
+ security.c storage.c manager.c agent.c rtnl.c
connmand_LDADD = @GDBUS_LIBS@ @GLIB_LIBS@ @GMODULE_LIBS@ @GTHREAD_LIBS@
int __connman_plugin_init(void);
void __connman_plugin_cleanup(void);
+#include <connman/security.h>
+
#include <connman/driver.h>
#include <connman/element.h>
--- /dev/null
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "connman.h"
+
+static GStaticRWLock security_lock = G_STATIC_RW_LOCK_INIT;
+static GSList *security_list = NULL;
+
+static gint compare_priority(gconstpointer a, gconstpointer b)
+{
+ const struct connman_security *security1 = a;
+ const struct connman_security *security2 = b;
+
+ return security2->priority - security1->priority;
+}
+
+int connman_security_register(struct connman_security *security)
+{
+ DBG("security %p name %s", security, security->name);
+
+ g_static_rw_lock_writer_lock(&security_lock);
+
+ security_list = g_slist_insert_sorted(security_list, security,
+ compare_priority);
+
+ g_static_rw_lock_writer_unlock(&security_lock);
+
+ return 0;
+}
+
+void connman_security_unregister(struct connman_security *security)
+{
+ DBG("security %p name %s", security, security->name);
+
+ g_static_rw_lock_writer_lock(&security_lock);
+
+ security_list = g_slist_remove(security_list, security);
+
+ g_static_rw_lock_writer_unlock(&security_lock);
+}