os/security/cryptomgmtlibs/securitycommonutils/test/source/scstestserver/scstestsession.cpp
Update contrib.
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 * Implements CScsTestSession. See class and function definitions
16 * for more information.
25 #include "scstestserver.h"
28 CScsTestSession* CScsTestSession::NewL(CScsTestServer &aServer)
30 Factory function allocates new instance of CScsTestSession.
32 @param aServer Reference to our parent server
33 @return New, initialized instance of CScsTestSession
34 which is owned by the caller.
37 CScsTestSession* s = new(ELeave) CScsTestSession(aServer);
38 CleanupStack::PushL(s);
39 s->ConstructL(); // CScsSession implementation
44 CScsTestSession::CScsTestSession(CScsTestServer &aServer)
46 This private constructor prevents direct instantiation.
48 : CScsSession(aServer)
53 CScsTestSession::~CScsTestSession()
55 Because this object does not (yet) own any resources, this
56 destructor is only defined to ensure a single definition is
59 The base class destructor destroys any remaining subsessions
60 or outstanding requests.
66 TBool CScsTestSession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
68 Implement CScsTestSession by handling the supplied message.
70 @param aFunction Function identifier without SCS code.
71 @param aMessage Standard server-side handle to message.
72 @return ETrue means complete client request now.
74 @see CScsSession::ServiceError.
77 ScsTestImpl::TSessionFunction f = static_cast<ScsTestImpl::TSessionFunction>(aFunction);
81 case ScsTestImpl::ESessNukeServer:
82 CActiveScheduler::Stop();
83 return EFalse; // Server will crash due to outstanding reqs
85 case ScsTestImpl::ESessDouble:
88 aMessage.Read(0, value);
90 aMessage.WriteL(0, value);
94 case ScsTestImpl::ESessTreble:
96 CTrebleRequest::NewL(this, /* aSubsession */ NULL, aMessage);
97 return EFalse; // Do NOT complete client request yet
101 User::Leave(KErrNotSupported);
103 return ETrue; // Complete client request now
106 CScsSubsession* CScsTestSession::DoCreateSubsessionL(TInt aFunction, const RMessage2& aMessage)
108 Override CScsSession by allocating an instance of CScsTestSubsession
109 to handle ScsTestImpl::ESessSubsessFromInt.
111 @param aFunction Function identifier without SCS code.
112 @param aMessage Standard server-side handle to message.
113 @see ScsTestImpl::ESessSubsessFromInt
118 case ScsTestImpl::ESessSubsessFromInt:
119 return CScsTestSubsession::NewL(*this, aMessage);
122 User::Leave(KErrNotSupported);
123 return 0; // avoid compiler warning