PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Thu Jul 31 14:41:33 PDT 2008


 Makefile.am                                                  |    2 
 configure.in                                                 |    1 
 polkit-backendd/Makefile.am                                  |   61 ++
 polkit-backendd/main.c                                       |  169 +++++++
 polkit-backendd/org.freedesktop.PolicyKit.Backend.conf.in    |   11 
 polkit-backendd/org.freedesktop.PolicyKit.Backend.service.in |    4 
 polkit-backendd/org.freedesktop.PolicyKit.Backend.xml        |   13 
 polkit-backendd/polkit-daemon-backend.c                      |  258 +++++++++++
 polkit-backendd/polkit-daemon-backend.h                      |   78 +++
 9 files changed, 596 insertions(+), 1 deletion(-)

New commits:
commit 08df76203a0250ea2c9ac0980286909887d8abab
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Jul 31 17:40:12 2008 -0400

    add backend daemon
    
    It's not right useful right now; it only says Hello() like a parrot
    
     $ dbus-send --print-reply --system --dest=org.freedesktop.PolicyKit.Backend / org.freedesktop.PolicyKit.Backend.Hello string:Hi!
     method return sender=:1.5180 -> dest=:1.5188 reply_serial=2
        string "You said 'Hi!'"

diff --git a/Makefile.am b/Makefile.am
index 915d689..4e88e9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = data src doc tools policy po test
+SUBDIRS = data src polkit-backendd doc tools policy po test
 
 # Creating ChangeLog from git log (taken from cairo/Makefile.am):
 ChangeLog: $(srcdir)/ChangeLog
diff --git a/configure.in b/configure.in
index 128289c..50b3ae0 100644
--- a/configure.in
+++ b/configure.in
@@ -567,6 +567,7 @@ src/Makefile
 src/kit/Makefile
 src/polkit/Makefile
 src/polkit-grant/Makefile
+polkit-backendd/Makefile
 tools/Makefile
 doc/Makefile
 doc/version.xml
diff --git a/polkit-backendd/Makefile.am b/polkit-backendd/Makefile.am
new file mode 100644
index 0000000..7505b43
--- /dev/null
+++ b/polkit-backendd/Makefile.am
@@ -0,0 +1,61 @@
+## Process this file with automake to produce Makefile.in
+
+INCLUDES = \
+	-I$(top_builddir)/src -I$(top_srcdir)/src \
+	-DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
+	-DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+	-DPACKAGE_BIN_DIR=\""$(bindir)"\" \
+	-DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\" \
+	-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+	-DPACKAGE_LIB_DIR=\""$(libdir)"\" \
+	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT	\
+	-DPOLKIT_COMPILATION \
+	$(DBUS_GLIB_CFLAGS) \
+	@GLIB_CFLAGS@
+
+BUILT_SOURCES =						\
+	polkit-daemon-backend-glue.h
+
+polkit-daemon-backend-glue.h: org.freedesktop.PolicyKit.Backend.xml Makefile.am
+	dbus-binding-tool --prefix=polkit_daemon_backend --mode=glib-server --output=polkit-daemon-backend-glue.h org.freedesktop.PolicyKit.Backend.xml
+
+libexec_PROGRAMS = polkit-backendd
+
+polkit_backendd_SOURCES = 						\
+	polkit-daemon-backend.h		polkit-daemon-backend.c		\
+	main.c								\
+	$(BUILT_SOURCES)
+
+polkit_backendd_CPPFLAGS = 					\
+	-I$(top_srcdir)/src					\
+	-DG_LOG_DOMAIN=\"polkit_backendd\"			\
+	-DDATADIR=\""$(pkgdatadir)"\"				\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"		\
+	$(DISABLE_DEPRECATED)					\
+	$(AM_CPPFLAGS)
+
+polkit_backendd_LDADD = 				        \
+	$(DBUS_GLIB_LIBS) $(top_builddir)/src/polkit/libpolkit-1.la
+
+
+servicedir       = $(datadir)/dbus-1/system-services
+service_in_files = org.freedesktop.PolicyKit.Backend.service.in
+service_DATA     = $(service_in_files:.service.in=.service)
+
+$(service_DATA): $(service_in_files) Makefile
+	@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+
+dbusconfdir = $(sysconfdir)/dbus-1/system.d
+dbusconf_in_files = org.freedesktop.PolicyKit.Backend.conf.in
+dbusconf_DATA = $(dbusconf_in_files:.conf.in=.conf)
+
+$(dbusconf_DATA): $(dbusconf_in_files) Makefile
+	@sed -e "s|\@polkituser\@|$(POLKIT_USER)|" $< > $@
+
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = org.freedesktop.PolicyKit.Backend.xml $(service_in_files) $(dbusconf_in_files)
+
+clean-local :
+	rm -f *~ $(service_DATA) $(dbusconf_DATA)
diff --git a/polkit-backendd/main.c b/polkit-backendd/main.c
new file mode 100644
index 0000000..67f6e15
--- /dev/null
+++ b/polkit-backendd/main.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 David Zeuthen <david at fubar.dk>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <grp.h>
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <glib-object.h>
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "polkit-daemon-backend.h"
+
+#define NAME_TO_CLAIM "org.freedesktop.PolicyKit.Backend"
+
+static gboolean
+acquire_name_on_proxy (DBusGProxy *bus_proxy)
+{
+        GError     *error;
+        guint       result;
+        gboolean    res;
+        gboolean    ret;
+
+        ret = FALSE;
+
+        if (bus_proxy == NULL) {
+                goto out;
+        }
+
+        error = NULL;
+	res = dbus_g_proxy_call (bus_proxy,
+                                 "RequestName",
+                                 &error,
+                                 G_TYPE_STRING, NAME_TO_CLAIM,
+                                 G_TYPE_UINT, 0,
+                                 G_TYPE_INVALID,
+                                 G_TYPE_UINT, &result,
+                                 G_TYPE_INVALID);
+        if (! res) {
+                if (error != NULL) {
+                        g_warning ("Failed to acquire %s: %s", NAME_TO_CLAIM, error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Failed to acquire %s", NAME_TO_CLAIM);
+                }
+                goto out;
+	}
+
+ 	if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+                if (error != NULL) {
+                        g_warning ("Failed to acquire %s: %s", NAME_TO_CLAIM, error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Failed to acquire %s", NAME_TO_CLAIM);
+                }
+                goto out;
+        }
+
+        ret = TRUE;
+
+ out:
+        return ret;
+}
+
+int
+main (int argc, char **argv)
+{
+        GError              *error;
+        GMainLoop           *loop;
+        PolKitDaemonBackend *daemon;
+        GOptionContext      *context;
+        DBusGProxy          *bus_proxy;
+        DBusGConnection     *bus;
+        int                  ret;
+        static gboolean     no_exit      = FALSE;
+        static GOptionEntry entries []   = {
+                { "no-exit", 0, 0, G_OPTION_ARG_NONE, &no_exit, "Don't exit after 30 seconds of inactivity", NULL },
+                { NULL }
+        };
+
+        ret = 1;
+
+        g_type_init ();
+
+        context = g_option_context_new ("PolicyKit backend daemon");
+        g_option_context_add_main_entries (context, entries, NULL);
+        g_option_context_parse (context, &argc, &argv, NULL);
+        g_option_context_free (context);
+
+        error = NULL;
+        bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+        if (bus == NULL) {
+                g_warning ("Couldn't connect to system bus: %s", error->message);
+                g_error_free (error);
+                goto out;
+        }
+
+	bus_proxy = dbus_g_proxy_new_for_name (bus,
+                                               DBUS_SERVICE_DBUS,
+                                               DBUS_PATH_DBUS,
+                                               DBUS_INTERFACE_DBUS);
+        if (bus_proxy == NULL) {
+                g_warning ("Could not construct bus_proxy object; bailing out");
+                goto out;
+        }
+
+        if (!acquire_name_on_proxy (bus_proxy) ) {
+                g_warning ("Could not acquire name; bailing out");
+                goto out;
+        }
+
+        g_debug ("Starting polkit-backendd version %s", VERSION);
+
+        daemon = polkit_daemon_backend_new (no_exit);
+
+        if (daemon == NULL) {
+                goto out;
+        }
+
+        loop = g_main_loop_new (NULL, FALSE);
+
+        g_main_loop_run (loop);
+
+        g_object_unref (daemon);
+        g_main_loop_unref (loop);
+        ret = 0;
+
+out:
+        return ret;
+}
diff --git a/polkit-backendd/org.freedesktop.PolicyKit.Backend.conf.in b/polkit-backendd/org.freedesktop.PolicyKit.Backend.conf.in
new file mode 100644
index 0000000..470c6a5
--- /dev/null
+++ b/polkit-backendd/org.freedesktop.PolicyKit.Backend.conf.in
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <!-- Only @polkituser@ can own the service -->
+  <policy user="root">
+    <allow own="org.freedesktop.PolicyKit.Backend"/>
+  </policy>
+</busconfig>
diff --git a/polkit-backendd/org.freedesktop.PolicyKit.Backend.service.in b/polkit-backendd/org.freedesktop.PolicyKit.Backend.service.in
new file mode 100644
index 0000000..8769bd7
--- /dev/null
+++ b/polkit-backendd/org.freedesktop.PolicyKit.Backend.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.freedesktop.PolicyKit.Backend
+Exec=@libexecdir@/polkit-backendd
+User=root
diff --git a/polkit-backendd/org.freedesktop.PolicyKit.Backend.xml b/polkit-backendd/org.freedesktop.PolicyKit.Backend.xml
new file mode 100644
index 0000000..e1dc167
--- /dev/null
+++ b/polkit-backendd/org.freedesktop.PolicyKit.Backend.xml
@@ -0,0 +1,13 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/">
+
+  <interface name="org.freedesktop.PolicyKit.Backend">
+
+    <method name="Hello">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg name="message" direction="in" type="s"/>
+      <arg name="result" direction="out" type="s"/>
+    </method>
+
+  </interface>
+</node>
diff --git a/polkit-backendd/polkit-daemon-backend.c b/polkit-backendd/polkit-daemon-backend.c
new file mode 100644
index 0000000..9e56b15
--- /dev/null
+++ b/polkit-backendd/polkit-daemon-backend.c
@@ -0,0 +1,258 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 David Zeuthen <david at fubar.dk>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <glib-object.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "polkit-daemon-backend.h"
+
+static gboolean no_exit = FALSE;
+
+/*--------------------------------------------------------------------------------------------------------------*/
+#include "polkit-daemon-backend-glue.h"
+
+static gboolean
+do_exit (gpointer user_data)
+{
+        g_debug ("Exiting due to inactivity");
+        exit (1);
+        return FALSE;
+}
+
+static void
+reset_killtimer (void)
+{
+        static guint timer_id = 0;
+
+        if (no_exit)
+                return;
+
+        if (timer_id > 0) {
+                g_source_remove (timer_id);
+        }
+        g_debug ("Setting killtimer to 30 seconds...");
+        timer_id = g_timeout_add (30 * 1000, do_exit, NULL);
+}
+
+struct PolKitDaemonBackendPrivate
+{
+        DBusGConnection *system_bus_connection;
+        DBusGProxy      *system_bus_proxy;
+        PolKitContext   *pk_context;
+        PolKitTracker   *pk_tracker;
+};
+
+static void     polkit_daemon_backend_class_init  (PolKitDaemonBackendClass *klass);
+static void     polkit_daemon_backend_init        (PolKitDaemonBackend      *seat);
+static void     polkit_daemon_backend_finalize    (GObject     *object);
+
+G_DEFINE_TYPE (PolKitDaemonBackend, polkit_daemon_backend, G_TYPE_OBJECT)
+
+#define POLKIT_DAEMON_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), POLKIT_TYPE_DAEMON_BACKEND, PolKitDaemonBackendPrivate))
+
+GQuark
+polkit_daemon_backend_error_quark (void)
+{
+        static GQuark ret = 0;
+
+        if (ret == 0) {
+                ret = g_quark_from_static_string ("polkit_daemon_backend_error");
+        }
+
+        return ret;
+}
+
+
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+polkit_daemon_backend_error_get_type (void)
+{
+        static GType etype = 0;
+        
+        if (etype == 0)
+        {
+                static const GEnumValue values[] =
+                        {
+                                ENUM_ENTRY (POLKIT_DAEMON_BACKEND_ERROR_GENERAL, "GeneralError"),
+                                { 0, 0, 0 }
+                        };
+                
+                g_assert (POLKIT_DAEMON_BACKEND_NUM_ERRORS == G_N_ELEMENTS (values) - 1);
+                
+                etype = g_enum_register_static ("PolKitDaemonBackendError", values);
+        }
+        
+        return etype;
+}
+
+
+static GObject *
+polkit_daemon_backend_constructor (GType                  type,
+                                            guint                  n_construct_properties,
+                                            GObjectConstructParam *construct_properties)
+{
+        PolKitDaemonBackend      *daemon_backend;
+        PolKitDaemonBackendClass *klass;
+
+        klass = POLKIT_DAEMON_BACKEND_CLASS (g_type_class_peek (POLKIT_TYPE_DAEMON_BACKEND));
+
+        daemon_backend = POLKIT_DAEMON_BACKEND (
+                G_OBJECT_CLASS (polkit_daemon_backend_parent_class)->constructor (type,
+                                                                                           n_construct_properties,
+                                                                                           construct_properties));
+        
+        return G_OBJECT (daemon_backend);
+}
+
+static void
+polkit_daemon_backend_class_init (PolKitDaemonBackendClass *klass)
+{
+        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+
+        object_class->constructor = polkit_daemon_backend_constructor;
+        object_class->finalize = polkit_daemon_backend_finalize;
+
+        g_type_class_add_private (klass, sizeof (PolKitDaemonBackendPrivate));
+
+        dbus_g_object_type_install_info (POLKIT_TYPE_DAEMON_BACKEND, &dbus_glib_polkit_daemon_backend_object_info);
+
+        dbus_g_error_domain_register (POLKIT_DAEMON_BACKEND_ERROR, NULL, POLKIT_DAEMON_BACKEND_TYPE_ERROR);
+
+}
+
+static void
+polkit_daemon_backend_init (PolKitDaemonBackend *daemon_backend)
+{
+        daemon_backend->priv = POLKIT_DAEMON_BACKEND_GET_PRIVATE (daemon_backend);
+
+}
+
+static void
+polkit_daemon_backend_finalize (GObject *object)
+{
+        PolKitDaemonBackend *daemon_backend;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (POLKIT_IS_DAEMON_BACKEND (object));
+
+        daemon_backend = POLKIT_DAEMON_BACKEND (object);
+
+        g_return_if_fail (daemon_backend->priv != NULL);
+
+        g_object_unref (daemon_backend->priv->system_bus_proxy);
+
+        G_OBJECT_CLASS (polkit_daemon_backend_parent_class)->finalize (object);
+}
+
+static gboolean
+register_daemon_backend (PolKitDaemonBackend *daemon_backend)
+{
+        DBusConnection *connection;
+        GError *error = NULL;
+
+        error = NULL;
+        daemon_backend->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+        if (daemon_backend->priv->system_bus_connection == NULL) {
+                if (error != NULL) {
+                        g_critical ("error getting system bus: %s", error->message);
+                        g_error_free (error);
+                }
+                goto error;
+        }
+        connection = dbus_g_connection_get_connection (daemon_backend->priv->system_bus_connection);
+
+        dbus_g_connection_register_g_object (daemon_backend->priv->system_bus_connection, "/", 
+                                             G_OBJECT (daemon_backend));
+
+        daemon_backend->priv->system_bus_proxy = dbus_g_proxy_new_for_name (daemon_backend->priv->system_bus_connection,
+                                                                      DBUS_SERVICE_DBUS,
+                                                                      DBUS_PATH_DBUS,
+                                                                      DBUS_INTERFACE_DBUS);
+
+        reset_killtimer ();
+
+        return TRUE;
+
+error:
+        return FALSE;
+}
+
+
+PolKitDaemonBackend *
+polkit_daemon_backend_new (gboolean _no_exit)
+{
+        GObject *object;
+        gboolean res;
+
+        no_exit = _no_exit;
+
+        object = g_object_new (POLKIT_TYPE_DAEMON_BACKEND, NULL);
+
+        res = register_daemon_backend (POLKIT_DAEMON_BACKEND (object));
+        if (! res) {
+                g_object_unref (object);
+                return NULL;
+        }
+
+        return POLKIT_DAEMON_BACKEND (object);
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+/* exported methods */
+
+gboolean
+polkit_daemon_backend_hello (PolKitDaemonBackend   *daemon,
+                             const char            *message,
+                             DBusGMethodInvocation *context)
+{
+        char *s;
+
+        s = g_strdup_printf ("You said '%s'", message);
+        dbus_g_method_return (context, s);
+
+        return TRUE;
+}
diff --git a/polkit-backendd/polkit-daemon-backend.h b/polkit-backendd/polkit-daemon-backend.h
new file mode 100644
index 0000000..aeb3feb
--- /dev/null
+++ b/polkit-backendd/polkit-daemon-backend.h
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 David Zeuthen <david at fubar.dk>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __POLKIT_DAEMON_BACKEND_H__
+#define __POLKIT_DAEMON_BACKEND_H__
+
+#include <glib-object.h>
+#include <polkit/polkit.h>
+
+G_BEGIN_DECLS
+
+#define POLKIT_TYPE_DAEMON_BACKEND         (polkit_daemon_backend_get_type ())
+#define POLKIT_DAEMON_BACKEND(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_DAEMON_BACKEND, PolKitDaemonBackend))
+#define POLKIT_DAEMON_BACKEND_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_TYPE_DAEMON_BACKEND, PolKitDaemonBackendClass))
+#define POLKIT_IS_DAEMON_BACKEND(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_DAEMON_BACKEND))
+#define POLKIT_IS_DAEMON_BACKEND_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_DAEMON_BACKEND))
+#define POLKIT_DAEMON_BACKEND_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_DAEMON_BACKEND, PolKitDaemonBackendClass))
+
+typedef struct PolKitDaemonBackendPrivate PolKitDaemonBackendPrivate;
+
+typedef struct
+{
+        GObject        parent;
+        PolKitDaemonBackendPrivate *priv;
+} PolKitDaemonBackend;
+
+typedef struct
+{
+        GObjectClass   parent_class;
+} PolKitDaemonBackendClass;
+
+typedef enum
+{
+        POLKIT_DAEMON_BACKEND_ERROR_GENERAL,
+        POLKIT_DAEMON_BACKEND_NUM_ERRORS
+} PolKitDaemonBackendError;
+
+#define POLKIT_DAEMON_BACKEND_ERROR polkit_daemon_backend_error_quark ()
+
+GType polkit_daemon_backend_error_get_type (void);
+#define POLKIT_DAEMON_BACKEND_TYPE_ERROR (polkit_daemon_backend_error_get_type ())
+
+GQuark               polkit_daemon_backend_error_quark         (void);
+GType                polkit_daemon_backend_get_type            (void);
+PolKitDaemonBackend *polkit_daemon_backend_new                 (gboolean no_exit);
+
+/* exported methods */
+
+gboolean polkit_daemon_backend_hello (PolKitDaemonBackend   *daemon,
+                                      const char            *message,
+                                      DBusGMethodInvocation *context);
+
+G_END_DECLS
+
+#endif /* __POLKIT_DAEMON_BACKEND_H__ */


More information about the hal-commit mailing list