--- /dev/null
+#
+#
+# Makefile.am:
+#
+# Copyright (c) 2007 James McKenzie <james@fishsoup.dhs.org>,
+# All rights reserved.
+#
+# $Id: Makefile.am,v 1.4 2009/06/18 16:36:45 jamesmck Exp $
+#
+# $Log: Makefile.am,v $
+# Revision 1.4 2009/06/18 16:36:45 jamesmck
+# *** empty log message ***
+#
+# Revision 1.3 2009/06/18 16:36:29 jamesmck
+# *** empty log message ***
+#
+# Revision 1.2 2009/06/17 15:46:50 jamesmck
+# *** empty log message ***
+#
+# Revision 1.1 2009/06/15 16:09:00 jamesmck
+# *** empty log message ***
+#
+# Revision 1.8 2009/05/06 01:40:51 james
+# *** empty log message ***
+#
+# Revision 1.7 2009/05/06 01:35:00 james
+# *** empty log message ***
+#
+# Revision 1.6 2007/11/12 13:28:04 james
+# *** empty log message ***
+#
+# Revision 1.5 2007/09/10 11:23:08 root
+# *** empty log message ***
+#
+# Revision 1.3 2007/09/09 22:29:50 root
+# *** empty log message ***
+#
+# Revision 1.2 2007/09/08 18:21:23 root
+# *** empty log message ***
+#
+# Revision 1.1 2007/09/08 16:49:37 root
+# *** empty log message ***
+#
+#
+#
+#
+
+INCLUDES = @DBUS_CFLAGS@ @DBUS_GLIB_CFLAGS@
+LIBS = @DBUS_LIBS@ @DBUS_GLIB_LIBS@
+
+noinst_HEADERS =
+
+bin_PROGRAMS = hello-client hello-server
+
+hello_client_SOURCES = hello-client.c
+hello_client_LDADD = ${LIBS}
+
+hello_server_SOURCES = hello-server.c
+hello_server_LDADD = ${LIBS}
+
+AM_CFLAGS = -g
+
+BUILT_SOURCES = hello-client.h hello-server.h
+
+
+#protos:
+# echo > prototypes.h
+# ${CPROTO} -v ${INCLUDES} ${SRCS} > prototypes.tmp
+# mv -f prototypes.tmp prototypes.h
+
+
+#hello-server:hello-server.c hello-server.h
+# cc ${LIBS} ${CFLAGS} -o $@ $@.c ${LIBS}
+#
+#hello-client:hello-client.c hello-client.h
+# cc ${LIBS} ${CFLAGS} -o $@ $@.c ${LIBS}
+#
+#hello-client.h:hello.xml
+# dbus-binding-tool --mode=glib-client $< > $@ || /bin/rm -f $@
+#
+#hello-server.h:hello.xml
+# dbus-binding-tool --mode=glib-server --prefix=hello_object $< > $@ || /bin/rm -f $@
+#
+
+CLEANFILES = hello-client.h hello-server.h
+
+
+%-client.h:%.xml
+ dbus-binding-tool --mode=glib-client $< > $@ || /bin/rm -f $@
+
+%-server.h:%.xml
+ dbus-binding-tool --mode=glib-server --prefix=${<:%.xml=%_object} $< > $@ || /bin/rm -f $@
+
+EXTRA_DIST=hello.xml DIST/ruby-dbus-0.2.1.tar.gz DIST/ruby-multiple-return.patch project.h conf/hello.conf
+
+install-data-hook:
+ ${INSTALL} -m 644 -c conf/hello.conf ${DESTDIR}/etc/dbus-1/system.d/
--- /dev/null
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+ <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
+ <policy context="default">
+ <allow own="com.citrix.HelloService"/>
+ <allow send_destination="com.citrix.HelloService"/>
+ </policy>
+
+</busconfig>
+
--- /dev/null
+dnl
+dnl
+dnl configure.in.head:
+dnl
+dnl Copyright (c) 2007 James McKenzie <james@fishsoup.dhs.org>,
+dnl All rights reserved.
+dnl
+dnl $Id: configure.in,v 1.3 2009/06/18 16:31:48 jamesmck Exp $
+dnl
+dnl $Log: configure.in,v $
+dnl Revision 1.3 2009/06/18 16:31:48 jamesmck
+dnl *** empty log message ***
+dnl
+dnl Revision 1.2 2009/06/17 15:46:50 jamesmck
+dnl *** empty log message ***
+dnl
+dnl Revision 1.1 2009/06/15 16:09:00 jamesmck
+dnl *** empty log message ***
+dnl
+dnl Revision 1.1 2007/09/08 16:49:37 root
+dnl *** empty log message ***
+dnl
+dnl
+dnl
+dnl
+AC_PREREQ(2.13)
+AC_INIT(hello.xml)
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_RANLIB
+AC_PROG_AWK
+
+AC_CHECK_PROG(MD5SUM,md5sum,md5sum)
+AC_CHECK_PROG(GREP,grep,grep)
+#AC_CHECK_PROG(RUBY,ruby,ruby)
+AC_CHECK_PROG(CPROTO,cproto,cproto)
+
+RUBY=/usr/bin/ruby
+AC_SUBST(RUBY)
+
+PKG_CHECK_MODULES([DBUS],[dbus-1])
+PKG_CHECK_MODULES([DBUS_GLIB],[dbus-glib-1])
+
+
+AC_SYS_LARGEFILE
+
+HELLO_MAJOR_VERSION=1
+HELLO_MINOR_VERSION=0
+HELLO_MICRO_VERSION=1
+
+
+HELLO_VERSION=$HELLO_MAJOR_VERSION.$HELLO_MINOR_VERSION.$HELLO_MICRO_VERSION
+
+AC_SUBST(HELLO_MAJOR_VERSION)
+AC_SUBST(HELLO_MINOR_VERSION)
+AC_SUBST(HELLO_MICRO_VERSION)
+AC_SUBST(HELLO_VERSION)
+
+
+VERSION=$HELLO_VERSION
+PACKAGE=hello
+
+AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
+
+
+AM_CONFIG_HEADER(config.h)
+
+# Checks for header files.
+AC_CHECK_HEADERS([malloc.h])
+AC_HEADER_STDC
+AC_FUNC_MALLOC
+
+AC_C_INLINE
+AC_C_CONST
+
+
+AC_OUTPUT([Makefile
+ hello-client.rb
+ hello-server.rb],
+ [chmod +x hello-client.rb hello-server.rb])
+
+
--- /dev/null
+#include "project.h"
+#include "hello-client.h"
+
+int
+main (int argc, char **argv)
+{
+ DBusGConnection *connection;
+ GError *error;
+ DBusGProxy *proxy;
+ double dbl_ret;
+ char *str_ret;
+
+ g_type_init ();
+
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (connection == NULL)
+ {
+ g_printerr ("Failed to open connection to bus: %s\n", error->message);
+ g_error_free (error);
+ exit (1);
+ }
+
+ /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */
+
+ proxy = dbus_g_proxy_new_for_name (connection, "com.citrix.HelloService", /*This matches "ReuqestName in the server */
+ "/com/citrix/HelloWorld/HelloObject", /*This matches the nodename and register_g_object */
+ "com.citrix.HelloService.HelloInterface"); /*This matches the interface name */
+
+ if (!com_citrix_HelloService_HelloInterface_say_hello
+ (proxy, 1, "fish soup", 2.0, &dbl_ret, &str_ret, &error))
+ {
+
+ if (error->domain == DBUS_GERROR
+ && error->code == DBUS_GERROR_REMOTE_EXCEPTION)
+ g_printerr ("Caught remote method exception %s: %s",
+ dbus_g_error_get_name (error), error->message);
+ else
+ g_printerr ("Error: %s\n", error->message);
+ g_error_free (error);
+ exit (1);
+ }
+
+ printf ("Hello world said %f, %s\n", (float) dbl_ret, str_ret);
+ g_free (str_ret);
+
+ g_object_unref (proxy);
+
+ return 0;
+}
--- /dev/null
+#!@RUBY@
+
+require 'dbus'
+require 'yaml'
+
+bus = DBus::SystemBus.instance
+
+service=bus.service("com.citrix.HelloService")
+
+proxy_object=service.object("/com/citrix/HelloWorld/HelloObject")
+
+proxy_object.introspect
+
+proxy_object_interface=proxy_object["com.citrix.HelloService.HelloInterface"]
+
+
+soup=proxy_object_interface.SayHello(1,"fish soup",2.0)
+
+puts soup.to_yaml
+
+
+
--- /dev/null
+#include "project.h"
+
+
+typedef struct HelloObject
+{
+ GObject parent;
+} HelloObject;
+
+typedef struct HelloObjectClass
+{
+ GObjectClass parent;
+} HelloObjectClass;
+
+
+#define HELLO_TYPE_OBJECT (hello_object_get_type ())
+#define HELLO_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HELLO_TYPE_OBJECT, HelloObject))
+#define HELLO_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HELLO_TYPE_OBJECT, HelloObjectClass))
+#define HELLO_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), HELLO_TYPE_OBJECT))
+#define HELLO_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HELLO_TYPE_OBJECT))
+#define HELLO_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HELLO_TYPE_OBJECT, HelloObjectClass))
+
+G_DEFINE_TYPE (HelloObject, hello_object, G_TYPE_OBJECT);
+
+
+static gboolean hello_object_say_hello (HelloObject * this, guint uint_in,
+ const char *str_in, gdouble dbl_in,
+ gdouble * dbl_ret, char **str_ret);
+
+#include "hello-server.h"
+
+
+static void
+fatal (const char *a)
+{
+ fprintf (stderr, "%s\n", a);
+ abort ();
+}
+
+static void
+hello_object_init (HelloObject * obj)
+{
+}
+
+static void
+hello_object_class_init (HelloObjectClass * klass)
+{
+}
+
+
+static gboolean
+hello_object_say_hello (HelloObject * this, guint uint_in, const char *str_in,
+ gdouble dbl_in, gdouble * dbl_ret, char **str_ret)
+{
+
+
+
+ *dbl_ret = 3.0;
+ *str_ret = g_strdup ("hello world!");
+ return TRUE;
+}
+
+
+int
+main (int argc, char **argv)
+{
+ DBusGConnection *bus;
+ DBusGProxy *bus_proxy;
+ GError *error = NULL;
+ HelloObject *hello;
+ GMainLoop *mainloop;
+
+ guint request_name_result;
+
+ g_type_init ();
+
+ /*Register the object defined above, with the types generated by the IDL */
+ dbus_g_object_type_install_info (HELLO_TYPE_OBJECT,
+ &dbus_glib_hello_object_object_info);
+
+ mainloop = g_main_loop_new (NULL, FALSE);
+
+ /*Get a handle to the system bus */
+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+
+
+ if (!bus)
+ fatal ("no bus");
+
+ /*Get a proxy object for the bus's name handler */
+ bus_proxy = dbus_g_proxy_new_for_name (bus,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+
+
+ /*Do an RPC on the name handler to register ourselves with a well known name */
+
+ if (!dbus_g_proxy_call (bus_proxy, "RequestName", &error,
+ G_TYPE_STRING, "com.citrix.HelloService",
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &request_name_result, G_TYPE_INVALID)) {
+ g_printerr("Error: %s\n",error->message);
+ fatal ("failed to do proxy call");
+ }
+
+
+ /*Instansate an object */
+ hello = g_object_new (HELLO_TYPE_OBJECT, NULL);
+
+ /*Connect the object to a path */
+ dbus_g_connection_register_g_object (bus, "/com/citrix/HelloWorld/HelloObject", G_OBJECT (hello));
+
+
+ g_main_loop_run (mainloop);
+
+ return 0;
+}
--- /dev/null
+#!@RUBY@
+
+require 'dbus'
+require 'yaml'
+
+
+class HelloObject < DBus::Object
+ dbus_interface "com.citrix.HelloService.HelloInterface" do
+ dbus_method :SayHello, "in uint_in:i, in str_in:s, in dbl_in:d, out dbl_ret:d, out str_ret:s" do |uint_in, str_in, dbl_in|
+ puts "Hello was called with %d %s %f" % [uint_in,str_in,dbl_in]
+ [ 3.0, "hello world!"]
+ end
+ end
+end
+
+bus = DBus::SystemBus.instance
+service = bus.request_service("com.citrix.HelloService")
+hello_object = HelloObject.new("/com/citrix/HelloWorld/HelloObject");
+service.export(hello_object);
+
+
+puts "listening"
+main = DBus::Main.new
+main << bus
+main.run
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<node name="/com/citrix/HelloWorld">
+ <interface name="com.citrix.HelloService.HelloInterface">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="hello_object"/>
+ <method name="SayHello">
+ <!-- This is optional, and in this case is redunundant -->
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="hello_object_say_hello"/>
+ <arg type="u" name="uint_in" direction="in" /> <!-- uint -->
+ <arg type="s" name="str_in" direction="in" /> <!-- string -->
+ <arg type="d" name="dbl_in" direction="in" /> <!-- double -->
+ <arg type="d" name="dbl_ret" direction="out" /> <!-- double -->
+ <arg type="s" name="str_ret" direction="out" /> <!-- string -->
+ </method>
+ </interface>
+</node>
--- /dev/null
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+
+