sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // include\mmf\common\mmfipc.h
sl@0: // Thin interface layer to use either V1 or V2 IPC calls as appropriate
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __MMF_COMMON_MMFIPC_SERVER_H__
sl@0: #define __MMF_COMMON_MMFIPC_SERVER_H__
sl@0: 
sl@0: #include <e32base.h>
sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: #include <mmf/common/mmfipc.h>
sl@0: #endif
sl@0: 
sl@0: // The following declarations are used instead of the native ones on the particular system variant:
sl@0: //    RMmfIpcMessage replaces RMessage or RMessage2
sl@0: //    CMmfIpcServer replaces CServer or CServer2
sl@0: //    CMmfIpcSession replaces CSharableSession or CSession2
sl@0: // They are used internally to the MMF component to provide configurability for the particular subsystem
sl@0: 
sl@0: #ifdef __MMF_USE_IPC_V2__
sl@0: 
sl@0: //typedef RMessage2 RMmfIpcMessage;
sl@0: 
sl@0: class CMmfIpcServer; // forward declaration
sl@0: 
sl@0: /**
sl@0:  * derive CMmfIpcSession from CSession2 so we can bridge the differences to old CSharableSession
sl@0:  *
sl@0:  * @internalTechnology
sl@0:  */
sl@0:  
sl@0: class CMmfIpcSession : public CSession2
sl@0: 	{
sl@0: protected:
sl@0: 	virtual void CreateL(const CMmfIpcServer& aServer);
sl@0: 	CMmfIpcSession() {}
sl@0: 	// from CSession2
sl@0: 	void CreateL();
sl@0: 	};
sl@0: 
sl@0: /*
sl@0:  * derive CMmfIpcServer from CServer2 so we can bridge difference to old CServer
sl@0:  *
sl@0:  * @internalTechnology
sl@0:  */
sl@0:  
sl@0: class CMmfIpcServer : public CServer2
sl@0: 	{
sl@0: protected:
sl@0: 	virtual CMmfIpcSession* NewSessionL(const TVersion& aVersion) const=0;
sl@0: 	CMmfIpcServer(TInt aPriority,TServerType aType=EUnsharableSessions);
sl@0: private:
sl@0: 	// derived from CServer2
sl@0: 	CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
sl@0: 	};
sl@0: 
sl@0: #else // __MMF_USE_IPC_V2__
sl@0: 
sl@0: // otherwise always use V1
sl@0: //typedef RMessage RMmfIpcMessage;
sl@0: typedef CServer CMmfIpcServer;
sl@0: typedef CSharableSession CMmfIpcSession;
sl@0: 
sl@0: #endif // __MMF_USE_IPC_V2__
sl@0: 
sl@0: #if defined(__VC32__)
sl@0: #pragma warning( disable : 4097 )	// typedef-name used as synonym for class-name 
sl@0: #endif
sl@0: 
sl@0: 
sl@0: /**
sl@0:  * Adapt RMessage calls between IPC variants
sl@0:  *
sl@0:  * @internalTechnology
sl@0:  */
sl@0: 
sl@0: class MmfMessageUtil 
sl@0: 	{
sl@0: public:
sl@0: 	static TInt Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult);
sl@0: 	static TInt Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue);
sl@0: 	static void ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult);
sl@0: 	static void WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue);
sl@0: 	};
sl@0: 	
sl@0: #include <mmf/common/mmfipcserver.inl>
sl@0: 
sl@0: #endif // __MMF_COMMON_MMFIPC_SERVER_H__