os/security/cryptomgmtlibs/securitytestfw/test/testutil/server/testutilserver.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/testutil/server/testutilserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,77 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* TestUtil - server implementation
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @test
1.26 + @internalComponent
1.27 +*/
1.28 +
1.29 +#include "testutilserver.h"
1.30 +#include "testutilsession.h"
1.31 +#include "testutilclientserver.h"
1.32 +
1.33 +CServer2* CTestUtilServer::NewLC()
1.34 + {
1.35 + CTestUtilServer* self=new(ELeave) CTestUtilServer;
1.36 + CleanupStack::PushL(self);
1.37 + self->ConstructL();
1.38 + return self;
1.39 + }
1.40 +
1.41 +
1.42 +CTestUtilServer::~CTestUtilServer()
1.43 + {
1.44 + iFs.Close();
1.45 + delete iFileMan;
1.46 + delete iTestUtilSessionCommon;
1.47 + }
1.48 +
1.49 +void CTestUtilServer::ConstructL()
1.50 + {
1.51 + StartL(KTestUtilServerName);
1.52 + User::LeaveIfError(iFs.Connect());
1.53 + iFs.ShareProtected();
1.54 + iFileMan = CFileMan::NewL(iFs);
1.55 + iTestUtilSessionCommon = new (ELeave) CTestUtilSessionCommon();
1.56 + }
1.57 +
1.58 +CSession2* CTestUtilServer::NewSessionL(const TVersion&,const RMessage2&) const
1.59 + {
1.60 + return new(ELeave) CTestUtilSession();
1.61 + }
1.62 +
1.63 +void CTestUtilServer::AddSession()
1.64 + {
1.65 + ++iSessionCount;
1.66 + }
1.67 +
1.68 +void CTestUtilServer::DropSession()
1.69 + {
1.70 + --iSessionCount;
1.71 + }
1.72 +
1.73 +void CTestUtilServer::Send(const TDesC& aMessage)
1.74 + {
1.75 + iSessionIter.SetToFirst();
1.76 + while ((iSessionIter++)!=0)
1.77 + {
1.78 + iTestUtilSessionCommon->Send(aMessage);
1.79 + }
1.80 + }