os/security/cryptomgmtlibs/securitycommonutils/test/source/scstestclient/rscstestsubsession.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Client-side API tests an implementation of the session count server
sl@0
    16
* by implementing a handle to a subsession.
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
/**
sl@0
    22
 @file
sl@0
    23
*/
sl@0
    24
sl@0
    25
#include "scstestclient.h"
sl@0
    26
#include "scstestcommon.h"
sl@0
    27
sl@0
    28
sl@0
    29
EXPORT_C RScsTestSubsession::RScsTestSubsession()
sl@0
    30
/**
sl@0
    31
	This constructor provides a single definition from
sl@0
    32
	which to call the base class constructor.
sl@0
    33
 */
sl@0
    34
:	RScsClientSubsessionBase()
sl@0
    35
	{
sl@0
    36
	// empty.
sl@0
    37
	}
sl@0
    38
sl@0
    39
EXPORT_C TInt RScsTestSubsession::Create(RScsTestSession& aSession, TInt aValue)
sl@0
    40
/**
sl@0
    41
	Create a new subsession over the supplied session.
sl@0
    42
sl@0
    43
	@param	aSession		Session which will host this subsession.
sl@0
    44
	@param	aValue			Value which will be stored by the subsession.
sl@0
    45
	@return					Symbian OS error code where KErrNone indicates
sl@0
    46
							success and any other value indicates failure.
sl@0
    47
 */
sl@0
    48
	{
sl@0
    49
	TIpcArgs args(aValue);
sl@0
    50
	return CreateSubsession(aSession, ScsTestImpl::ESessSubsessFromInt, args);
sl@0
    51
	}
sl@0
    52
sl@0
    53
EXPORT_C TInt RScsTestSubsession::SendFunction(TInt aFunction)
sl@0
    54
/**
sl@0
    55
	Send an arbitrary function identifier to the subsession.
sl@0
    56
	Used to test the subsession implementation handles unrecognized
sl@0
    57
	functions correctly.
sl@0
    58
sl@0
    59
	@param	aFunction		Arbitrary function.  Note that, unlike the
sl@0
    60
							RScsTestSession::SendFunction, this cannot
sl@0
    61
							include an SCS code.
sl@0
    62
	@see RScsTestSession::SendFunction
sl@0
    63
 */
sl@0
    64
	{
sl@0
    65
	return CallSubsessionFunction(aFunction);
sl@0
    66
	}
sl@0
    67
sl@0
    68
EXPORT_C TInt RScsTestSubsession::Quadruple(TInt& aResult)
sl@0
    69
/**
sl@0
    70
	Send a synchronous request to the subsession.
sl@0
    71
sl@0
    72
	@param	aResult			On return this should be set to four times
sl@0
    73
							the value of the integer which was supplied to
sl@0
    74
							Create when the subsession was created.
sl@0
    75
	@return					Symbian OS error code where KErrNone indicates
sl@0
    76
							success and any other value indicates failure.
sl@0
    77
	@see Create
sl@0
    78
 */
sl@0
    79
	{
sl@0
    80
	TPckg<TInt> resultPckg(aResult);
sl@0
    81
	TIpcArgs args(&resultPckg);
sl@0
    82
	return CallSubsessionFunction(ScsTestImpl::ESubsessQuadruple, args);
sl@0
    83
	}
sl@0
    84
sl@0
    85
EXPORT_C void RScsTestSubsession::Treble(TDes8& aValue, TRequestStatus& aStatus)
sl@0
    86
/**
sl@0
    87
	Launch an aysnchronous request on the subsession.
sl@0
    88
sl@0
    89
	To reuse server-side code, this does not use the integer
sl@0
    90
	value stored in the subsession object, but transforms
sl@0
    91
	the supplied value in the same way as the session implementation.
sl@0
    92
sl@0
    93
	@param	aValue			Describes an integer, e.g. TPckgBuf<TInt>.
sl@0
    94
							The descriptor must be supplied by the caller
sl@0
    95
							instead of being constructed in this function
sl@0
    96
							because it must persist until the request has
sl@0
    97
							been completed.
sl@0
    98
	@param	aStatus			The server will complete this status object
sl@0
    99
							when it has handled the function.	
sl@0
   100
 */
sl@0
   101
	{
sl@0
   102
	TIpcArgs args(&aValue);
sl@0
   103
	CallSubsessionFunction(ScsTestImpl::ESubsessTreble, args, aStatus);
sl@0
   104
	}
sl@0
   105
sl@0
   106
EXPORT_C void RScsTestSubsession::CancelTreble()
sl@0
   107
/**
sl@0
   108
	Cancel an outstanding synchronous request launched with Treble.
sl@0
   109
	
sl@0
   110
	@see Treble
sl@0
   111
 */
sl@0
   112
	{
sl@0
   113
	return CancelSubsessionFunction(ScsTestImpl::ESubsessTreble);
sl@0
   114
	}
sl@0
   115