os/security/cryptomgmtlibs/securitycommonutils/test/source/scstestclient/rscstestsubsession.cpp
First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Client-side API tests an implementation of the session count server
16 * by implementing a handle to a subsession.
25 #include "scstestclient.h"
26 #include "scstestcommon.h"
29 EXPORT_C RScsTestSubsession::RScsTestSubsession()
31 This constructor provides a single definition from
32 which to call the base class constructor.
34 : RScsClientSubsessionBase()
39 EXPORT_C TInt RScsTestSubsession::Create(RScsTestSession& aSession, TInt aValue)
41 Create a new subsession over the supplied session.
43 @param aSession Session which will host this subsession.
44 @param aValue Value which will be stored by the subsession.
45 @return Symbian OS error code where KErrNone indicates
46 success and any other value indicates failure.
49 TIpcArgs args(aValue);
50 return CreateSubsession(aSession, ScsTestImpl::ESessSubsessFromInt, args);
53 EXPORT_C TInt RScsTestSubsession::SendFunction(TInt aFunction)
55 Send an arbitrary function identifier to the subsession.
56 Used to test the subsession implementation handles unrecognized
59 @param aFunction Arbitrary function. Note that, unlike the
60 RScsTestSession::SendFunction, this cannot
62 @see RScsTestSession::SendFunction
65 return CallSubsessionFunction(aFunction);
68 EXPORT_C TInt RScsTestSubsession::Quadruple(TInt& aResult)
70 Send a synchronous request to the subsession.
72 @param aResult On return this should be set to four times
73 the value of the integer which was supplied to
74 Create when the subsession was created.
75 @return Symbian OS error code where KErrNone indicates
76 success and any other value indicates failure.
80 TPckg<TInt> resultPckg(aResult);
81 TIpcArgs args(&resultPckg);
82 return CallSubsessionFunction(ScsTestImpl::ESubsessQuadruple, args);
85 EXPORT_C void RScsTestSubsession::Treble(TDes8& aValue, TRequestStatus& aStatus)
87 Launch an aysnchronous request on the subsession.
89 To reuse server-side code, this does not use the integer
90 value stored in the subsession object, but transforms
91 the supplied value in the same way as the session implementation.
93 @param aValue Describes an integer, e.g. TPckgBuf<TInt>.
94 The descriptor must be supplied by the caller
95 instead of being constructed in this function
96 because it must persist until the request has
98 @param aStatus The server will complete this status object
99 when it has handled the function.
102 TIpcArgs args(&aValue);
103 CallSubsessionFunction(ScsTestImpl::ESubsessTreble, args, aStatus);
106 EXPORT_C void RScsTestSubsession::CancelTreble()
108 Cancel an outstanding synchronous request launched with Treble.
113 return CancelSubsessionFunction(ScsTestImpl::ESubsessTreble);