os/security/cryptomgmtlibs/securitycommonutils/test/source/scstestserver/scstestsubsession.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 CScsTestSubsession. See class and function definitons
16 * for more information.
25 #include "scstestserver.h"
28 CScsTestSubsession* CScsTestSubsession::NewL(CScsTestSession &aSession, const RMessage2& aMessage)
30 Factory function allocates new, initialized instance of CScsTestSubsession.
32 @param aSession Reference to our parent session
33 @param aMessage Create subsession message sent from the client.
34 This contains the integer on which the subsession
36 @return New, initialized instance of CScsTestSubsession
37 which is owned by the caller.
40 CScsTestSubsession* self = new(ELeave) CScsTestSubsession(aSession);
42 // record value on which this subsession is curried
43 self->iValue = aMessage.Int0();
47 CScsTestSubsession::CScsTestSubsession(CScsTestSession &aSession)
49 This private constructor prevents direct instantiation and provides
50 a single point of definition.
52 : CScsSubsession(aSession)
57 CScsTestSubsession::~CScsTestSubsession()
59 This destructor is only defined to breakpoint when the
60 subsession is destroyed.
66 TBool CScsTestSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
68 Implement CSscSubsession by handling messages sent to this subsession.
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.
75 ScsTestImpl::TSubsessionFunction f =
76 static_cast<ScsTestImpl::TSubsessionFunction>(aFunction);
78 TBool completeMessage = ETrue;
81 case ScsTestImpl::ESubsessQuadruple:
83 TPckgBuf<TInt> times4 = iValue * 4;
84 aMessage.WriteL(0, times4);
88 case ScsTestImpl::ESubsessTreble:
90 CScsTestSession* owningSession = static_cast<CScsTestSession*>(&iSession);
91 CTrebleRequest::NewL(owningSession, this, aMessage);
92 completeMessage = EFalse; // do not complete yet
97 User::Leave(KErrNotSupported);
99 return completeMessage;