summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-06-20 15:28:15 +0000
committerHavoc Pennington <hp@redhat.com>2004-06-20 15:28:15 +0000
commit961e6ca41c1e9433055130569ce3492866e2126b (patch)
tree053a3e24565665462a498dee93762a83b5598004 /dbus
parenteed3989ea35a62e5f58ee7fc3f50a23ad0821800 (diff)
2004-06-20 Havoc Pennington <hp@redhat.com>
* dbus/dbus-glib-error-enum.h: autogenerate the GError enum codes from the dbus error names * glib/dbus-glib.h: move to subdir dbus/ since it's included as dbus/dbus-glib.h and that breakage is now visible due to including dbus/dbus-glib.h in dbus-glib-lowlevel.h * glib/dbus-glib.h: s/gproxy/g_proxy/ * dbus/dbus-shared.h: new header to hold stuff shared with binding APIs * dbus/dbus-protocol.h (DBUS_ERROR_*): move errors here rather than dbus-errors.h * glib/dbus-glib.h (dbus_set_g_error): move to dbus-glib-lowlevel.h * glib/dbus-glib.h: remove dbus/dbus.h from here; change a bunch of stuff to enable this * dbus/dbus-glib-lowlevel.h: put dbus/dbus.h here * a bunch of other changes with the same basic "separate glib bindings from dbus.h" theme
Diffstat (limited to 'dbus')
-rw-r--r--dbus/Makefile.am23
-rw-r--r--dbus/dbus-address.c2
-rw-r--r--dbus/dbus-auth.c3
-rw-r--r--dbus/dbus-bus.h7
-rw-r--r--dbus/dbus-connection.c1
-rw-r--r--dbus/dbus-connection.h8
-rw-r--r--dbus/dbus-errors.c3
-rw-r--r--dbus/dbus-errors.h29
-rw-r--r--dbus/dbus-glib-lowlevel.h70
-rw-r--r--dbus/dbus-glib.h157
-rw-r--r--dbus/dbus-keyring.c3
-rw-r--r--dbus/dbus-protocol.h37
-rw-r--r--dbus/dbus-server-debug-pipe.c3
-rw-r--r--dbus/dbus-server-unix.c2
-rw-r--r--dbus/dbus-server.c3
-rw-r--r--dbus/dbus-server.h1
-rw-r--r--dbus/dbus-shared.h53
-rw-r--r--dbus/dbus-spawn.c3
-rw-r--r--dbus/dbus-sysdeps.c1
-rw-r--r--dbus/dbus-transport.h3
-rw-r--r--dbus/dbus-userdb.c3
-rw-r--r--dbus/dbus.h1
-rwxr-xr-xdbus/make-dbus-glib-error-enum.sh24
23 files changed, 384 insertions, 56 deletions
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index 255fd7a6..a9ec8808 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -1,6 +1,20 @@
INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) -DDBUS_COMPILATION
+if HAVE_GLIB
+DBUS_GLIB_BUILT_INCLUDES= \
+ dbus-glib-error-enum.h
+
+GLIB_INCLUDES= \
+ dbus-glib.h \
+ dbus-glib-lowlevel.h \
+ $(DBUS_GLIB_BUILT_INCLUDES)
+
+dbus-glib-error-enum.h: dbus-protocol.h make-dbus-glib-error-enum.sh
+ $(srcdir)/make-dbus-glib-error-enum.sh dbus-protocol.h $@
+
+endif
+
dbusincludedir=$(includedir)/dbus-1.0/dbus
dbusarchincludedir=$(libdir)/dbus-1.0/include/dbus
@@ -18,8 +32,10 @@ dbusinclude_HEADERS= \
dbus-pending-call.h \
dbus-protocol.h \
dbus-server.h \
+ dbus-shared.h \
dbus-threads.h \
- dbus-types.h
+ dbus-types.h \
+ $(GLIB_INCLUDES)
dbusarchinclude_HEADERS= \
dbus-arch-deps.h
@@ -117,8 +133,9 @@ libdbus_convenience_la_SOURCES= \
$(DBUS_SHARED_SOURCES) \
$(DBUS_UTIL_SOURCES)
-BUILT_SOURCES=$(dbusarchinclude_HEADERS)
-EXTRA_DIST=dbus-arch-deps.h.in
+BUILT_SOURCES=$(dbusarchinclude_HEADERS) $(DBUS_GLIB_BUILT_INCLUDES)
+EXTRA_DIST=dbus-arch-deps.h.in make-dbus-glib-error-enum.sh
+CLEANFILES=$(DBUS_GLIB_BUILT_INCLUDES)
## this library is the same as libdbus, but exports all the symbols
## and is only used for static linking within the dbus package.
diff --git a/dbus/dbus-address.c b/dbus/dbus-address.c
index f5cc56d2..ef163ce3 100644
--- a/dbus/dbus-address.c
+++ b/dbus/dbus-address.c
@@ -2,6 +2,7 @@
/* dbus-address.c Server address parser.
*
* Copyright (C) 2003 CodeFactory AB
+ * Copyright (C) 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -26,6 +27,7 @@
#include "dbus-internals.h"
#include "dbus-list.h"
#include "dbus-string.h"
+#include "dbus-protocol.h"
/**
* @defgroup DBusAddressInternals Address parsing
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
index e41137f8..83dfc8a7 100644
--- a/dbus/dbus-auth.c
+++ b/dbus/dbus-auth.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-auth.c Authentication
*
- * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Copyright (C) 2002, 2003, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -27,6 +27,7 @@
#include "dbus-keyring.h"
#include "dbus-sha.h"
#include "dbus-userdb.h"
+#include "dbus-protocol.h"
/**
* @defgroup DBusAuth Authentication
diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h
index 2bde290e..dd5e5eb7 100644
--- a/dbus/dbus-bus.h
+++ b/dbus/dbus-bus.h
@@ -31,13 +31,6 @@
DBUS_BEGIN_DECLS;
-typedef enum
-{
- DBUS_BUS_SESSION, /**< The login session bus */
- DBUS_BUS_SYSTEM, /**< The systemwide bus */
- DBUS_BUS_ACTIVATION /**< The bus that activated us, if any */
-} DBusBusType;
-
DBusConnection *dbus_bus_get (DBusBusType type,
DBusError *error);
dbus_bool_t dbus_bus_register (DBusConnection *connection,
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 9b59338b..d68c3958 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -22,6 +22,7 @@
*/
#include <config.h>
+#include "dbus-shared.h"
#include "dbus-connection.h"
#include "dbus-list.h"
#include "dbus-timeout.h"
diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h
index 5dcbc8c0..fb6dfbcd 100644
--- a/dbus/dbus-connection.h
+++ b/dbus/dbus-connection.h
@@ -30,6 +30,7 @@
#include <dbus/dbus-errors.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-message.h>
+#include <dbus/dbus-shared.h>
DBUS_BEGIN_DECLS;
@@ -58,13 +59,6 @@ typedef enum
DBUS_DISPATCH_NEED_MEMORY /**< More memory is needed to continue. */
} DBusDispatchStatus;
-typedef enum
-{
- DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect */
- DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect */
- DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory to return another result */
-} DBusHandlerResult;
-
typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
void *data);
typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c
index 2a7dd853..db7b5a86 100644
--- a/dbus/dbus-errors.c
+++ b/dbus/dbus-errors.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-errors.c Error reporting
*
- * Copyright (C) 2002 Red Hat Inc.
+ * Copyright (C) 2002, 2004 Red Hat Inc.
* Copyright (C) 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.0
@@ -24,6 +24,7 @@
#include "dbus-errors.h"
#include "dbus-internals.h"
#include "dbus-string.h"
+#include "dbus-protocol.h"
#include <stdarg.h>
#include <string.h>
diff --git a/dbus/dbus-errors.h b/dbus/dbus-errors.h
index ec8c5d96..344c449c 100644
--- a/dbus/dbus-errors.h
+++ b/dbus/dbus-errors.h
@@ -52,35 +52,6 @@ struct DBusError
void *padding1; /**< placeholder */
};
-#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
-#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
-#define DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.ServiceNotFound"
-#define DBUS_ERROR_SERVICE_DOES_NOT_EXIST "org.freedesktop.DBus.Error.ServiceDoesNotExist"
-#define DBUS_ERROR_SERVICE_HAS_NO_OWNER "org.freedesktop.DBus.Error.ServiceHasNoOwner"
-#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
-#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
-#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
-#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
-#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
-#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
-#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
-#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
-#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
-#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
-#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
-#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
-#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
-#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
-#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
-#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
-#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
-#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
-#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
-#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
-#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
-#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
-#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
-
void dbus_error_init (DBusError *error);
void dbus_error_free (DBusError *error);
void dbus_set_error (DBusError *error,
diff --git a/dbus/dbus-glib-lowlevel.h b/dbus/dbus-glib-lowlevel.h
new file mode 100644
index 00000000..ac2cfa86
--- /dev/null
+++ b/dbus/dbus-glib-lowlevel.h
@@ -0,0 +1,70 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-glib-lowlevel.h GLib integration details that require dbus/dbus.h
+ *
+ * Copyright (C) 2002, 2003 CodeFactory AB
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef DBUS_GLIB_LOWLEVEL_H
+#define DBUS_GLIB_LOWLEVEL_H
+
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus.h>
+
+G_BEGIN_DECLS
+
+void dbus_set_g_error (GError **gerror,
+ DBusError *derror);
+
+#define DBUS_TYPE_CONNECTION (dbus_connection_get_g_type ())
+#define DBUS_TYPE_MESSAGE (dbus_message_get_g_type ())
+GType dbus_connection_get_g_type (void) G_GNUC_CONST;
+GType dbus_message_get_g_type (void) G_GNUC_CONST;
+
+#define DBUS_TYPE_G_CONNECTION (dbus_g_connection_get_g_type ())
+#define DBUS_TYPE_G_MESSAGE (dbus_g_message_get_g_type ())
+GType dbus_g_connection_get_g_type (void) G_GNUC_CONST;
+GType dbus_g_message_get_g_type (void) G_GNUC_CONST;
+
+void dbus_connection_setup_with_g_main (DBusConnection *connection,
+ GMainContext *context);
+void dbus_server_setup_with_g_main (DBusServer *server,
+ GMainContext *context);
+DBusConnection* dbus_bus_get_with_g_main (DBusBusType type,
+ GError **error);
+
+void dbus_g_proxy_send (DBusGProxy *proxy,
+ DBusMessage *message,
+ dbus_uint32_t *client_serial);
+
+DBusConnection* dbus_g_connection_get_connection (DBusGConnection *gconnection);
+DBusMessage* dbus_g_message_get_message (DBusGMessage *gmessage);
+
+/* dbus_g_pending_call_get_pending_call() deliberately skipped for now;
+ * not sure it makes sense to use any of the DBusPendingCall functions
+ * on the wrapped pending call (once we have the right exported
+ * g-functions anyhow)
+ */
+
+G_END_DECLS
+
+#endif /* DBUS_GLIB_LOWLEVEL_H */
+
+
+
diff --git a/dbus/dbus-glib.h b/dbus/dbus-glib.h
new file mode 100644
index 00000000..08c39765
--- /dev/null
+++ b/dbus/dbus-glib.h
@@ -0,0 +1,157 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-glib.h GLib integration
+ *
+ * Copyright (C) 2002, 2003 CodeFactory AB
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef DBUS_GLIB_H
+#define DBUS_GLIB_H
+
+#include <glib-object.h>
+#include <dbus/dbus-protocol.h>
+#include <dbus/dbus-shared.h>
+
+G_BEGIN_DECLS
+
+#define DBUS_INSIDE_DBUS_GLIB_H 1
+
+
+/**
+ * Convert to/from DBusConnection with DBUS_CONNECTION_FROM_G_CONNECTION()
+ */
+typedef struct DBusGConnection DBusGConnection;
+/**
+ * Convert to/from DBusMessage with DBUS_MESSAGE_FROM_G_MESSAGE()
+ */
+typedef struct DBusGMessage DBusGMessage;
+/**
+ * Convert to/from DBusPendingCall with DBUS_PENDING_CALL_FROM_G_PENDING_CALL()
+ */
+typedef struct DBusGPendingCall DBusGPendingCall;
+
+void dbus_g_connection_flush (DBusGConnection *connection);
+
+GQuark dbus_g_error_quark (void);
+#define DBUS_GERROR dbus_g_error_quark ()
+
+typedef enum
+{
+#include <dbus/dbus-glib-error-enum.h>
+} DBusGError;
+
+void dbus_g_thread_init (void);
+DBusGConnection* dbus_g_bus_get (DBusBusType type,
+ GError **error);
+
+typedef struct DBusGObjectInfo DBusGObjectInfo;
+typedef struct DBusGMethodInfo DBusGMethodInfo;
+
+typedef DBusHandlerResult (* DBusGMethodMarshaller) (DBusGConnection *connection,
+ DBusGMessage *message,
+ void *user_data);
+
+/**
+ * Object typically generated by dbus-glib-tool that
+ * stores a mapping from introspection data to a
+ * function pointer for a C method to be invoked.
+ */
+struct DBusGMethodInfo
+{
+ GCallback function; /**< C method to invoke */
+ DBusGMethodMarshaller marshaller; /**< Marshaller to go DBusGMessage to C method */
+ int data_offset; /**< Offset into the introspection data */
+};
+
+/**
+ * Introspection data for a GObject, normally autogenerated by
+ * a tool such as dbus-glib-tool.
+ */
+struct DBusGObjectInfo
+{
+ int format_version; /**< Allows us to change the rest of this struct
+ * by adding DBusGObjectInfo2, DBusGObjectInfo3, etc.
+ */
+ const DBusGMethodInfo *infos; /**< Array of method pointers */
+ const unsigned char *data; /**< Introspection data */
+};
+
+void dbus_g_object_class_install_info (GObjectClass *object_class,
+ const DBusGObjectInfo *info);
+void dbus_g_connection_register_g_object (DBusGConnection *connection,
+ const char *at_path,
+ GObject *object);
+
+
+typedef struct DBusGProxy DBusGProxy;
+typedef struct DBusGProxyClass DBusGProxyClass;
+
+#define DBUS_TYPE_G_PROXY (dbus_g_proxy_get_type ())
+#define DBUS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_TYPE_G_PROXY, DBusGProxy))
+#define DBUS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TYPE_G_PROXY, DBusGProxyClass))
+#define DBUS_IS_G_PROXY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_TYPE_G_PROXY))
+#define DBUS_IS_G_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TYPE_G_PROXY))
+#define DBUS_G_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TYPE_G_PROXY, DBusGProxyClass))
+
+
+GType dbus_g_proxy_get_type (void) G_GNUC_CONST;
+DBusGProxy* dbus_g_proxy_new_for_service (DBusGConnection *connection,
+ const char *service_name,
+ const char *path_name,
+ const char *interface_name);
+DBusGProxy* dbus_g_proxy_new_for_service_owner (DBusGConnection *connection,
+ const char *service_name,
+ const char *path_name,
+ const char *interface_name,
+ GError **error);
+DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection,
+ const char *path_name,
+ const char *interface_name);
+void dbus_g_proxy_connect_signal (DBusGProxy *proxy,
+ const char *signal_name,
+ GCallback handler,
+ void *data,
+ GClosureNotify free_data_func);
+void dbus_g_proxy_disconnect_signal (DBusGProxy *proxy,
+ const char *signal_name,
+ GCallback handler,
+ void *data);
+DBusGPendingCall* dbus_g_proxy_begin_call (DBusGProxy *proxy,
+ const char *method,
+ int first_arg_type,
+ ...);
+gboolean dbus_g_proxy_end_call (DBusGProxy *proxy,
+ DBusGPendingCall *pending,
+ GError **error,
+ int first_arg_type,
+ ...);
+void dbus_g_proxy_call_no_reply (DBusGProxy *proxy,
+ const char *method,
+ int first_arg_type,
+ ...);
+
+
+#undef DBUS_INSIDE_DBUS_GLIB_H
+
+G_END_DECLS
+
+#endif /* DBUS_GLIB_H */
+
+
+
diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c
index 92989b8d..dd22fb64 100644
--- a/dbus/dbus-keyring.c
+++ b/dbus/dbus-keyring.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-keyring.c Store secret cookies in your homedir
*
- * Copyright (C) 2003 Red Hat Inc.
+ * Copyright (C) 2003, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -23,6 +23,7 @@
#include "dbus-keyring.h"
#include "dbus-userdb.h"
+#include "dbus-protocol.h"
#include <dbus/dbus-string.h>
#include <dbus/dbus-list.h>
#include <dbus/dbus-sysdeps.h>
diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h
index 75c9b22c..c30339c9 100644
--- a/dbus/dbus-protocol.h
+++ b/dbus/dbus-protocol.h
@@ -119,7 +119,42 @@ extern "C" {
/* Activation replies */
#define DBUS_ACTIVATION_REPLY_ACTIVATED 0x0
#define DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE 0x1
-
+
+/* Errors */
+/* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
+ * if you change the order it breaks the ABI. Keep them in order.
+ * Also, don't change the formatting since that will break the sed
+ * script.
+ */
+#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
+#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
+#define DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.ServiceNotFound"
+#define DBUS_ERROR_SERVICE_DOES_NOT_EXIST "org.freedesktop.DBus.Error.ServiceDoesNotExist"
+#define DBUS_ERROR_SERVICE_HAS_NO_OWNER "org.freedesktop.DBus.Error.ServiceHasNoOwner"
+#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
+#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
+#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
+#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
+#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
+#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
+#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
+#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
+#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
+#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
+#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
+#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
+#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
+#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
+#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
+#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
+#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
+#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
+#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
+#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
+#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
+#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
+#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
+
#ifdef __cplusplus
}
#endif
diff --git a/dbus/dbus-server-debug-pipe.c b/dbus/dbus-server-debug-pipe.c
index 4340e154..9f1d55f2 100644
--- a/dbus/dbus-server-debug-pipe.c
+++ b/dbus/dbus-server-debug-pipe.c
@@ -2,7 +2,7 @@
/* dbus-server-debug-pipe.c In-proc debug server implementation
*
* Copyright (C) 2003 CodeFactory AB
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -28,6 +28,7 @@
#include "dbus-connection-internal.h"
#include "dbus-hash.h"
#include "dbus-string.h"
+#include "dbus-protocol.h"
#ifdef DBUS_BUILD_TESTS
diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c
index a1d7b4ce..4c79c372 100644
--- a/dbus/dbus-server-unix.c
+++ b/dbus/dbus-server-unix.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-server-unix.c Server implementation for Unix network protocols.
*
- * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Copyright (C) 2002, 2003, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.0
*
diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c
index 2fa52ebe..9661927a 100644
--- a/dbus/dbus-server.c
+++ b/dbus/dbus-server.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-server.c DBusServer object
*
- * Copyright (C) 2002, 2003 Red Hat Inc.
+ * Copyright (C) 2002, 2003, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -28,6 +28,7 @@
#include "dbus-server-debug-pipe.h"
#endif
#include "dbus-address.h"
+#include "dbus-protocol.h"
/**
* @defgroup DBusServer DBusServer
diff --git a/dbus/dbus-server.h b/dbus/dbus-server.h
index 98b2a31b..ba9894e9 100644
--- a/dbus/dbus-server.h
+++ b/dbus/dbus-server.h
@@ -30,6 +30,7 @@
#include <dbus/dbus-errors.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-connection.h>
+#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS;
diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h
new file mode 100644
index 00000000..29889754
--- /dev/null
+++ b/dbus/dbus-shared.h
@@ -0,0 +1,53 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-shared.h Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef DBUS_SHARED_H
+#define DBUS_SHARED_H
+
+/* Don't include anything in here from anywhere else. It's
+ * intended for use by any random library.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ DBUS_BUS_SESSION, /**< The login session bus */
+ DBUS_BUS_SYSTEM, /**< The systemwide bus */
+ DBUS_BUS_ACTIVATION /**< The bus that activated us, if any */
+} DBusBusType;
+
+typedef enum
+{
+ DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect */
+ DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect */
+ DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory to return another result */
+} DBusHandlerResult;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DBUS_PROTOCOL_H */
diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c
index 0d32d685..821be25c 100644
--- a/dbus/dbus-spawn.c
+++ b/dbus/dbus-spawn.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-spawn.c Wrapper around fork/exec
*
- * Copyright (C) 2002, 2003 Red Hat, Inc.
+ * Copyright (C) 2002, 2003, 2004 Red Hat, Inc.
* Copyright (C) 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.0
@@ -25,6 +25,7 @@
#include "dbus-sysdeps.h"
#include "dbus-internals.h"
#include "dbus-test.h"
+#include "dbus-protocol.h"
#include <unistd.h>
#include <fcntl.h>
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index e9d00201..ed1e61a2 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -25,6 +25,7 @@
#include "dbus-internals.h"
#include "dbus-sysdeps.h"
#include "dbus-threads.h"
+#include "dbus-protocol.h"
#include "dbus-test.h"
#include <sys/types.h>
#include <stdlib.h>
diff --git a/dbus/dbus-transport.h b/dbus/dbus-transport.h
index a642b21a..2c17c2a1 100644
--- a/dbus/dbus-transport.h
+++ b/dbus/dbus-transport.h
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-transport.h DBusTransport object (internal to D-BUS implementation)
*
- * Copyright (C) 2002 Red Hat Inc.
+ * Copyright (C) 2002, 2004 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -25,6 +25,7 @@
#include <dbus/dbus-internals.h>
#include <dbus/dbus-connection.h>
+#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS;
diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c
index 4dc05b81..e2b6c496 100644
--- a/dbus/dbus-userdb.c
+++ b/dbus/dbus-userdb.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-userdb.c User database abstraction
*
- * Copyright (C) 2003 Red Hat, Inc.
+ * Copyright (C) 2003, 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
@@ -24,6 +24,7 @@
#include "dbus-hash.h"
#include "dbus-test.h"
#include "dbus-internals.h"
+#include "dbus-protocol.h"
#include <string.h>
/**
diff --git a/dbus/dbus.h b/dbus/dbus.h
index 8c42849a..e4031177 100644
--- a/dbus/dbus.h
+++ b/dbus/dbus.h
@@ -40,6 +40,7 @@
#include <dbus/dbus-pending-call.h>
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-server.h>
+#include <dbus/dbus-shared.h>
#include <dbus/dbus-threads.h>
#include <dbus/dbus-types.h>
diff --git a/dbus/make-dbus-glib-error-enum.sh b/dbus/make-dbus-glib-error-enum.sh
new file mode 100755
index 00000000..5b0df6c9
--- /dev/null
+++ b/dbus/make-dbus-glib-error-enum.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+SRC=$1
+DEST=$2
+
+function die()
+{
+ echo $1 1>&2
+ /bin/rm $DEST.tmp
+ exit 1
+}
+
+cat $SRC | grep '#define DBUS_ERROR' | sed -e 's/#define //g' | \
+ sed -e 's/".*//g' | sed -e 's/_ERROR/_GERROR/g' | sed -e 's/ *$/,/g' > $DEST.tmp
+
+if ! test -s $DEST.tmp ; then
+ die "$DEST.tmp is empty, something went wrong, see any preceding error message"
+fi
+
+echo "#ifndef DBUS_INSIDE_DBUS_GLIB_H" >> $DEST.tmp
+echo '#error "' "$DEST" 'may only be included by dbus-glib.h"' >> $DEST.tmp
+echo "#endif" >> $DEST.tmp
+
+mv $DEST.tmp $DEST || die "could not move $DEST.tmp to $DEST"