diff -r f5050f1da672 -r 04becd199f91 javacommons/security/legacysupport/midp2userpreferences/inc/IPCVersion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javacommons/security/legacysupport/midp2userpreferences/inc/IPCVersion.h Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/** + * @file + * @internalComponent + * @released + * + * Header file to configure/use versioned implementations of the IPC mechanism. + */ + +#ifndef IPCVERSION_H +#define IPCVERSION_H + +#include + +#include + +/* + * Client Interfaces + */ + +class RSessionBaseV : public RSessionBase +{ +public: + // NB Always uses EAutoAttach + TInt ShareSession(TAttachMode /*unused*/ = RSessionBase::EAutoAttach) + { + return RSessionBase::ShareAuto(); + } +}; + +/* + * the following inline functions can be used as a standard Share() + * interface when connecting to other subsystem's servers. + */ + +// NB Always uses EAutoAttach +inline TInt ShareSession(RSessionBase& session, RSessionBase::TAttachMode /*unused*/ = RSessionBase::EAutoAttach) +{ + return session.ShareAuto(); +} + + +/* + * Server Interfaces + */ + +class CSharableSessionV; +class CSessionV; +class CServerV; +typedef RMessage2 RMessageV; +typedef RMessagePtr2 RMessagePtrV; + +class CSharableSessionV : public CSession2 +{ +protected: + CSharableSessionV() {} + virtual void CreateL(const CServerV&) + {} + void CreateL() + { + CreateL(*reinterpret_cast(Server())); + } +}; + + +class CSessionV : public CSharableSessionV +{ +protected: + CSessionV() {} + CSessionV(RThread) {} +}; + + +class CServerV : public CPolicyServer +{ +protected: + virtual CSharableSessionV* NewSessionL(const TVersion&) const = 0; + CServerV(TInt aPriority, const TPolicy& aPolicy, TServerType aType) : CPolicyServer(aPriority, aPolicy, aType) + {} + +private: + CSession2* NewSessionL(const TVersion& aVersion, const RMessageV&) const + { + return NewSessionL(aVersion); + } +}; + + +#endif // IPCVERSION_H