summaryrefslogtreecommitdiff
path: root/automation/inc
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-04-11 17:21:01 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-04-11 17:21:01 +0000
commita5267fceb33b6f45fa0b3020305c8ed5e7f2a8f5 (patch)
tree03e4cc520e964b5305812fef3f2b648266f720af /automation/inc
parent2be34a60988acfe30a8ead74dcfde5355ae307fe (diff)
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2006/12/12 15:45:23 vg 1.1.2.1: #i72503# moved from ./..
Diffstat (limited to 'automation/inc')
-rw-r--r--automation/inc/automation/communi.hxx194
-rw-r--r--automation/inc/automation/simplecm.hxx413
2 files changed, 607 insertions, 0 deletions
diff --git a/automation/inc/automation/communi.hxx b/automation/inc/automation/communi.hxx
new file mode 100644
index 000000000000..48553109d2ab
--- /dev/null
+++ b/automation/inc/automation/communi.hxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: communi.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 18:20:35 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * 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 _COMMUNI_HXX
+#define _COMMUNI_HXX
+
+#ifndef _SVARRAY_HXX //autogen
+#include <svtools/svarray.hxx>
+#endif
+#ifndef _VOS_THREAD_HXX_ //autogen
+#include <vos/thread.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_ //autogen
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <vcl/timer.hxx>
+#endif
+
+#ifndef _SIMPLECM_HXX
+#include <automation/simplecm.hxx>
+#endif
+
+class SvStream;
+class SvMemoryStream;
+//class Application;
+
+class CommunicationManagerServerAcceptThread;
+SV_DECL_PTRARR_SORT( CommunicationLinkList, CommunicationLink*, 1, 10 )
+
+class MultiCommunicationManager : public CommunicationManager
+{
+public:
+ MultiCommunicationManager( BOOL bUseMultiChannel = FALSE );
+ virtual ~MultiCommunicationManager();
+ virtual BOOL StopCommunication(); // Hält alle CommunicationLinks an
+ virtual BOOL IsLinkValid( CommunicationLink* pCL );
+ virtual USHORT GetCommunicationLinkCount();
+ virtual CommunicationLinkRef GetCommunicationLink( USHORT nNr );
+protected:
+ virtual void CallConnectionOpened( CommunicationLink* pCL );
+ virtual void CallConnectionClosed( CommunicationLink* pCL );
+ CommunicationLinkList *ActiveLinks;
+ CommunicationLinkList *InactiveLinks; /// Hier sind die CommunicationLinks drin, die sich noch nicht selbst abgemeldet haben.
+ /// allerdings schon ein StopCommunication gekriegt haben, bzw ein ConnectionTerminated
+ virtual void DestroyingLink( CommunicationLink *pCL ); // Link trägt sich im Destruktor aus
+};
+
+class CommunicationManagerServer : public MultiCommunicationManager
+{
+public:
+ CommunicationManagerServer( BOOL bUseMultiChannel = FALSE ):MultiCommunicationManager( bUseMultiChannel ){;}
+};
+
+class CommunicationManagerClient : public MultiCommunicationManager, public ICommunicationManagerClient
+{
+public:
+ CommunicationManagerClient( BOOL bUseMultiChannel = FALSE );
+};
+
+class CommunicationLinkViaSocket : public SimpleCommunicationLinkViaSocket, public NAMESPACE_VOS(OThread)
+{
+public:
+ CommunicationLinkViaSocket( CommunicationManager *pMan, NAMESPACE_VOS(OStreamSocket) *pSocket );
+ virtual ~CommunicationLinkViaSocket();
+
+ virtual BOOL IsCommunicationError();
+ virtual BOOL DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE );
+
+ // Diese sind Virtuelle Links!!!!
+ virtual long ConnectionClosed( void* = NULL );
+ virtual long DataReceived( void* = NULL );
+
+ virtual BOOL StopCommunication();
+
+ void SetPutDataReceivedHdl( Link lPutDataReceived ){ mlPutDataReceived = lPutDataReceived; }
+ Link GetDataReceivedLink () {Link aLink = LINK( this, CommunicationLinkViaSocket, DataReceived ); return aLink;}
+ DECL_LINK( PutDataReceivedHdl, CommunicationLinkViaSocket* );
+
+protected:
+ virtual void SAL_CALL run();
+
+ virtual BOOL ShutdownCommunication();
+ ULONG nConnectionClosedEventId;
+ ULONG nDataReceivedEventId;
+ NAMESPACE_VOS(OMutex) aMConnectionClosed; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist
+ NAMESPACE_VOS(OMutex) aMDataReceived; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist
+ virtual void WaitForShutdown();
+
+ DECL_LINK( ShutdownLink, void* );
+ Timer aShutdownTimer;
+ BOOL bShutdownStarted;
+ BOOL bDestroying;
+ Link mlPutDataReceived;
+};
+
+class CommunicationManagerServerViaSocket : public CommunicationManagerServer
+{
+ friend class CommunicationManagerServerAcceptThread;
+public:
+ using CommunicationManager::StartCommunication;
+
+ CommunicationManagerServerViaSocket( ULONG nPort, USHORT nMaxCon, BOOL bUseMultiChannel = FALSE );
+ virtual ~CommunicationManagerServerViaSocket();
+
+ virtual BOOL StartCommunication();
+ virtual BOOL StopCommunication();
+
+protected:
+ ULONG nPortToListen;
+ USHORT nMaxConnections;
+
+private:
+ CommunicationManagerServerAcceptThread *pAcceptThread;
+ void AddConnection( CommunicationLink *pNewConnection );
+};
+
+class CommunicationManagerServerAcceptThread: public NAMESPACE_VOS(OThread)
+{
+public:
+ CommunicationManagerServerAcceptThread( CommunicationManagerServerViaSocket* pServer, ULONG nPort, USHORT nMaxCon = CM_UNLIMITED_CONNECTIONS );
+ virtual ~CommunicationManagerServerAcceptThread();
+ CommunicationLinkRef GetNewConnection(){ CommunicationLinkRef xTemp = xmNewConnection; xmNewConnection.Clear(); return xTemp; }
+
+protected:
+ virtual void SAL_CALL run();
+
+private:
+ CommunicationManagerServerViaSocket* pMyServer;
+ NAMESPACE_VOS(OAcceptorSocket) *pAcceptorSocket;
+ ULONG nPortToListen;
+ USHORT nMaxConnections;
+ ULONG nAddConnectionEventId;
+ NAMESPACE_VOS(OMutex) aMAddConnection; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist
+ void CallInfoMsg( InfoString aMsg ){ pMyServer->CallInfoMsg( aMsg ); }
+ CM_InfoType GetInfoType(){ return pMyServer->GetInfoType(); }
+
+ // Diese beiden werden zum Transport der Connection vom Thread zum Mainthread verwendet.
+ CommunicationLinkRef xmNewConnection;
+ DECL_LINK( AddConnection, void* );
+};
+
+class CommunicationManagerClientViaSocket : public CommunicationManagerClient, CommonSocketFunctions
+{
+public:
+ using CommunicationManager::StartCommunication;
+
+ CommunicationManagerClientViaSocket( ByteString aHost, ULONG nPort, BOOL bUseMultiChannel = FALSE );
+ CommunicationManagerClientViaSocket( BOOL bUseMultiChannel = FALSE );
+ virtual ~CommunicationManagerClientViaSocket();
+
+ virtual BOOL StartCommunication(){ return StartCommunication( aHostToTalk, nPortToTalk );}
+ virtual BOOL StartCommunication( ByteString aHost, ULONG nPort ){ return DoStartCommunication( this, (ICommunicationManagerClient*) this, aHost, nPort );}
+
+private:
+ ByteString aHostToTalk;
+ ULONG nPortToTalk;
+protected:
+ virtual CommunicationLink *CreateCommunicationLink( CommunicationManager *pCM, NAMESPACE_VOS(OConnectorSocket) *pCS ){ return new CommunicationLinkViaSocket( pCM, pCS ); }
+};
+
+#endif
diff --git a/automation/inc/automation/simplecm.hxx b/automation/inc/automation/simplecm.hxx
new file mode 100644
index 000000000000..a2e19c399aa3
--- /dev/null
+++ b/automation/inc/automation/simplecm.hxx
@@ -0,0 +1,413 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: simplecm.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 18:21:01 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * 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 _SIMPLECM_HXX
+#define _SIMPLECM_HXX
+
+#ifndef _LINK_HXX //autogen
+#include <tools/link.hxx>
+#endif
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _VOS_SOCKET_HXX_ //autogen
+#include <vos/socket.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _DATETIME_HXX //autogen
+#include <tools/datetime.hxx>
+#endif
+
+#include <automation/commdefines.hxx>
+
+// CM steht für CommunicationManager
+#define CM_UNLIMITED_CONNECTIONS 0xffff
+
+typedef USHORT CM_NameType;
+#define CM_DOTTED ( (CM_NameType) 01 )
+#define CM_FQDN ( (CM_NameType) 02 )
+
+typedef USHORT CM_InfoType;
+// nur eines dieser 3 defines darf verwendet werden
+#define CM_NO_TEXT ( (CM_InfoType) 01 )
+#define CM_SHORT_TEXT ( (CM_InfoType) 02 )
+#define CM_VERBOSE_TEXT ( (CM_InfoType) 03 )
+
+#define CM_OPEN ( (CM_InfoType) 0x0004 )
+#define CM_CLOSE ( (CM_InfoType) 0x0008 )
+#define CM_RECEIVE ( (CM_InfoType) 0x0010 )
+#define CM_SEND ( (CM_InfoType) 0x0020 )
+#define CM_ERROR ( (CM_InfoType) 0x0040 )
+#define CM_MISC ( (CM_InfoType) 0x0080 )
+
+#define CM_USER_1 ( (CM_InfoType) 0x0100 )
+#define CM_USER_2 ( (CM_InfoType) 0x0200 )
+#define CM_USER_3 ( (CM_InfoType) 0x0400 )
+#define CM_USER_4 ( (CM_InfoType) 0x0800 )
+
+#define CM_ALL ( CM_OPEN | CM_CLOSE | CM_RECEIVE | CM_SEND | CM_ERROR | CM_MISC )
+#define CM_NONE ( 0 )
+
+#define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) )
+
+#define INFO_MSG( Short, Long, Type, CLink ) \
+{ \
+ if ( (Type & GetInfoType()) > 0 ) \
+ { \
+ switch ( GetInfoType() & 03 ) \
+ { \
+ case CM_NO_TEXT: \
+ { \
+ ByteString aByteString; \
+ CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \
+ } \
+ break; \
+ case CM_SHORT_TEXT: \
+ { \
+ ByteString aByteString( Short ); \
+ CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \
+ } \
+ break; \
+ case CM_VERBOSE_TEXT: \
+ { \
+ ByteString aByteString( Long ); \
+ CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \
+ } \
+ break; \
+ default: \
+ break; \
+ } \
+ } \
+}\
+
+class CommunicationLink;
+
+/*#undef PRV_SV_DECL_REF_LOCK
+#define PRV_SV_DECL_REF_LOCK(ClassName, Ref) \
+protected: \
+ ClassName * pObj; \
+public: \
+PRV_SV_DECL_REF_SIGNATURE(ClassName, Ref) \
+ inline ClassName##Ref( void * pObjP ){ClassName##Ref ((ClassName *) pObjP);} \
+*/
+
+SV_DECL_REF( CommunicationLink )
+
+class InfoString : public ByteString
+{
+public:
+ InfoString( ByteString &nMsg, CM_InfoType nIT, CommunicationLink *pCL = NULL ): ByteString( nMsg ), nInfoType( nIT ), pCommLink( pCL ) {;}
+ CM_InfoType GetInfoType(){ return nInfoType; }
+ CommunicationLinkRef GetCommunicationLink(){ return pCommLink; }
+private:
+ CM_InfoType nInfoType;
+ CommunicationLinkRef pCommLink;
+};
+
+class PacketHandler;
+class CommunicationManager;
+class SingleCommunicationManager;
+class MultiCommunicationManager;
+class CommunicationManagerServerAcceptThread;
+class CommunicationLink : public SvRefBase
+{
+protected:
+ friend class CommunicationManager;
+ friend class SingleCommunicationManager;
+ friend class MultiCommunicationManager;
+ friend class CommunicationManagerServerAcceptThread;
+ // Darf nicht abgeräumt werden zwischen Empfang des Streams und ende des Callbacks
+
+protected: // so daß nur über Ref gelöscht werden kann
+ virtual ~CommunicationLink();
+ void InvalidateManager() { pMyManager = NULL; }
+
+ PacketHandler* pPacketHandler;
+
+public:
+ CommunicationLink( CommunicationManager *pMan );
+
+ virtual BOOL StopCommunication()=0;
+ virtual BOOL IsCommunicationError()=0;
+ CommunicationManager* GetCommunicationManager(){ return pMyManager; }
+
+// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren
+ virtual ByteString GetCommunicationPartner( CM_NameType eType )=0;
+
+// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren
+ virtual ByteString GetMyName( CM_NameType eType )=0;
+
+// Liefert einen neuen Stream zum Versenden von Daten.
+ virtual SvStream* GetBestCommunicationStream()=0;
+
+ /** will call virtual function DoTransferDataStream to do actual work
+ Purpos is to allow housekeeping
+ **/
+ BOOL TransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE );
+
+ // Liefert die ID, die vom Sender angegeben wurde.
+ // Dadurch lassen sich virtuelle Kommunikationen über einen physikalischen Link realisiren.
+ // Da die Kommunikation zu älteren Versionen kompatibel bleiben muß, muß der Empfänger raten,
+ // die neue oder die alte verwendet wird, da sich der Kopf eines Auftrages dann ändert.
+ UINT16 GetProtocol(){ return nServiceProtocol; }
+
+ // Der Stream wird hier übergeben. Der Aufrufer ist für dessen Löschung zuständig
+ // Die Methode MUSS gerufen werden, da sonst keine weiteren Daten empfangen werden.
+ SvStream* GetServiceData(){ SvStream *pTemp = pServiceData; pServiceData = NULL; return pTemp; }
+
+ /// Ermöglicht das Auslösen des nächsten Callbacks. Wird auch Implizit gerufen.
+ void FinishCallback(){ bIsInsideCallback = FALSE; }
+
+ /// Syncrones Empfangen der Daten. Nur für Kommandozeile, sonst leer implementiert
+ virtual BOOL ReceiveDataStream(){ return FALSE; }
+
+ /// Statistics
+ DateTime GetStart() { return aStart; }
+ ULONG GetTotalBytes() { return nTotalBytes; }
+ DateTime GetLastAccess() { return aLastAccess; }
+ const ByteString& GetApplication() { return maApplication; }
+ virtual void SetApplication( const ByteString& aApp );
+
+protected:
+ void CallInfoMsg( InfoString aMsg );
+ CM_InfoType GetInfoType();
+ CommunicationManager *pMyManager;
+// Diese Methoden werden im Main Kontext gerufen und an den Manager weitergereicht.
+ virtual DECL_LINK( ConnectionClosed, void* = NULL );
+ virtual DECL_LINK( DataReceived, void* = NULL );
+
+ virtual BOOL DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE );
+
+ SvStream *pServiceData;
+ UINT16 nServiceProtocol;
+ UINT16 nServiceHeaderType;
+
+ /// Verhindert das vorzeitige Auslösen des nächsten Callbacks.
+ void StartCallback(){ bIsInsideCallback = TRUE; }
+ BOOL bIsInsideCallback;
+
+ virtual BOOL SendHandshake( HandshakeType aHandshakeType, SvStream* pData = NULL)=0;
+
+ virtual BOOL ShutdownCommunication() = 0; /// Really stop the Communication
+
+ /// Statistics
+ DateTime aStart;
+ ULONG nTotalBytes;
+ DateTime aLastAccess;
+
+private:
+ ByteString maApplication;
+
+#if OSL_DEBUG_LEVEL > 1
+public:
+ // misc (debuging) purposes
+ BOOL bFlag;
+ ULONG nSomething;
+#endif
+
+};
+
+SV_IMPL_REF( CommunicationLink );
+
+class CommonSocketFunctions;
+class CommunicationManager
+{
+ friend class CommunicationLink;
+ friend class CommonSocketFunctions;
+public:
+ CommunicationManager( BOOL bUseMultiChannel = FALSE );
+ virtual ~CommunicationManager();
+
+ virtual BOOL StartCommunication()=0;
+ virtual BOOL StartCommunication( String aApp, String aParams );
+ virtual BOOL StartCommunication( ByteString aHost, ULONG nPort );
+ virtual BOOL StopCommunication()=0; // Hält alle CommunicationLinks an
+ virtual BOOL IsCommunicationRunning() { return bIsCommunicationRunning; }
+// virtual BOOL IsCommunicationError();
+
+// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren
+ virtual ByteString GetMyName( CM_NameType eType );
+
+ virtual BOOL IsLinkValid( CommunicationLink* pCL )=0; // Notwendig für call im Destruktor
+
+ virtual USHORT GetCommunicationLinkCount()=0;
+ virtual CommunicationLinkRef GetCommunicationLink( USHORT nNr )=0;
+
+ // Liefert den letzten neuen Link oder NULL wenn dieser schon wieder geschlossen ist.
+ CommunicationLinkRef GetLastNewLink() { return xLastNewLink; }
+
+ void SetConnectionOpenedHdl( Link lConnectionOpened ){ mlConnectionOpened = lConnectionOpened; }
+ void SetConnectionClosedHdl( Link lConnectionClosed ){ mlConnectionClosed = lConnectionClosed; }
+ void SetDataReceivedHdl( Link lDataReceived ){ mlDataReceived = lDataReceived; }
+ void SetInfoMsgHdl( Link lInfoMsg ){ mlInfoMsg = lInfoMsg; }
+
+ void SetInfoType( CM_InfoType nIT ){ nInfoType = nIT; }
+ CM_InfoType GetInfoType(){ return nInfoType; }
+
+ BOOL IsMultiChannel(){ return bIsMultiChannel; }
+ void SetApplication( const ByteString& aApp, BOOL bRunningLinks = FALSE );
+ const ByteString& GetApplication() { return maApplication; }
+
+protected:
+ // Diese Methoden werden innerhalb gerufen. Sie erledigen eventuelles Housekeeping
+ // und rufen dann die entsprechende Methode
+ virtual void CallConnectionOpened( CommunicationLink* pCL );
+ virtual void CallConnectionClosed( CommunicationLink* pCL );
+ void CallDataReceived( CommunicationLink* pCL );
+ void CallInfoMsg( InfoString aMsg );
+
+ CM_InfoType nInfoType;
+
+ // Diese Routinen rufen den Link oder sind überladen
+ virtual void ConnectionOpened( CommunicationLink* pCL ){ mlConnectionOpened.Call( pCL ); }
+ virtual void ConnectionClosed( CommunicationLink* pCL ){ mlConnectionClosed.Call( pCL ); }
+ virtual void DataReceived( CommunicationLink* pCL ){ mlDataReceived.Call( pCL ); }
+ virtual void InfoMsg( InfoString aMsg ){ mlInfoMsg.Call( &aMsg ); }
+
+ BOOL bIsCommunicationRunning;
+
+ virtual void DestroyingLink( CommunicationLink *pCL )=0; // Link trägt sich im Destruktor aus
+
+private:
+ ByteString maApplication;
+ Link mlConnectionOpened;
+ Link mlConnectionClosed;
+ Link mlDataReceived;
+ Link mlInfoMsg;
+ CommunicationLinkRef xLastNewLink;
+
+ BOOL bIsMultiChannel;
+};
+
+class SingleCommunicationManager : public CommunicationManager
+{
+public:
+ SingleCommunicationManager( BOOL bUseMultiChannel = FALSE );
+ virtual ~SingleCommunicationManager();
+ virtual BOOL StopCommunication(); // Hält alle CommunicationLinks an
+ virtual BOOL IsLinkValid( CommunicationLink* pCL );
+ virtual USHORT GetCommunicationLinkCount();
+ virtual CommunicationLinkRef GetCommunicationLink( USHORT nNr );
+
+protected:
+ virtual void CallConnectionOpened( CommunicationLink* pCL );
+ virtual void CallConnectionClosed( CommunicationLink* pCL );
+ CommunicationLinkRef xActiveLink;
+ CommunicationLink *pInactiveLink;
+ virtual void DestroyingLink( CommunicationLink *pCL ); // Link trägt sich im Destruktor aus
+};
+
+class ICommunicationManagerClient
+{
+ friend class CommonSocketFunctions;
+protected:
+ virtual BOOL RetryConnect() { return FALSE; } // Kann dann eventuell die Applikation starten
+};
+
+class TCPIO;
+class SimpleCommunicationLinkViaSocket : public CommunicationLink
+{
+public:
+ virtual BOOL IsCommunicationError();
+ virtual BOOL StopCommunication();
+
+ virtual ByteString GetCommunicationPartner( CM_NameType eType );
+ virtual ByteString GetMyName( CM_NameType eType );
+ virtual SvStream* GetBestCommunicationStream();
+ virtual void SetApplication( const ByteString& aApp );
+
+private:
+ ByteString aCommunicationPartner;
+ ByteString aMyName;
+
+ TCPIO* pTCPIO;
+ NAMESPACE_VOS(OStreamSocket) *pStreamSocket;
+
+protected:
+ SimpleCommunicationLinkViaSocket( CommunicationManager *pMan, NAMESPACE_VOS(OStreamSocket) *pSocket );
+ virtual ~SimpleCommunicationLinkViaSocket();
+
+ NAMESPACE_VOS(OStreamSocket)* GetStreamSocket() { return pStreamSocket; }
+ void SetStreamSocket( NAMESPACE_VOS(OStreamSocket)* pSocket );
+
+ SvStream *pReceiveStream;
+ BOOL DoReceiveDataStream(); /// Recieve DataPacket from Socket
+ virtual BOOL SendHandshake( HandshakeType aHandshakeType, SvStream* pData = NULL);
+ void SetFinalRecieveTimeout();
+ BOOL bIsRequestShutdownPending;
+ virtual void WaitForShutdown()=0;
+ void SetNewPacketAsCurrent();
+};
+
+class SimpleCommunicationLinkViaSocketWithReceiveCallbacks : public SimpleCommunicationLinkViaSocket
+{
+public:
+ SimpleCommunicationLinkViaSocketWithReceiveCallbacks( CommunicationManager *pMan, NAMESPACE_VOS(OStreamSocket) *pSocket );
+ ~SimpleCommunicationLinkViaSocketWithReceiveCallbacks();
+ virtual BOOL ReceiveDataStream();
+protected:
+ virtual BOOL ShutdownCommunication(); /// Really stop the Communication
+ virtual void WaitForShutdown();
+};
+
+class CommonSocketFunctions
+{
+public:
+ BOOL DoStartCommunication( CommunicationManager *pCM, ICommunicationManagerClient *pCMC, ByteString aHost, ULONG nPort );
+protected:
+ virtual CommunicationLink *CreateCommunicationLink( CommunicationManager *pCM, NAMESPACE_VOS(OConnectorSocket) *pCS )=0;
+};
+
+class SingleCommunicationManagerClientViaSocket : public SingleCommunicationManager, public ICommunicationManagerClient, CommonSocketFunctions
+{
+public:
+ using CommunicationManager::StartCommunication;
+
+ SingleCommunicationManagerClientViaSocket( ByteString aHost, ULONG nPort, BOOL bUseMultiChannel = FALSE );
+ SingleCommunicationManagerClientViaSocket( BOOL bUseMultiChannel = FALSE );
+ virtual BOOL StartCommunication(){ return DoStartCommunication( this, (ICommunicationManagerClient*) this, aHostToTalk, nPortToTalk );}
+ virtual BOOL StartCommunication( ByteString aHost, ULONG nPort ){ return DoStartCommunication( this, (ICommunicationManagerClient*) this, aHost, nPort );}
+private:
+ ByteString aHostToTalk;
+ ULONG nPortToTalk;
+protected:
+ virtual CommunicationLink *CreateCommunicationLink( CommunicationManager *pCM, NAMESPACE_VOS(OConnectorSocket) *pCS ){ return new SimpleCommunicationLinkViaSocketWithReceiveCallbacks( pCM, pCS ); }
+};
+
+#endif