os/security/cryptomgmtlibs/securitycommonutils/test/inc_private/scstestcommon.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/securitycommonutils/test/inc_private/scstestcommon.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,86 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* Defines inline functions which provide constant data to both the
    1.19 +* client and server implementations.
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @internalComponent
    1.26 + @test
    1.27 + @file
    1.28 +*/
    1.29 +
    1.30 +
    1.31 +#ifndef SCSTESTCOMMON_INL
    1.32 +#define SCSTESTCOMMON_INL
    1.33 +
    1.34 +#include <e32uid.h>
    1.35 +
    1.36 +#include "scstestcommon.h"
    1.37 +
    1.38 +
    1.39 +namespace ScsTestImpl
    1.40 +	{
    1.41 +	inline TVersion Version()
    1.42 +	/**
    1.43 +		This function is defined because there is no literal constructor for TVersion.
    1.44 +
    1.45 +		@return					Defines a version number which the client	
    1.46 +								can use to open the server.  If the client
    1.47 +								was built with a higher version number, then
    1.48 +								it cannot open the server.  This ensures that
    1.49 +								a client only talks to a server whose version
    1.50 +								is at least as high as its own.
    1.51 +	 */
    1.52 +		{
    1.53 +		TVersion v(KScsTestVerMajor, KScsTestVerMinor, KScsTestVerBuild);
    1.54 +		return v;
    1.55 +		}
    1.56 +
    1.57 +	inline TUidType ServerImageFullUid()
    1.58 +	/**
    1.59 +		This function is defined because there is no literal constructor
    1.60 +		for TUidType.  It returns the server executable's UID, which is used
    1.61 +		to ensure the client launches the correct server process, as opposed
    1.62 +		to another application which uses the same executable name.
    1.63 +
    1.64 +		@return TUidType		The server executable's full UID.
    1.65 +	 */
    1.66 +		{
    1.67 +		TUidType uidType(KExecutableImageUid, KNullUid, KScsTestServerUid);
    1.68 +		return uidType;
    1.69 +		}
    1.70 +	}
    1.71 +
    1.72 +template <class T>
    1.73 +inline T TAnyPtrToFuncPtr(TAny* aPtr)
    1.74 +/**
    1.75 +	ISO C++ doesn't allow converting directly between object and
    1.76 +	function pointers, so this function goes via an integer.
    1.77 +
    1.78 +	@param	aPtr			Object pointer to convert to a (static) function pointer.
    1.79 +	@return					Function pointer, where the exact type of the function is	
    1.80 +							described by the T template parameter.
    1.81 + */
    1.82 +	{
    1.83 +	TUint32 funcAsInt = reinterpret_cast<TUint32>(aPtr);
    1.84 +	return reinterpret_cast<T>(funcAsInt);
    1.85 +	}
    1.86 +
    1.87 +#endif	// #ifndef SCSTESTCOMMON_INL
    1.88 +
    1.89 +