cryptomgmtlibs/securitycommonutils/inc/scscommon.inl
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Defines inline functions used by both SCS client and server implementations,
       
    16 * but not with the client API user.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef SCSCOMMON_INL
       
    28 #define SCSCOMMON_INL
       
    29 
       
    30 #include <scs/scscommon.h>
       
    31 
       
    32 namespace ScsImpl
       
    33 	{
       
    34 
       
    35 	inline void ExtractScsAndImplFunctions(const RMessage2& aMessage, TScsFunction* aScsFunc, TInt* aImplFunc)
       
    36 	/**
       
    37 		Takes the function code from the supplied message and breaks it into the SCS
       
    38 		field and implementation code.
       
    39 
       
    40 		@param	aMessage		Message contains function code supplied to server
       
    41 								from client-side implementation.
       
    42 		@param	aScsFunc		If not NULL then on return this contains the SCS code.
       
    43 		@param	aImplFunc		If not NULL then on return this contains the implementation custom code.
       
    44 	 */
       
    45 		{
       
    46 		TInt f = aMessage.Function();
       
    47 		if (aScsFunc != 0)
       
    48 			*aScsFunc =  static_cast<TScsFunction>(f & KScsFunctionMask);
       
    49 		
       
    50 		if (aImplFunc != 0)
       
    51 			*aImplFunc = f & ~KScsFunctionMask;
       
    52 		}
       
    53 
       
    54 #ifdef _DEBUG
       
    55 	inline TBool ScsFieldUsed(TInt aFunction)
       
    56 	/**
       
    57 		This function is used on the client-side in debug builds to
       
    58 		ensure the (sub)session function identifier which is being
       
    59 		sent to the server does not yet contain any SCS fields.
       
    60 	 */
       
    61 		{
       
    62 		return aFunction & KScsFunctionMask;
       
    63 		}
       
    64 #endif
       
    65 	}	// namespace UserPromptService
       
    66 
       
    67 #endif	// #ifndef SCSCOMMON_INL
       
    68