cryptomgmtlibs/securitytestfw/test/testutil/testutilcommon/testutilssessioncommon.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2008-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
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @test
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #include "testutilssessioncommon.h"
       
    29 
       
    30 CTestUtilSessionCommon::CTestUtilSessionCommon()
       
    31   	{
       
    32   	}
       
    33 
       
    34 
       
    35 CTestUtilSessionCommon::~CTestUtilSessionCommon()
       
    36 	{
       
    37 	}
       
    38 
       
    39 void CTestUtilSessionCommon::Send(const TDesC& aMessage)
       
    40 	{
       
    41 	if (ReceivePending())
       
    42 		{
       
    43 		TPtrC m(aMessage);
       
    44 		TInt r=iReceiveMsg.Write(0,m);
       
    45 		if (r==KErrNone)
       
    46 			iReceiveMsg.Complete(KErrNone);
       
    47 		else
       
    48 			PanicClient(iReceiveMsg,EPanicBadDescriptor);
       
    49 		}
       
    50 	}
       
    51 
       
    52 HBufC* CTestUtilSessionCommon::AllocateInputBufferLC(const RMessage2& aMessage,TInt aParam)
       
    53 	{
       
    54 	TInt srcLen = aMessage.GetDesLength(aParam);
       
    55 	HBufC* inputBuffer=HBufC::NewLC(srcLen);
       
    56 	TPtr ptr(inputBuffer->Des());
       
    57 	TRAPD(err, aMessage.ReadL(aParam, ptr));
       
    58 	if (err!=KErrNone)
       
    59 		{
       
    60 		PanicClient(aMessage, EPanicBadDescriptor);
       
    61 		}
       
    62 	return inputBuffer;
       
    63 	}
       
    64 	
       
    65 
       
    66