crypto/weakcrypto/inc/randsvr.h
changeset 8 35751d3474b7
parent 0 2c201484c85f
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
    15 * Random Server Codes
    15 * Random Server Codes
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
       
    21 
       
    22 /**
    20 /**
    23  @file 
    21  @file 
    24  @internalTechnology
    22  @publishedPartner
       
    23  @released
    25 */
    24 */
    26  
    25  
    27 #ifndef __RANDSVR_H__
    26 #ifndef __RANDSVR_H__
    28 #define __RANDSVR_H__
    27 #define __RANDSVR_H__
    29 
    28 
    30 #include <e32base.h>
    29 #include <e32base.h>
    31 #include <hash.h>
    30 #include <hash.h>
    32 
    31 
       
    32 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    33 #include "randsvrimpl.h"
       
    34 #endif
    33 
    35 
    34 /** 
       
    35 @publishedPartner
       
    36 @released
       
    37 */
       
    38 IMPORT_C TInt RunRandomServer(TAny* /*someParameters*/);
    36 IMPORT_C TInt RunRandomServer(TAny* /*someParameters*/);
    39 
    37 
    40 const TInt KRandomBlockSize=1024;
    38 #endif // __RANDSVR_H__
    41 const TInt KRandomPoolSize=2048;
       
    42 
       
    43 /**
       
    44  *
       
    45  * @internalTechnology
       
    46  */
       
    47 class CRandomScheduler:public CActiveScheduler
       
    48 	{
       
    49 public:
       
    50 	static TBool New(void);
       
    51 	void Error(TInt aError) const;
       
    52 	};
       
    53 
       
    54 class CRandomSession;
       
    55 
       
    56 /**
       
    57  *
       
    58  * @internalTechnology
       
    59  */
       
    60 class CRandomServer : public CServer2
       
    61 	{
       
    62 public:
       
    63 	static TInt New(void);
       
    64 	~CRandomServer(void);
       
    65 	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    66 	friend class CRandomSession;
       
    67 private:
       
    68 	CRandomServer(void);
       
    69 	void ConstructL(void);
       
    70 	void Stir(void);
       
    71 	TPtrC8 GetRandom(void); 
       
    72 	CMessageDigest* Hash(void) const;
       
    73 	static TInt Tick(TAny* aPointer);
       
    74 	TUint8* iPool;
       
    75 	TInt iPoolIn;
       
    76 	TInt iPoolOut;
       
    77 	TInt iQuality;
       
    78 	TBool iFast;
       
    79 	CMessageDigest* iHash;
       
    80 	CPeriodic* iTicker;
       
    81 	};
       
    82 
       
    83 /**
       
    84  *
       
    85  * @internalTechnology
       
    86  */
       
    87 class CRandomSession : public CSession2 
       
    88 	{
       
    89 public:
       
    90 	enum { KRandomRequest };
       
    91 	static CRandomSession* NewL(CRandomServer* aServer);
       
    92 	~CRandomSession(void);
       
    93 	void ServiceL(const RMessage2& aMessage);
       
    94 private:
       
    95 	TInt FillBuffer(const RMessage2& aMessage);
       
    96 	CRandomServer* iServer;
       
    97 	CRandomSession(CRandomServer* aServer);
       
    98 	};
       
    99 
       
   100 #endif