summaryrefslogtreecommitdiff
path: root/Source/FusionDale/proxy/dispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FusionDale/proxy/dispatcher')
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/Makefile.am34
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/icoma_dispatcher.c224
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/icoma_dispatcher.h38
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.c376
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.h45
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.c223
-rwxr-xr-xSource/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.h41
7 files changed, 981 insertions, 0 deletions
diff --git a/Source/FusionDale/proxy/dispatcher/Makefile.am b/Source/FusionDale/proxy/dispatcher/Makefile.am
new file mode 100755
index 0000000..bad6a09
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/Makefile.am
@@ -0,0 +1,34 @@
+## Makefile.am for FusionDale/proxy/dispatcher
+
+INTERFACES_DIR = $(MODULEDIR)/interfaces
+
+ifusiondaledir = $(INTERFACES_DIR)/IFusionDale
+
+INCLUDES = \
+ -I$(top_builddir)/include \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/proxy/requestor \
+ $(DIRECTFB_INTERNAL_CFLAGS) \
+ -DDATADIR=\"${RUNTIME_SYSROOT}@DATADIR@\"
+
+LIBS = \
+ $(top_builddir)/lib/libfusiondale.la \
+ -lvoodoo \
+ $(DIRECTFB_LIBS)
+
+
+ifusiondale_LTLIBRARIES = \
+ libifusiondale_dispatcher.la
+
+if BUILD_STATIC
+ifusiondale_DATA = libifusiondale_dispatcher.o
+endif
+
+libifusiondale_dispatcher_la_SOURCES = ifusiondale_dispatcher.c ifusiondale_dispatcher.h
+libifusiondale_dispatcher_la_LDFLAGS = -avoid-version -module
+libifusiondale_dispatcher_la_LIBADDD = $(LIBS)
+
+
+include $(top_srcdir)/rules/libobject.make
diff --git a/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.c b/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.c
new file mode 100755
index 0000000..4c7f8d4
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.c
@@ -0,0 +1,224 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <fusiondale.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <coma/coma.h>
+#include <coma/policy.h>
+
+#include <coma/icoma.h>
+
+#include "icoma_dispatcher.h"
+
+static DirectResult Probe( void );
+static DirectResult Construct( IComa *thiz,
+ IComa *real,
+ VoodooManager *manager,
+ VoodooInstanceID super,
+ void *arg, /* Optional arguments to constructor */
+ VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IComa, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IComa_Dispatcher
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ IComa *real;
+
+ VoodooInstanceID super;
+ VoodooInstanceID self;
+
+ VoodooManager *manager;
+
+ char *name;
+} IComa_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IComa_Dispatcher_Destruct( IComa *thiz )
+{
+ IComa_Dispatcher_data *data;
+
+ D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+ data = thiz->priv;
+
+ D_FREE( data->name );
+
+ voodoo_manager_unregister_local( data->manager, data->self );
+
+ data->real->Release( data->real );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IComa_Dispatcher_AddRef( IComa *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa_Dispatcher)
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComa_Dispatcher_Release( IComa *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IComa_Dispatcher)
+
+ if (--data->ref == 0)
+ IComa_Dispatcher_Destruct( thiz );
+
+ return DR_OK;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_GetComponent( IComa *thiz, IComa *real,
+ VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ DirectResult ret;
+ const char *name;
+ unsigned int timeout;
+ VoodooMessageParser parser;
+ IComaComponent *component;
+ VoodooInstanceID instance;
+
+ DIRECT_INTERFACE_GET_DATA(IComa_Dispatcher)
+
+ VOODOO_PARSER_BEGIN( parser, msg );
+ VOODOO_PARSER_GET_STRING( parser, name );
+ VOODOO_PARSER_GET_UINT( parser, timeout );
+ VOODOO_PARSER_END( parser );
+
+ if (!coma_policy_check_component( data->name, name ))
+ return DR_ACCESSDENIED;
+
+ ret = real->GetComponent( real, name, timeout, &component );
+ if (ret)
+ return ret;
+
+ ret = voodoo_construct_dispatcher( manager, "IComaComponent",
+ component, data->self, real, &instance, NULL );
+ if (ret) {
+ component->Release( component );
+ return ret;
+ }
+
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, instance,
+ VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ D_DEBUG( "IComa/Dispatcher: "
+ "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+ switch (msg->method) {
+ case ICOMA_METHOD_ID_GetComponent:
+ return Dispatch_GetComponent( dispatcher, real, manager, msg );
+ }
+
+ return DR_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Probe()
+{
+ /* This implementation has to be loaded explicitly. */
+ return DR_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DirectResult
+Construct( IComa *thiz,
+ IComa *real,
+ VoodooManager *manager,
+ VoodooInstanceID super,
+ void *arg, /* Optional arguments to constructor */
+ VoodooInstanceID *ret_instance )
+{
+ DirectResult ret;
+ VoodooInstanceID instance;
+
+ DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IComa_Dispatcher)
+
+ ret = voodoo_manager_register_local( manager, false, thiz, real, Dispatch, &instance );
+ if (ret) {
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ IComa_data *real_data = real->priv;
+
+ data->ref = 1;
+ data->real = real;
+ data->super = super;
+ data->self = instance;
+ data->manager = manager;
+ data->name = D_STRDUP( real_data->coma->name );
+
+ thiz->AddRef = IComa_Dispatcher_AddRef;
+ thiz->Release = IComa_Dispatcher_Release;
+
+ *ret_instance = instance;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.h b/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.h
new file mode 100755
index 0000000..998c68e
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/icoma_dispatcher.h
@@ -0,0 +1,38 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __ICOMA_DISPATCHER_H__
+#define __ICOMA_DISPATCHER_H__
+
+#define ICOMA_METHOD_ID_AddRef 1
+#define ICOMA_METHOD_ID_Release 2
+#define ICOMA_METHOD_ID_CreateComponent 3
+#define ICOMA_METHOD_ID_GetComponent 4
+
+#endif
+
diff --git a/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.c b/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.c
new file mode 100755
index 0000000..23637dd
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.c
@@ -0,0 +1,376 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <fusiondale.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include <coma/coma.h>
+#include <coma/component.h>
+#include <coma/policy.h>
+
+#include <coma/icoma.h>
+#include <coma/icomacomponent.h>
+
+#include "icomacomponent_dispatcher.h"
+
+static DirectResult Probe( void );
+static DirectResult Construct( IComaComponent *thiz,
+ IComaComponent *real,
+ VoodooManager *manager,
+ VoodooInstanceID super,
+ void *arg, /* Optional arguments to constructor */
+ VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IComaComponent, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IComaComponent_Dispatcher
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ IComaComponent *real;
+
+ VoodooInstanceID super;
+ VoodooInstanceID self;
+
+ VoodooManager *manager;
+
+ IComa *coma;
+
+ DirectHash *listeners;
+
+ char *coma_name;
+ char *component_name;
+} IComaComponent_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IComaComponent_Dispatcher_Destruct( IComaComponent *thiz )
+{
+ IComaComponent_Dispatcher_data *data;
+
+ D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+ data = thiz->priv;
+
+ D_FREE( data->component_name );
+ D_FREE( data->coma_name );
+
+ direct_hash_destroy( data->listeners );
+
+ voodoo_manager_unregister_local( data->manager, data->self );
+
+ data->real->Release( data->real );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IComaComponent_Dispatcher_AddRef( IComaComponent *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IComaComponent_Dispatcher)
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IComaComponent_Dispatcher_Release( IComaComponent *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IComaComponent_Dispatcher)
+
+ if (--data->ref == 0)
+ IComaComponent_Dispatcher_Destruct( thiz );
+
+ return DR_OK;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_Call( IComaComponent *thiz, IComaComponent *real,
+ VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ DirectResult ret;
+ ComaMethodID method;
+ unsigned int length;
+ void *arg;
+ int ret_val;
+ VoodooMessageParser parser;
+ IComa *coma;
+
+ DIRECT_INTERFACE_GET_DATA(IComaComponent_Dispatcher)
+
+ coma = data->coma;
+
+ VOODOO_PARSER_BEGIN( parser, msg );
+ VOODOO_PARSER_GET_UINT( parser, method );
+ VOODOO_PARSER_GET_UINT( parser, length );
+
+ if (!coma_policy_check_method( data->coma_name, data->component_name, method ))
+ return DR_ACCESSDENIED;
+
+ if (length) {
+ ret = coma->GetLocal( coma, length, &arg );
+ if (ret) {
+ VOODOO_PARSER_END( parser );
+ return ret;
+ }
+
+ VOODOO_PARSER_READ_DATA( parser, arg, length );
+ }
+ else
+ arg = NULL;
+
+ VOODOO_PARSER_END( parser );
+
+ ret = real->Call( real, method, arg, &ret_val );
+ if (ret)
+ return ret;
+
+ if (arg)
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, VOODOO_INSTANCE_NONE,
+ VMBT_DATA, length, arg,
+ VMBT_INT, ret_val,
+ VMBT_NONE );
+
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, VOODOO_INSTANCE_NONE,
+ VMBT_INT, ret_val,
+ VMBT_NONE );
+}
+
+/**********************************************************************************************************************/
+
+typedef struct {
+ VoodooManager *manager;
+ VoodooInstanceID instance;
+
+ IComa *coma;
+} Listener_Requestor;
+
+static void
+Listener_Request( void *ctx,
+ void *arg )
+{
+ DirectResult ret;
+ Listener_Requestor *requestor = ctx;
+ IComa_data *coma_data;
+ int size;
+
+ coma_data = (IComa_data *) requestor->coma->priv;
+
+ ret = coma_allocation_size( coma_data->coma, arg, &size );
+ if (ret) {
+ D_DERROR( ret, "IComaComponent_Dispatcher/Listener_Request: Could not lookup allocation size!\n" );
+ return;
+ }
+
+ ret = voodoo_manager_request( requestor->manager, requestor->instance, 0, VREQ_NONE, NULL,
+ VMBT_DATA, size, arg,
+ VMBT_NONE );
+ if (ret)
+ D_DERROR( ret, "IComaComponent_Dispatcher/Listener_Request: Request failed!\n" );
+}
+
+static DirectResult
+Dispatch_Listen( IComaComponent *thiz, IComaComponent *real,
+ VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ DirectResult ret;
+ ComaNotificationID notification;
+ VoodooInstanceID instance;
+ VoodooMessageParser parser;
+ Listener_Requestor *requestor;
+
+ DIRECT_INTERFACE_GET_DATA(IComaComponent_Dispatcher)
+
+ VOODOO_PARSER_BEGIN( parser, msg );
+ VOODOO_PARSER_GET_UINT( parser, notification );
+ VOODOO_PARSER_GET_ID( parser, instance );
+ VOODOO_PARSER_END( parser );
+
+ if (!coma_policy_check_notification( data->coma_name, data->component_name, notification ))
+ return DR_ACCESSDENIED;
+
+ requestor = D_CALLOC( 1, sizeof(Listener_Requestor) );
+ if (!requestor)
+ return D_OOM();
+
+ requestor->manager = data->manager;
+ requestor->instance = instance;
+ requestor->coma = data->coma;
+
+ ret = real->Listen( real, notification, Listener_Request, requestor );
+ if (ret) {
+ D_FREE( requestor );
+ return ret;
+ }
+
+ direct_hash_insert( data->listeners, notification, requestor );
+
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, VOODOO_INSTANCE_NONE,
+ VMBT_NONE );
+}
+
+static DirectResult
+Dispatch_Unlisten( IComaComponent *thiz, IComaComponent *real,
+ VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ DirectResult ret;
+ ComaNotificationID notification;
+ VoodooMessageParser parser;
+ Listener_Requestor *requestor;
+
+ DIRECT_INTERFACE_GET_DATA(IComaComponent_Dispatcher)
+
+ VOODOO_PARSER_BEGIN( parser, msg );
+ VOODOO_PARSER_GET_UINT( parser, notification );
+ VOODOO_PARSER_END( parser );
+
+ requestor = direct_hash_lookup( data->listeners, notification );
+ if (!requestor)
+ return DR_IDNOTFOUND;
+
+ ret = real->Unlisten( real, notification );
+ if (ret) {
+ D_DERROR( ret, "IComaComponent_Dispatcher: Unlisten failed!\n" );
+ return ret;
+ }
+
+ direct_hash_remove( data->listeners, notification );
+
+ D_FREE( requestor );
+
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, VOODOO_INSTANCE_NONE,
+ VMBT_NONE );
+}
+
+/**********************************************************************************************************************/
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ D_DEBUG( "IComaComponent/Dispatcher: "
+ "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+ switch (msg->method) {
+ case ICOMACOMPONENT_METHOD_ID_Call:
+ return Dispatch_Call( dispatcher, real, manager, msg );
+
+ case ICOMACOMPONENT_METHOD_ID_Listen:
+ return Dispatch_Listen( dispatcher, real, manager, msg );
+
+ case ICOMACOMPONENT_METHOD_ID_Unlisten:
+ return Dispatch_Unlisten( dispatcher, real, manager, msg );
+ }
+
+ return DR_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Probe()
+{
+ /* This implementation has to be loaded explicitly. */
+ return DR_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DirectResult
+Construct( IComaComponent *thiz,
+ IComaComponent *real,
+ VoodooManager *manager,
+ VoodooInstanceID super,
+ void *arg, /* Optional arguments to constructor */
+ VoodooInstanceID *ret_instance )
+{
+ DirectResult ret;
+ VoodooInstanceID instance;
+
+ DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IComaComponent_Dispatcher)
+
+ ret = voodoo_manager_register_local( manager, false, thiz, real, Dispatch, &instance );
+ if (ret) {
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ IComaComponent_data *real_data = real->priv;
+
+ data->ref = 1;
+ data->real = real;
+ data->super = super;
+ data->self = instance;
+ data->manager = manager;
+ data->coma = arg;
+
+ data->coma_name = D_STRDUP( real_data->coma->name );
+ data->component_name = D_STRDUP( real_data->component->name );
+
+ ret = direct_hash_create( 17, &data->listeners );
+ if (ret) {
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ thiz->AddRef = IComaComponent_Dispatcher_AddRef;
+ thiz->Release = IComaComponent_Dispatcher_Release;
+
+ *ret_instance = instance;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.h b/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.h
new file mode 100755
index 0000000..f37e64e
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/icomacomponent_dispatcher.h
@@ -0,0 +1,45 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __ICOMACOMPONENT_DISPATCHER_H__
+#define __ICOMACOMPONENT_DISPATCHER_H__
+
+#define ICOMACOMPONENT_METHOD_ID_AddRef 1
+#define ICOMACOMPONENT_METHOD_ID_Release 2
+#define ICOMACOMPONENT_METHOD_ID_InitNotification 3
+#define ICOMACOMPONENT_METHOD_ID_InitNotifications 4
+#define ICOMACOMPONENT_METHOD_ID_Call 5
+#define ICOMACOMPONENT_METHOD_ID_Return 6
+#define ICOMACOMPONENT_METHOD_ID_Notify 7
+#define ICOMACOMPONENT_METHOD_ID_Listen 8
+#define ICOMACOMPONENT_METHOD_ID_InitListeners 9
+#define ICOMACOMPONENT_METHOD_ID_Unlisten 10
+#define ICOMACOMPONENT_METHOD_ID_Activate 11
+
+#endif
+
diff --git a/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.c b/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.c
new file mode 100755
index 0000000..cecd1a5
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.c
@@ -0,0 +1,223 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <fusiondale.h>
+
+#include <direct/debug.h>
+#include <direct/interface.h>
+#include <direct/messages.h>
+
+#include <coma/policy.h>
+
+#include <ifusiondale.h>
+
+#include <voodoo/interface.h>
+#include <voodoo/manager.h>
+#include <voodoo/message.h>
+
+#include "ifusiondale_dispatcher.h"
+
+static DirectResult Probe( void );
+static DirectResult Construct( IFusionDale *thiz,
+ VoodooManager *manager,
+ VoodooInstanceID *ret_instance );
+
+#include <direct/interface_implementation.h>
+
+DIRECT_INTERFACE_IMPLEMENTATION( IFusionDale, Dispatcher )
+
+
+/**************************************************************************************************/
+
+/*
+ * private data struct of IFusionDale_Dispatcher
+ */
+typedef struct {
+ int ref; /* reference counter */
+
+ IFusionDale *real;
+
+ VoodooInstanceID self; /* The instance of this dispatcher itself. */
+
+ VoodooManager *manager;
+} IFusionDale_Dispatcher_data;
+
+/**************************************************************************************************/
+
+static void
+IFusionDale_Dispatcher_Destruct( IFusionDale *thiz )
+{
+ IFusionDale_Dispatcher_data *data;
+
+ D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );
+
+ data = thiz->priv;
+
+ voodoo_manager_unregister_local( data->manager, data->self );
+
+ data->real->Release( data->real );
+
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+IFusionDale_Dispatcher_AddRef( IFusionDale *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IFusionDale_Dispatcher)
+
+ data->ref++;
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_Dispatcher_Release( IFusionDale *thiz )
+{
+ DIRECT_INTERFACE_GET_DATA(IFusionDale_Dispatcher)
+
+ if (--data->ref == 0)
+ IFusionDale_Dispatcher_Destruct( thiz );
+
+ return DR_OK;
+}
+
+static DirectResult
+IFusionDale_Dispatcher_EnterComa( IFusionDale *thiz,
+ const char *name,
+ IComa **ret_coma )
+{
+ DIRECT_INTERFACE_GET_DATA(IFusionDale_Dispatcher)
+
+ return DR_UNIMPLEMENTED;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Dispatch_EnterComa( IFusionDale *thiz, IFusionDale *real,
+ VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ DirectResult ret;
+ const char *name;
+ VoodooMessageParser parser;
+ IComa *coma;
+ VoodooInstanceID instance;
+
+ DIRECT_INTERFACE_GET_DATA(IFusionDale_Dispatcher)
+
+ VOODOO_PARSER_BEGIN( parser, msg );
+ VOODOO_PARSER_GET_STRING( parser, name );
+ VOODOO_PARSER_END( parser );
+
+ if (!coma_policy_check_manager( name ))
+ return DR_ACCESSDENIED;
+
+ ret = real->EnterComa( real, name, &coma );
+ if (ret)
+ return ret;
+
+ ret = voodoo_construct_dispatcher( manager, "IComa",
+ coma, data->self, NULL, &instance, NULL );
+ if (ret) {
+ coma->Release( coma );
+ return ret;
+ }
+
+ return voodoo_manager_respond( manager, true, msg->header.serial,
+ DR_OK, instance,
+ VMBT_NONE );
+}
+
+static DirectResult
+Dispatch( void *dispatcher, void *real, VoodooManager *manager, VoodooRequestMessage *msg )
+{
+ D_DEBUG( "IFusionDale/Dispatcher: "
+ "Handling request for instance %u with method %u...\n", msg->instance, msg->method );
+
+ switch (msg->method) {
+ case IFUSIONDALE_METHOD_ID_EnterComa:
+ return Dispatch_EnterComa( dispatcher, real, manager, msg );
+ }
+
+ return DR_NOSUCHMETHOD;
+}
+
+/**************************************************************************************************/
+
+static DirectResult
+Probe()
+{
+ /* This implementation has to be loaded explicitly. */
+ return DR_UNSUPPORTED;
+}
+
+/*
+ * Constructor
+ *
+ * Fills in function pointers and intializes data structure.
+ */
+static DirectResult
+Construct( IFusionDale *thiz, VoodooManager *manager, VoodooInstanceID *ret_instance )
+{
+ DirectResult ret;
+ IFusionDale *real;
+ VoodooInstanceID instance;
+
+ DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IFusionDale_Dispatcher)
+
+ ret = FusionDaleCreate( &real );
+ if (ret) {
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ ret = voodoo_manager_register_local( manager, VOODOO_INSTANCE_NONE, thiz, real, Dispatch, &instance );
+ if (ret) {
+ real->Release( real );
+ DIRECT_DEALLOCATE_INTERFACE( thiz );
+ return ret;
+ }
+
+ *ret_instance = instance;
+
+ data->ref = 1;
+ data->real = real;
+ data->self = instance;
+ data->manager = manager;
+
+ thiz->AddRef = IFusionDale_Dispatcher_AddRef;
+ thiz->Release = IFusionDale_Dispatcher_Release;
+ thiz->EnterComa = IFusionDale_Dispatcher_EnterComa;
+
+ return DR_OK;
+}
+
diff --git a/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.h b/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.h
new file mode 100755
index 0000000..9463f1a
--- /dev/null
+++ b/Source/FusionDale/proxy/dispatcher/ifusiondale_dispatcher.h
@@ -0,0 +1,41 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __IFUSIONDALE_DISPATCHER_H__
+#define __IFUSIONDALE_DISPATCHER_H__
+
+#include <fusiondale.h>
+
+#define IFUSIONDALE_METHOD_ID_AddRef 1
+#define IFUSIONDALE_METHOD_ID_Release 2
+#define IFUSIONDALE_METHOD_ID_CreateMessenger 3
+#define IFUSIONDALE_METHOD_ID_GetMessenger 4
+#define IFUSIONDALE_METHOD_ID_EnterComa 5
+
+#endif
+