os/security/cryptomgmtlibs/securitycommonutils/test/source/scstestclient/rscstestsession.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 session.
26 #include "scstestclient.h"
27 #include "scstestcommon.h"
30 EXPORT_C RScsTestSession::RScsTestSession()
32 This constructor defines a single point from which
33 the base class constructor is called.
40 EXPORT_C TInt RScsTestSession::Connect()
42 Connect to the SCS test server using the default version.
44 @return Symbian OS error code where KErrNone indicates
45 success and any other value indicates failure.
48 const TVersion serverVersion = ScsTestImpl::Version();
49 return Connect(serverVersion);
52 EXPORT_C TInt RScsTestSession::Connect(const TVersion& aVersion)
54 Connect to the SCS test server with the supplied version. This
55 function is defined to test the version checking functionality in
56 CScsServer. A client API would normally just ask for a server
57 version which at least matches its own.
59 @param aVersion Server version to ask for.
60 @return Symbian OS error code where KErrNone indicates
61 success and any other value indicates failure.
64 const TUidType serverFullUid = ScsTestImpl::ServerImageFullUid();
66 TInt r = RScsClientBase::Connect(
67 ScsTestImpl::KServerName, aVersion,
68 ScsTestImpl::KServerImageName, serverFullUid);
73 EXPORT_C TInt RScsTestSession::SendCustomFunction(TInt aFunction)
75 Sends the supplied function identifier to the server with
76 no IPC arguments. This function should be used to test the
77 server can handle an invalid SCS or session function.
79 @param aFunction Function identifier to send to server-side
80 session. This is sent as-is, and can use the
84 return SendReceive(aFunction);
87 EXPORT_C TInt RScsTestSession::NukeServer()
89 Calls an synchronous function which causes the server to panic
92 return CallSessionFunction(ScsTestImpl::ESessNukeServer);
95 EXPORT_C TInt RScsTestSession::Double(TInt& aValue)
97 Calls a synchronous session function to ensure the function
98 call is routed to the session subclass on the server side.
100 @param aValue An arbitrary integer. On completion
101 this should be double its entry value.
102 @return Symbian OS error code where KErrNone indicates
103 success and any other value indicates failure.
106 TPckg<TInt> valPckg(aValue);
107 TIpcArgs ipc(&valPckg);
108 return CallSessionFunction(ScsTestImpl::ESessDouble, ipc);
111 EXPORT_C void RScsTestSession::Treble(TDes8& aValue, TRequestStatus& aStatus)
113 Calls an asynchronous function to test the SCS can successfully manage
114 asynchronous requests.
116 @param aValue Describes an integer, e.g. TPckgBuf<TInt>.
117 The descriptor must be supplied by the caller
118 instead of being constructed in this function
119 because it must persist until the request has
121 @param aStatus The server will complete this status object
122 when it has handled the function.
126 TIpcArgs ipc(&aValue);
127 CallSessionFunction(ScsTestImpl::ESessTreble, ipc, aStatus);
130 EXPORT_C void RScsTestSession::CancelTreble()
132 Cancel an outstanding request set up with Treble. This function has
133 no effect if there is no outstanding request.
138 CancelSessionFunction(ScsTestImpl::ESessTreble);