os/security/cryptomgmtlibs/securitytestfw/test/testutil/server/testutilserver.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 * TestUtil - server implementation
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @test
    23  @internalComponent
    24 */
    25  
    26 #include "testutilserver.h"
    27 #include "testutilsession.h"
    28 #include "testutilclientserver.h"
    29 
    30 CServer2* CTestUtilServer::NewLC()
    31 	{
    32 	CTestUtilServer* self=new(ELeave) CTestUtilServer;
    33 	CleanupStack::PushL(self);
    34 	self->ConstructL();
    35 	return self;
    36 	}
    37 
    38 
    39 CTestUtilServer::~CTestUtilServer()
    40 	{
    41 	iFs.Close();
    42 	delete iFileMan;
    43 	delete iTestUtilSessionCommon;
    44 	}
    45 
    46 void CTestUtilServer::ConstructL()
    47 	{
    48 	StartL(KTestUtilServerName);
    49 	User::LeaveIfError(iFs.Connect());
    50 	iFs.ShareProtected();
    51 	iFileMan = CFileMan::NewL(iFs);
    52 	iTestUtilSessionCommon = new (ELeave) CTestUtilSessionCommon();
    53 	}
    54 
    55 CSession2* CTestUtilServer::NewSessionL(const TVersion&,const RMessage2&) const
    56 	{
    57 	return new(ELeave) CTestUtilSession();
    58 	}
    59 
    60 void CTestUtilServer::AddSession()
    61 	{
    62 	++iSessionCount;
    63 	}
    64 	
    65 void CTestUtilServer::DropSession()
    66 	{
    67 	--iSessionCount;
    68 	}
    69 
    70 void CTestUtilServer::Send(const TDesC& aMessage)
    71 	{
    72 	iSessionIter.SetToFirst();
    73 	while ((iSessionIter++)!=0)
    74 		{
    75 		iTestUtilSessionCommon->Send(aMessage);
    76 		}
    77 	}