summaryrefslogtreecommitdiff
path: root/bridges/inc/bridges/remote
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/inc/bridges/remote')
-rw-r--r--bridges/inc/bridges/remote/bridgeimpl.hxx97
-rw-r--r--bridges/inc/bridges/remote/connection.h70
-rw-r--r--bridges/inc/bridges/remote/context.h263
-rw-r--r--bridges/inc/bridges/remote/counter.hxx60
-rw-r--r--bridges/inc/bridges/remote/helper.hxx71
-rw-r--r--bridges/inc/bridges/remote/mapping.hxx72
-rw-r--r--bridges/inc/bridges/remote/proxy.hxx94
-rw-r--r--bridges/inc/bridges/remote/remote.h96
-rw-r--r--bridges/inc/bridges/remote/remote.hxx76
-rw-r--r--bridges/inc/bridges/remote/stub.hxx67
10 files changed, 966 insertions, 0 deletions
diff --git a/bridges/inc/bridges/remote/bridgeimpl.hxx b/bridges/inc/bridges/remote/bridgeimpl.hxx
new file mode 100644
index 000000000000..2a0e867b8cc8
--- /dev/null
+++ b/bridges/inc/bridges/remote/bridgeimpl.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bridgeimpl.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
+#define _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+
+#include <bridges/remote/context.h>
+#include <bridges/remote/remote.h>
+
+
+struct remote_BridgeImpl
+{
+ void (SAL_CALL * m_allThreadsAreGone ) ( uno_Environment * );
+ requestClientSideDispatcher m_sendRequest;
+ oslInterlockedCount m_nRemoteThreads;
+ sal_Bool m_bDisposed;
+ sal_Bool m_bReleaseStubsCalled;
+};
+
+namespace bridges_remote {
+
+ enum RemoteThreadCounter_HoldEnvWeak
+ {
+ RTC_HOLDENVWEAK = 0x1
+ };
+
+ class RemoteThreadCounter
+ {
+ public:
+ // performance optimization. In some cases, it is not necessary to acquire the
+ // environment.
+ RemoteThreadCounter( uno_Environment *pEnvRemote, RemoteThreadCounter_HoldEnvWeak )
+ : m_bReleaseEnvironment( sal_False )
+ , m_pEnvRemote( pEnvRemote )
+ {
+ remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+ osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
+ }
+
+ RemoteThreadCounter( uno_Environment *pEnvRemote )
+ : m_bReleaseEnvironment( sal_True )
+ , m_pEnvRemote( pEnvRemote )
+ {
+ m_pEnvRemote->acquire( m_pEnvRemote );
+
+ remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+ osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
+ }
+
+ ~RemoteThreadCounter( )
+ {
+ remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
+ if( 0 == osl_decrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads)) &&
+ pContext->m_pBridgeImpl->m_bDisposed &&
+ ! pContext->m_pBridgeImpl->m_bReleaseStubsCalled )
+ {
+ pContext->m_pBridgeImpl->m_allThreadsAreGone( m_pEnvRemote );
+ }
+ if( m_bReleaseEnvironment )
+ m_pEnvRemote->release( m_pEnvRemote );
+ }
+
+ sal_Bool m_bReleaseEnvironment;
+ uno_Environment *m_pEnvRemote;
+ };
+}
+
+#endif
diff --git a/bridges/inc/bridges/remote/connection.h b/bridges/inc/bridges/remote/connection.h
new file mode 100644
index 000000000000..3c4dfe066c6f
--- /dev/null
+++ b/bridges/inc/bridges/remote/connection.h
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: connection.h,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_CONNECTION_H_
+#define _BRIDGES_REMOTE_CONNECTION_H_
+#include <sal/types.h>
+
+/** Specfies a C-interface for a bidirectional bytestream,
+ which is used by a UNO remote environment.
+ */
+struct remote_Connection
+{
+ void ( SAL_CALL * acquire ) ( remote_Connection *);
+
+ void ( SAL_CALL * release ) ( remote_Connection *);
+
+ /**
+ reads nSize bytes from the connection. This method blocks, until
+ all bytes are available or an error occurs.
+ @return Number of bytes read.
+ If the return value is less than nSize, an unrecoverable
+ i/o error has occured or the connection was closed.
+
+ */
+ sal_Int32 (SAL_CALL * read)(remote_Connection *, sal_Int8 *pDest, sal_Int32 nSize );
+
+ /**
+ @return Number of bytes written.
+ if the return value is less than nSize an unrecoverable
+ i/o error has occured or the connection was closed.
+ */
+ sal_Int32 (SAL_CALL * write)(remote_Connection *, const sal_Int8 *pSource, sal_Int32 nSize );
+
+ void ( SAL_CALL * flush ) ( remote_Connection * );
+
+ /** closes the connection.
+ Any read or write operation after this call shall not be served
+ anymore. Any ongoing read or write operation must return immeadiatly after this call.
+ The implementation should cope with multiple calls to this method.
+ */
+ void (SAL_CALL * close) ( remote_Connection * );
+};
+
+#endif
diff --git a/bridges/inc/bridges/remote/context.h b/bridges/inc/bridges/remote/context.h
new file mode 100644
index 000000000000..e682c5230577
--- /dev/null
+++ b/bridges/inc/bridges/remote/context.h
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: context.h,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _BRIDGES_REMOTE_CONTEXT_H_
+#define _BRIDGES_REMOTE_CONTEXT_H_
+#include <osl/interlck.h>
+#include <osl/conditn.h>
+
+#include <typelib/typedescription.h>
+
+#include <uno/environment.h>
+#include <uno/any2.h>
+
+
+/** Interface for refcounted contexts of uno-environments.
+
+ Not all uno_Contexts need to be refcounted, in case they are,
+ they should be 'derived' from this struct.
+ This is used as a base class for the remote_Context.
+ @see uno_Environment
+ @see uno_getEnvironment()
+ @see remote_Context
+ */
+struct uno_Context
+{
+ /** increase the refcount of the context
+ */
+ void (SAL_CALL * acquire)( uno_Context *pContext );
+
+ /** decrements the recount of the context. In case the recount drops to zero,
+ the context gets destroye.
+ */
+ void (SAL_CALL * release)( uno_Context *pContext);
+
+ /** Allows to query for a different interface of the uno_Context.
+ The result of the void pointer is unspecified and depends on the concrete context.
+ */
+ void * (SAL_CALL *query ) ( uno_Context *pContext , rtl_uString *pId);
+};
+
+struct remote_Connection;
+struct remote_Context;
+struct remote_Interface;
+
+
+
+/** performs a query-interface for a certain interface via the remote connection !
+
+ @param pEnvRemote The environment, that shall perform the call.
+ @param ppRemoteI in/out parameter contains the interface returned by queryInterface
+ @param pOid the oid of the 'ghost' object on which the call must be done.
+ ***/
+typedef void ( SAL_CALL * remote_getInstanceFunc ) (
+ uno_Environment *pEnvRemote,
+ remote_Interface **ppRemoteI,
+ rtl_uString *pOid,
+ typelib_TypeDescriptionReference *pInterfaceTypeRef,
+ uno_Any **ppException );
+
+
+/** refcounted C-interface, which provides object by name.
+ */
+struct remote_InstanceProvider
+{
+ void (SAL_CALL * acquire ) ( remote_InstanceProvider * pProvider );
+ void (SAL_CALL * release ) ( remote_InstanceProvider * pProvider );
+ void (SAL_CALL * getInstance ) ( remote_InstanceProvider * pProvider ,
+ uno_Environment *pEnvRemote,
+ remote_Interface **ppRemoteI,
+ rtl_uString *pInstanceName,
+ typelib_InterfaceTypeDescription *pType,
+ uno_Any **ppException );
+};
+
+/** refcounted C-interface, which allows to register a listener to an
+ remote bridge to be informed when the bridge gets disposed.
+
+ @see remote_Context
+ */
+struct remote_DisposingListener
+{
+ void (SAL_CALL * acquire ) ( remote_DisposingListener * pProvider );
+ void (SAL_CALL * release ) ( remote_DisposingListener * pProvider );
+ void (SAL_CALL * disposing ) ( remote_DisposingListener * pProvider,
+ rtl_uString *pBridgeName );
+};
+
+
+/**
+ Try to get an existing context characterized by the pIdString. Each ID-String must
+ uniquely charcterize a certain connection. The context can't be retrieved via this
+ function anymore, after it got disposed.
+
+ @return 0 when such a context does not exist, otherwise
+ a pointer to an acquired remote_Context.
+ **/
+extern "C" remote_Context * SAL_CALL
+remote_getContext( rtl_uString *pIdString );
+
+/**
+ Create an acquired remote context. The Context is weakly held by the context administration
+ and can be accessed later through remote_getContext() (using the same id-string).
+
+ @param pIdString A string, that uniquely describes the connection. For e.g. a socket connection,
+ host and port of the local and remote host should be in the string.
+
+ @param pDescription
+ Description of the connection, that may brought up to the user.
+
+ @param pProtocol
+ The protocol, that the environment uses for
+ communicating with the remote process.
+ The format of the protocol string is : "protocolname,para1=para1value,..."
+ @return 0, when a context with this name already exists.
+
+ @see remote_getContext()
+ @see remote_Context
+ */
+extern "C" remote_Context * SAL_CALL
+remote_createContext( remote_Connection *pConnection,
+ rtl_uString *pIdStr,
+ rtl_uString *pDescription,
+ rtl_uString *pProtocol,
+ remote_InstanceProvider *);
+
+const sal_Int32 REMOTE_CONTEXT_CREATE = 1;
+const sal_Int32 REMOTE_CONTEXT_DESTROY = 2;
+
+typedef void ( SAL_CALL * remote_contextListenerFunc ) (
+ void *pThis,
+ sal_Int32 nRemoteContextMode,
+ rtl_uString *sName,
+ rtl_uString *sDescription
+ );
+
+/** Registers a listener at the context administration, which allows to keep
+ track of existing remote connections.
+ @param pObject object which is handed to the listener function, when called.
+ */
+extern "C" void SAL_CALL
+remote_addContextListener( remote_contextListenerFunc listener, void *pObject );
+
+
+/** Removes a listener from the context administration.
+ */
+extern "C" void SAL_CALL
+remote_removeContextListener( remote_contextListenerFunc listener , void *pObject );
+
+/** Allows to retrieve all existing context strings.
+
+ @param pnStringCount out parameter. Contains the number of rtl_uStrings in the array
+ @param memAlloc a memory allocation function for the array of pointers to rtl_uStrings
+
+ @return array of rtl strings. The caller must call release on all rtl_uString s and must free
+ the pointer array.
+ */
+extern "C" rtl_uString ** SAL_CALL
+remote_getContextList(
+ sal_Int32 *pnStringCount,
+ void * ( SAL_CALL * memAlloc ) ( sal_Size nBytesToAlloc ) );
+
+
+struct remote_BridgeImpl;
+
+/** The context structure for a remote bridge.
+
+ @see uno_getEnvironment()
+ */
+struct remote_Context
+{
+ struct uno_Context aBase;
+
+ /**
+ These methods are implemented by context administration
+ */
+ void ( SAL_CALL * addDisposingListener ) ( remote_Context *,
+ remote_DisposingListener * );
+ void ( SAL_CALL * removeDisposingListener ) ( remote_Context *,
+ remote_DisposingListener * );
+ /**
+ will be called by the environment when it gets disposed
+ */
+ void ( SAL_CALL * dispose ) ( remote_Context * );
+
+ /** The method is set by the remote-environment during environment initialization.
+ @see remote_getInstanceFunc
+ */
+ remote_getInstanceFunc getRemoteInstance;
+
+ /**
+ The protocol, that the environment uses for communicating with the remote process.
+ The format of the protocol string is : "protocolname,para1=para1value,..."
+ The parameters are protocol dependend
+ */
+ rtl_uString *m_pProtocol;
+
+ /**
+ It may be the same as m_pName.
+ Livetime is handled by the context administration.
+ */
+ rtl_uString *m_pDescription;
+
+ /**
+ The name of this context at context administration.
+ A string, that uniquely describes this environment.
+ Livetime is handled by the context administration.
+ */
+ rtl_uString *m_pName;
+
+ /** The instance-provider, which is used to look up unknown object identifiers.
+ Is usually called on server side, when the first client request comes in.
+ Maybe 0. Livetime is handled by the context administration.
+ */
+ remote_InstanceProvider *m_pInstanceProvider;
+
+ /**
+ The connection of this context.
+ Livetime is handled by the context administration.
+ */
+ remote_Connection *m_pConnection;
+
+ /**
+ Here arbitrary data may be stored. It may be used by a connection
+ service to store environment specific data. The bridge does not
+ use it.
+ */
+ void *m_pAdditionalInformation;
+
+ /**
+ here the bridge stores its private per environment data.
+ */
+ struct remote_BridgeImpl *m_pBridgeImpl;
+};
+
+#endif
+
diff --git a/bridges/inc/bridges/remote/counter.hxx b/bridges/inc/bridges/remote/counter.hxx
new file mode 100644
index 000000000000..939c8b4967de
--- /dev/null
+++ b/bridges/inc/bridges/remote/counter.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: counter.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_COUNTER_H_
+#define _BRIDGES_REMOTE_COUNTER_H_
+#include <stdio.h>
+#if OSL_DEBUG_LEVEL > 1
+struct MyCounter
+{
+ MyCounter( sal_Char const *pName ) :
+ m_nCounter( 0 ),
+ m_pName ( pName )
+ {
+ }
+ ~MyCounter()
+ {
+ if( m_nCounter ) {
+ printf(
+ "%s : %ld left\n", m_pName,
+ sal::static_int_cast< long >(m_nCounter) );
+ }
+ }
+ void acquire()
+ { m_nCounter ++; }
+ void release()
+ { m_nCounter --; }
+
+
+ sal_Int32 m_nCounter;
+ sal_Char const *m_pName;
+};
+#endif
+
+#endif
diff --git a/bridges/inc/bridges/remote/helper.hxx b/bridges/inc/bridges/remote/helper.hxx
new file mode 100644
index 000000000000..ea2a98e74055
--- /dev/null
+++ b/bridges/inc/bridges/remote/helper.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: helper.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <bridges/remote/bridgeimpl.hxx>
+
+typedef void ( SAL_CALL * ReleaseRemoteCallbackFunc ) (
+ remote_Interface *ppRemoteI,
+ rtl_uString *pOid,
+ typelib_TypeDescriptionReference *pTypeRef,
+ uno_Environment *pEnvRemote
+ );
+
+typedef void ( SAL_CALL * remote_createStubFunc ) (
+ remote_Interface **ppRemoteI,
+ rtl_uString *pOid ,
+ typelib_TypeDescriptionReference *pTypeRef,
+ uno_Environment *pEnvRemote,
+ ReleaseRemoteCallbackFunc callback
+ );
+namespace bridges_remote
+{
+
+ /** @param callback If the bridge implementation wants to handle the remote release call,
+ it can do it giving this callback. If callback == 0, the releaseRemote
+ method of the stub is called.
+ */
+ void SAL_CALL remote_createStub (
+ remote_Interface **ppRemoteI,
+ rtl_uString *pOid ,
+ typelib_TypeDescriptionReference *pType,
+ uno_Environment *pEnvRemote,
+ ReleaseRemoteCallbackFunc callback );
+
+ void SAL_CALL remote_retrieveOidFromProxy(
+ remote_Interface *pRemtoeI,
+ rtl_uString **ppOid );
+
+ void SAL_CALL remote_sendQueryInterface(
+ uno_Environment *pEnvRemote,
+ remote_Interface **ppRemoteI,
+ rtl_uString *pOid ,
+ typelib_TypeDescriptionReference *pType,
+ uno_Any **ppException
+ );
+}
diff --git a/bridges/inc/bridges/remote/mapping.hxx b/bridges/inc/bridges/remote/mapping.hxx
new file mode 100644
index 000000000000..42577db07d0e
--- /dev/null
+++ b/bridges/inc/bridges/remote/mapping.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: mapping.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_MAPPING_HXX_
+#define _BRIDGES_REMOTE_MAPPING_HXX_
+
+#include <osl/interlck.h>
+#include <rtl/ustring.hxx>
+
+#include <typelib/typedescription.h>
+
+#include <bridges/remote/remote.h>
+
+typedef struct _uno_Environment uno_Environment;
+
+namespace bridges_remote
+{
+ extern "C" typedef void SAL_CALL RemoteToUno(
+ uno_Mapping *pMapping, void **ppOut, void *pInterface,
+ typelib_InterfaceTypeDescription *pInterfaceTypeDescr );
+ RemoteToUno remoteToUno;
+
+ extern "C" typedef void SAL_CALL UnoToRemote(
+ uno_Mapping *pMapping, void **ppOut, void *pInterface,
+ typelib_InterfaceTypeDescription *pInterfaceTypeDescr );
+ UnoToRemote unoToRemote;
+
+ extern "C" typedef void SAL_CALL FreeRemoteMapping(uno_Mapping * mapping);
+ FreeRemoteMapping freeRemoteMapping;
+
+ class RemoteMapping :
+ public remote_Mapping
+ {
+ public:
+ RemoteMapping( uno_Environment *pEnvUno ,
+ uno_Environment *pEnvRemote,
+ uno_MapInterfaceFunc func ,
+ const ::rtl::OUString sPurpose);
+ ~RemoteMapping();
+
+ oslInterlockedCount m_nRef;
+ ::rtl::OUString m_sPurpose;
+ };
+
+}
+#endif
diff --git a/bridges/inc/bridges/remote/proxy.hxx b/bridges/inc/bridges/remote/proxy.hxx
new file mode 100644
index 000000000000..03e2f8684c48
--- /dev/null
+++ b/bridges/inc/bridges/remote/proxy.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: proxy.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+#include <uno/dispatcher.h>
+#include <uno/mapping.hxx>
+
+#include <bridges/remote/remote.h>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL FreeRemote2UnoProxy(
+ uno_ExtEnvironment * environment, void * proxy);
+FreeRemote2UnoProxy freeRemote2UnoProxy;
+
+// private:
+extern "C" typedef void SAL_CALL AcquireRemote2UnoProxy(uno_Interface *);
+AcquireRemote2UnoProxy acquireRemote2UnoProxy;
+
+// private:
+extern "C" typedef void SAL_CALL ReleaseRemote2UnoProxy(uno_Interface *);
+ReleaseRemote2UnoProxy releaseRemote2UnoProxy;
+
+// private:
+extern "C" typedef void SAL_CALL DispatchRemote2UnoProxy(
+ uno_Interface *, typelib_TypeDescription const *, void *, void **,
+ uno_Any **);
+DispatchRemote2UnoProxy dispatchRemote2UnoProxy;
+
+extern "C" void SAL_CALL remote_release( void * );
+
+class Remote2UnoProxy :
+ public uno_Interface
+{
+public:
+ Remote2UnoProxy(
+ remote_Interface *pRemoteI,
+ rtl_uString *pOid,
+ typelib_InterfaceTypeDescription *pType ,
+ uno_Environment *pEnvUno,
+ uno_Environment *pEnvRemote
+ );
+
+ ~Remote2UnoProxy();
+
+private:
+ ::rtl::OUString m_sOid;
+ typelib_InterfaceTypeDescription *m_pType;
+ remote_Interface *m_pRemoteI;
+ uno_Environment *m_pEnvUno;
+ uno_Environment *m_pEnvRemote;
+ ::com::sun::star::uno::Mapping m_mapRemote2Uno;
+ ::com::sun::star::uno::Mapping m_mapUno2Remote;
+
+ oslInterlockedCount m_nRef;
+
+ friend void SAL_CALL acquireRemote2UnoProxy(uno_Interface *);
+
+ friend void SAL_CALL releaseRemote2UnoProxy(uno_Interface *);
+
+ friend void SAL_CALL dispatchRemote2UnoProxy(
+ uno_Interface *, typelib_TypeDescription const *, void *, void **,
+ uno_Any **);
+};
+
+}
diff --git a/bridges/inc/bridges/remote/remote.h b/bridges/inc/bridges/remote/remote.h
new file mode 100644
index 000000000000..00fd8f5e778d
--- /dev/null
+++ b/bridges/inc/bridges/remote/remote.h
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: remote.h,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_REMOTE_H
+#define _BRIDGES_REMOTE_REMOTE_H
+#include <uno/mapping.h>
+#include <uno/any2.h>
+
+#include <typelib/typedescription.h>
+#include <uno/environment.h>
+
+#define CORBA_STRING8_NAME "com.sun.star.corba.CorbaString8"
+#define CORBA_STRING8_NAME_LENGTH (sizeof(CORBA_STRING8_NAME)-1)
+
+#define CORBA_UNION_NAME "com.sun.star.corba.CorbaUnion"
+#define CORBA_UNION_NAME_LENGTH (sizeof(CORBA_UNION_NAME)-1)
+
+#define REMOTE_MARSHALED_MSGHDR_SIZE 12
+#define REMOTE_RELEASE_METHOD_INDEX 2
+#define REMOTE_RELEASE_METHOD_NAME "release"
+
+#define CURRENT_IIOP_PROTOCOL_MAJOR 1
+#define CURRENT_IIOP_PROTOCOL_MINOR 2
+
+extern "C" {
+
+struct remote_Interface;
+
+/** @internal
+ */
+typedef void (SAL_CALL * remote_DispatchMethod)(
+ remote_Interface * pRemoteI, typelib_TypeDescription const * pMemberType,
+ void * pReturn, void * pArgs[], uno_Any ** ppException );
+
+/**
+ @internal
+ */
+typedef void ( SAL_CALL * requestClientSideDispatcher ) (
+ uno_Environment *pEnvRemote,
+ typelib_TypeDescription const * pMemberType,
+ rtl_uString *pOid,
+ typelib_InterfaceTypeDescription *pInterfaceType,
+ void *pReturn,
+ void *ppArgs[],
+ uno_Any **ppException );
+
+/** The base class of an UNO interface in a remote environment.
+ */
+struct remote_Interface
+{
+ void (SAL_CALL * acquire)( remote_Interface * pInterface );
+
+ void (SAL_CALL * release)( remote_Interface * pInterface );
+
+ remote_DispatchMethod pDispatcher;
+};
+
+/** The mapping between an binary-c-uno and a remote environment.
+ @internal
+ */
+struct remote_Mapping
+{
+ uno_Mapping aBase;
+ uno_Environment *pEnvRemote;
+ uno_Environment *pEnvUno;
+};
+
+}
+
+#endif
diff --git a/bridges/inc/bridges/remote/remote.hxx b/bridges/inc/bridges/remote/remote.hxx
new file mode 100644
index 000000000000..c9d6fd08cbc1
--- /dev/null
+++ b/bridges/inc/bridges/remote/remote.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: remote.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BRIDGES_REMOTE_REMOTE_HXX_
+#define _BRIDGES_REMOTE_REMOTE_HXX_
+#include <list>
+
+#include <osl/mutex.hxx>
+#include <osl/conditn.h>
+#include <osl/interlck.h>
+
+#include <uno/environment.h>
+
+#include <bridges/remote/remote.h>
+#include <bridges/remote/connection.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL AcquireRemote2RemoteStub(
+ remote_Interface * pThis);
+AcquireRemote2RemoteStub acquireRemote2RemoteStub;
+
+extern "C" typedef void SAL_CALL FreeRemote2RemoteStub(
+ uno_ExtEnvironment * environment, void * stub);
+FreeRemote2RemoteStub freeRemote2RemoteStub;
+
+class Remote2RemoteStub :
+ public remote_Interface
+{
+public:
+ Remote2RemoteStub(rtl_uString *pOid,
+ typelib_InterfaceTypeDescription *pType,
+ uno_Environment *pEnvRemote,
+ requestClientSideDispatcher dispatch );
+ ~Remote2RemoteStub();
+
+ void releaseRemote();
+public:
+ ::rtl::OUString m_sOid;
+ typelib_InterfaceTypeDescription *m_pType;
+ oslInterlockedCount m_nRef;
+ uno_Environment *m_pEnvRemote;
+ requestClientSideDispatcher m_dispatch;
+ oslInterlockedCount m_nReleaseRemote;
+};
+
+}
+#endif
diff --git a/bridges/inc/bridges/remote/stub.hxx b/bridges/inc/bridges/remote/stub.hxx
new file mode 100644
index 000000000000..5f97270aac6b
--- /dev/null
+++ b/bridges/inc/bridges/remote/stub.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: stub.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <bridges/remote/remote.hxx>
+
+#include <uno/dispatcher.h>
+#include <uno/mapping.hxx>
+
+namespace bridges_remote {
+
+extern "C" typedef void SAL_CALL AcquireUno2RemoteStub( remote_Interface *pThis );
+AcquireUno2RemoteStub acquireUno2RemoteStub;
+
+extern "C" typedef void SAL_CALL FreeUno2RemoteStub(
+ uno_ExtEnvironment * environment, void * stub);
+FreeUno2RemoteStub freeUno2RemoteStub;
+
+class Uno2RemoteStub :
+ public remote_Interface
+{
+public:
+ Uno2RemoteStub( uno_Interface *pUnoI,
+ rtl_uString *pOid,
+ typelib_InterfaceTypeDescription *pType,
+ uno_Environment *pEnvUno,
+ uno_Environment *pEnvRemote );
+ ~Uno2RemoteStub();
+
+public:
+ ::rtl::OUString m_sOid;
+ typelib_InterfaceTypeDescription *m_pType;
+ uno_Interface *m_pUnoI;
+ oslInterlockedCount m_nRef;
+
+ uno_Environment *m_pEnvUno;
+ uno_Environment *m_pEnvRemote;
+ ::com::sun::star::uno::Mapping m_mapRemote2Uno;
+ ::com::sun::star::uno::Mapping m_mapUno2Remote;
+};
+
+}