This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 Makefile.am         |    2 +-
 README              |    6 +-
 configure.ac        |   29 ++--
 gdbus/Makefile.am   |    8 +
 gdbus/gdbus.h       |  133 +++++++++++
 gdbus/mainloop.c    |  305 ++++++++++++++++++++++++
 gdbus/object.c      |  641 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdbus/watch.c       |  353 ++++++++++++++++++++++++++++
 include/Makefile.am |    3 +-
 include/security.h  |   48 ++++
 plugins/Makefile.am |   27 ++-
 plugins/polkit.c    |  127 ++++++++++
 src/Makefile.am     |    6 +-
 src/connman.h       |    2 +
 src/main.c          |    2 +-
 src/security.c      |   62 +++++
 src/storage.c       |   10 +
 17 files changed, 1734 insertions(+), 30 deletions(-)

New commits:
commit 81f05550490e222185736eb198d3d760a636722d
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 02:34:35 2008 +0200

    Create PolicyKit context and register security callbacks

commit 531e3460465e6f493eb0b7de2a3b8a7d8959563d
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 02:32:56 2008 +0200

    Don't use static library for the included libgdbus

commit 6d183c9e8bbce62b4bcb3f26be3176b981615222
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 02:22:38 2008 +0200

    Add security access policy framework

commit 495ba1eff89bd0a466c07c35c57c65cdb7aee39e
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 01:15:49 2008 +0200

    Update requirements

commit e3a4699f34f751d47d8fd8e5a488e4b95343732f
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 01:13:59 2008 +0200

    Add copy of libgdbus helper for easier adoption

commit b7b518712d302a7c372e62582c3b60af4020f13c
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 00:49:21 2008 +0200

    Add skeleton for PolicyKit plugin

commit eff47b478f3af6d4501cafcf716b0895c319c9e5
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 00:39:33 2008 +0200

    Make HAL requirement optional and check for PolicyKit

commit 80de79e829a572a49fabffc08988b835840b4cc6
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Aug 13 00:37:49 2008 +0200

    Disable SQLite example code for now


Diff in this email is a maximum of 400 lines.
diff --git a/Makefile.am b/Makefile.am
index fe127cd..66e0a0b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
 
-SUBDIRS = include src doc test plugins scripts
+SUBDIRS = gdbus include src doc test plugins scripts
 
 pkgconfigdir = $(libdir)/pkgconfig
 
diff --git a/README b/README
index f6be6fb..246b56a 100644
--- a/README
+++ b/README
@@ -11,9 +11,9 @@ In order to compile libgdbus you need following software 
packages:
        - GCC compiler
        - GLib library
        - D-Bus library
-       - GDBus library
-       - HAL library
-       - SQLite3 library
+       - HAL library (optional)
+       - SQLite3 library (optional)
+       - PolicyKit (optional)
 
 To configure run:
        ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
diff --git a/configure.ac b/configure.ac
index 6508cd4..fdb290b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_PATH_PROG(DHCLIENT, [dhclient])
 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant])
 
 PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
-                                AC_MSG_ERROR(glib is required))
+                               AC_MSG_ERROR(glib is required))
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
@@ -59,27 +59,28 @@ PKG_CHECK_MODULES(GMODULE, gmodule-2.0, dummy=yes,
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
-PKG_CHECK_MODULES(GDBUS, gdbus, dummy=yes,
-                               AC_MSG_ERROR(libgdbus is required))
-AC_SUBST(GDBUS_CFLAGS)
-AC_SUBST(GDBUS_LIBS)
-
 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
                                AC_MSG_ERROR(libdbus is required))
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
-PKG_CHECK_MODULES(HAL, hal >= 0.5.8, dummy=yes,
-                               AC_MSG_ERROR(libhal is required))
+AC_SUBST([GDBUS_CFLAGS], ['$(DBUS_CFLAGS) -I$(top_srcdir)/gdbus'])
+AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
+
+PKG_CHECK_MODULES(HAL, hal >= 0.5.8, hal_found=yes, hal_found=no)
 AC_SUBST(HAL_CFLAGS)
 AC_SUBST(HAL_LIBS)
+AM_CONDITIONAL(HAL, test "${hal_found}" = "yes")
+
+PKG_CHECK_MODULES(POLKIT, polkit-dbus >= 0.7, polkit_found=yes, 
polkit_found=no)
+AC_SUBST(POLKIT_CFLAGS)
+AC_SUBST(POLKIT_LIBS)
+AM_CONDITIONAL(POLKIT, test "${polkit_found}" = "yes")
 
-PKG_CHECK_MODULES(SQLITE, sqlite3, dummy=yes,
-                               AC_MSG_ERROR(sqlite3 is required))
+PKG_CHECK_MODULES(SQLITE, sqlite3, sqlite_found=yes, sqlite_found=no)
 AC_SUBST(SQLITE_CFLAGS)
 AC_SUBST(SQLITE_LIBS)
 
-AC_OUTPUT(Makefile include/Makefile src/Makefile doc/Makefile
-                       test/Makefile plugins/Makefile scripts/Makefile
-                       scripts/connman src/connman.service connman.pc)
-                       
+AC_OUTPUT(Makefile gdbus/Makefile include/Makefile src/Makefile doc/Makefile
+                               test/Makefile plugins/Makefile scripts/Makefile
+                               scripts/connman src/connman.service connman.pc)
diff --git a/gdbus/Makefile.am b/gdbus/Makefile.am
new file mode 100644
index 0000000..9447555
--- /dev/null
+++ b/gdbus/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LTLIBRARIES = libgdbus.la
+
+libgdbus_la_SOURCES = gdbus.h mainloop.c object.c watch.c
+
+AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
new file mode 100644
index 0000000..b44bc86
--- /dev/null
+++ b/gdbus/gdbus.h
@@ -0,0 +1,133 @@
+/*
+ *
+ *  D-Bus helper library
+ *
+ *  Copyright (C) 2004-2008  Marcel Holtmann <[EMAIL PROTECTED]>
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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 __GDBUS_H
+#define __GDBUS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <dbus/dbus.h>
+#include <glib.h>
+
+typedef void (* GDBusWatchFunction) (void *user_data);
+
+typedef gboolean (* GDBusSignalFunction) (DBusConnection *connection,
+                                       DBusMessage *message, void *user_data);
+
+DBusConnection *g_dbus_setup_bus(DBusBusType type, const char *name,
+                                                       DBusError *error);
+
+gboolean g_dbus_request_name(DBusConnection *connection, const char *name,
+                                                       DBusError *error);
+
+gboolean g_dbus_set_disconnect_function(DBusConnection *connection,
+                               GDBusWatchFunction function,
+                               void *user_data, DBusFreeFunction destroy);
+
+typedef void (* GDBusDestroyFunction) (void *user_data);
+
+typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
+                                       DBusMessage *message, void *user_data);
+
+typedef enum {
+       G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
+       G_DBUS_METHOD_FLAG_NOREPLY    = (1 << 1),
+       G_DBUS_METHOD_FLAG_ASYNC      = (1 << 2),
+} GDBusMethodFlags;
+
+typedef enum {
+       G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0),
+} GDBusSignalFlags;
+
+typedef enum {
+       G_DBUS_PROPERTY_FLAG_DEPRECATED = (1 << 0),
+} GDBusPropertyFlags;
+
+typedef struct {
+       const char *name;
+       const char *signature;
+       const char *reply;
+       GDBusMethodFunction function;
+       GDBusMethodFlags flags;
+} GDBusMethodTable;
+
+typedef struct {
+       const char *name;
+       const char *signature;
+       GDBusSignalFlags flags;
+} GDBusSignalTable;
+
+typedef struct {
+       const char *name;
+       const char *type;
+       GDBusPropertyFlags flags;
+} GDBusPropertyTable;
+
+gboolean g_dbus_register_interface(DBusConnection *connection,
+                                       const char *path, const char *name,
+                                       GDBusMethodTable *methods,
+                                       GDBusSignalTable *signals,
+                                       GDBusPropertyTable *properties,
+                                       void *user_data,
+                                       GDBusDestroyFunction destroy);
+gboolean g_dbus_unregister_interface(DBusConnection *connection,
+                                       const char *path, const char *name);
+
+DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
+                                               const char *format, ...);
+DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
+                                       const char *format, va_list args);
+DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...);
+DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
+                                               int type, va_list args);
+
+gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message);
+gboolean g_dbus_send_reply(DBusConnection *connection,
+                               DBusMessage *message, int type, ...);
+gboolean g_dbus_send_reply_valist(DBusConnection *connection,
+                               DBusMessage *message, int type, va_list args);
+
+gboolean g_dbus_emit_signal(DBusConnection *connection,
+                               const char *path, const char *interface,
+                               const char *name, int type, ...);
+gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
+                               const char *path, const char *interface,
+                               const char *name, int type, va_list args);
+
+guint g_dbus_add_disconnect_watch(DBusConnection *connection,
+                               const char *name,
+                               GDBusWatchFunction function,
+                               void *user_data, GDBusDestroyFunction destroy);
+guint g_dbus_add_signal_watch(DBusConnection *connection,
+                               const char *rule, GDBusSignalFunction function,
+                               void *user_data, GDBusDestroyFunction destroy);
+gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
+void g_dbus_remove_all_watches(DBusConnection *connection);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GDBUS_H */
diff --git a/gdbus/mainloop.c b/gdbus/mainloop.c
new file mode 100644
index 0000000..b50d83c
--- /dev/null
+++ b/gdbus/mainloop.c
@@ -0,0 +1,305 @@
+/*
+ *
+ *  D-Bus helper library
+ *
+ *  Copyright (C) 2004-2008  Marcel Holtmann <[EMAIL PROTECTED]>
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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 <stdint.h>
+
+#include <glib.h>
+#include <dbus/dbus.h>
+
+#ifdef NEED_DBUS_WATCH_GET_UNIX_FD
+#define dbus_watch_get_unix_fd dbus_watch_get_fd
+#endif
+
+#include "gdbus.h"
+
+#define DISPATCH_TIMEOUT  0
+
+#define info(fmt...)
+#define error(fmt...)
+#define debug(fmt...)
+
+typedef struct {
+       uint32_t id;
+       DBusTimeout *timeout;
+} timeout_handler_t;
+
+struct watch_info {
+       guint watch_id;
+       GIOChannel *io;
+       DBusConnection *conn;
+};
+
+struct server_info {
+       guint watch_id;
+       GIOChannel *io;
+       DBusServer *server;
+};
+
+struct disconnect_data {
+       void (*disconnect_cb)(void *);
+       void *user_data;
+};
+
+static DBusHandlerResult disconnect_filter(DBusConnection *conn,
+                                               DBusMessage *msg, void *data)
+{
+       struct disconnect_data *dc_data = data;
+
+       if (dbus_message_is_signal(msg,
+                       DBUS_INTERFACE_LOCAL, "Disconnected") == TRUE) {
+               error("Got disconnected from the system message bus");
+               dbus_connection_unref(conn);
+               dc_data->disconnect_cb(dc_data->user_data);
+       }
+
+       return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static gboolean message_dispatch_cb(void *data)
+{
+       DBusConnection *connection = data;
+
+       dbus_connection_ref(connection);
+
+       /* Dispatch messages */
+       while (dbus_connection_dispatch(connection) == 
DBUS_DISPATCH_DATA_REMAINS);
+
+       dbus_connection_unref(connection);
+
+       return FALSE;
+}
+
+static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
+{
+       DBusWatch *watch = data;
+       struct watch_info *info = dbus_watch_get_data(watch);
+       int flags = 0;
+
+       if (cond & G_IO_IN)  flags |= DBUS_WATCH_READABLE;
+       if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
+       if (cond & G_IO_HUP) flags |= DBUS_WATCH_HANGUP;
+       if (cond & G_IO_ERR) flags |= DBUS_WATCH_ERROR;
+
+       dbus_watch_handle(watch, flags);
+
+       if (dbus_connection_get_dispatch_status(info->conn) == 
DBUS_DISPATCH_DATA_REMAINS)
+               g_timeout_add(DISPATCH_TIMEOUT, message_dispatch_cb, 
info->conn);
+
+       return TRUE;
+}
+
+static dbus_bool_t add_watch(DBusWatch *watch, void *data)
+{
+       GIOCondition cond = G_IO_HUP | G_IO_ERR;
+       DBusConnection *conn = data;
+       struct watch_info *info;
+       int fd, flags;
+
+       if (!dbus_watch_get_enabled(watch))
+               return TRUE;
+
+       info = g_new(struct watch_info, 1);
+
+       fd = dbus_watch_get_unix_fd(watch);
+       info->io = g_io_channel_unix_new(fd);
+       info->conn = dbus_connection_ref(conn);
+
+       dbus_watch_set_data(watch, info, NULL);
+
+       flags = dbus_watch_get_flags(watch);
+
+       if (flags & DBUS_WATCH_READABLE) cond |= G_IO_IN;
+       if (flags & DBUS_WATCH_WRITABLE) cond |= G_IO_OUT;
+
+       info->watch_id = g_io_add_watch(info->io, cond, watch_func, watch);
+
+       return TRUE;
+}
+
+static void remove_watch(DBusWatch *watch, void *data)
+{
+       struct watch_info *info = dbus_watch_get_data(watch);
+
+       dbus_watch_set_data(watch, NULL, NULL);
+
+       if (info) {
+               g_source_remove(info->watch_id);
+               g_io_channel_unref(info->io);
+               dbus_connection_unref(info->conn);
+               g_free(info);
+       }
+}
+
+static void watch_toggled(DBusWatch *watch, void *data)
+{
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to