os/security/cryptomgmtlibs/securitytestfw/test/testutil/testutilcommon/testutilssessioncommon.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 * Implementation of common class for testutil and testutilswi
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @test
    23  @internalComponent
    24 */
    25 
    26 #include "testutilssessioncommon.h"
    27 
    28 CTestUtilSessionCommon::CTestUtilSessionCommon()
    29   	{
    30   	}
    31 
    32 
    33 CTestUtilSessionCommon::~CTestUtilSessionCommon()
    34 	{
    35 	}
    36 
    37 void CTestUtilSessionCommon::Send(const TDesC& aMessage)
    38 	{
    39 	if (ReceivePending())
    40 		{
    41 		TPtrC m(aMessage);
    42 		TInt r=iReceiveMsg.Write(0,m);
    43 		if (r==KErrNone)
    44 			iReceiveMsg.Complete(KErrNone);
    45 		else
    46 			PanicClient(iReceiveMsg,EPanicBadDescriptor);
    47 		}
    48 	}
    49 
    50 HBufC* CTestUtilSessionCommon::AllocateInputBufferLC(const RMessage2& aMessage,TInt aParam)
    51 	{
    52 	TInt srcLen = aMessage.GetDesLength(aParam);
    53 	HBufC* inputBuffer=HBufC::NewLC(srcLen);
    54 	TPtr ptr(inputBuffer->Des());
    55 	TRAPD(err, aMessage.ReadL(aParam, ptr));
    56 	if (err!=KErrNone)
    57 		{
    58 		PanicClient(aMessage, EPanicBadDescriptor);
    59 		}
    60 	return inputBuffer;
    61 	}
    62 	
    63 
    64