sl@0: /* sl@0: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Random Server Codes sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef RANDSVRIMPL_H sl@0: #define RANDSVRIMPL_H sl@0: sl@0: sl@0: const TInt KRandomBlockSize=1024; sl@0: const TInt KRandomPoolSize=2048; sl@0: sl@0: class CRandomScheduler:public CActiveScheduler sl@0: { sl@0: public: sl@0: static TBool New(void); sl@0: void Error(TInt aError) const; sl@0: }; sl@0: sl@0: class CRandomSession; sl@0: sl@0: class CRandomServer : public CServer2 sl@0: { sl@0: public: sl@0: static TInt New(void); sl@0: ~CRandomServer(void); sl@0: CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; sl@0: friend class CRandomSession; sl@0: private: sl@0: CRandomServer(void); sl@0: void ConstructL(void); sl@0: void Stir(void); sl@0: TPtrC8 GetRandom(void); sl@0: CMessageDigest* Hash(void) const; sl@0: static TInt Tick(TAny* aPointer); sl@0: TUint8* iPool; sl@0: TInt iPoolIn; sl@0: TInt iPoolOut; sl@0: TInt iQuality; sl@0: TBool iFast; sl@0: CMessageDigest* iHash; sl@0: CPeriodic* iTicker; sl@0: }; sl@0: sl@0: class CRandomSession : public CSession2 sl@0: { sl@0: public: sl@0: enum { KRandomRequest }; sl@0: static CRandomSession* NewL(CRandomServer* aServer); sl@0: ~CRandomSession(void); sl@0: void ServiceL(const RMessage2& aMessage); sl@0: private: sl@0: TInt FillBuffer(const RMessage2& aMessage); sl@0: CRandomServer* iServer; sl@0: CRandomSession(CRandomServer* aServer); sl@0: }; sl@0: sl@0: #endif // RANDSVRIMPL_H