common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureserverbase.h
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // csesureserverbase.h
       
    15 // Definition of class used to encapsulate a LBS server 
       
    16 // (for example,  LbsLocServer.exe)
       
    17 // 
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24  @internalTechnology
       
    25 */
       
    26 
       
    27 
       
    28 #ifndef __LBSSECURESERVERBASE_H__
       
    29 #define __LBSSECURESERVERBASE_H__
       
    30 
       
    31 #include <e32base.h>
       
    32 
       
    33 // forward classes
       
    34 class CShutdownTimer;
       
    35 
       
    36 /** default server shutdown delay */
       
    37 const TTimeIntervalMicroSeconds32 KDefaultShutdownDelay = 2*1000*1000;
       
    38 
       
    39 // NB this and the panic list should be pblisghed all + released...
       
    40 /** Liternal used as the panic catageory by the server framework */
       
    41 _LIT(KServerFrameworkPanic, "ServerFramework");
       
    42 enum TServerFrameWorkPanics
       
    43 		{
       
    44 		ESecureSubSessionBaseUnknownSubSessionType = 1 // the sever does not reognise the session type.
       
    45 		};
       
    46 
       
    47 /** 
       
    48 @internalTechnology
       
    49 @released
       
    50 @see CShutdownTimer
       
    51 @see CPolicyServer
       
    52 
       
    53 CPolicy based class to provde security functionalities to the server base
       
    54  */
       
    55 class CSecureServerBase : public CPolicyServer
       
    56 	{
       
    57 public:
       
    58 	/** Secure server base panic type */
       
    59 	enum ESecureServerBasePanic 
       
    60 		{
       
    61 		EBaseConstructNotCalled = 0,
       
    62 		EBaseCreateNotCalled = 1
       
    63 		};
       
    64 public:
       
    65 	// creation - called from CPolicyServer
       
    66 	virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const;
       
    67 	// secondary creation - called by the implementaion of NewSessionL above
       
    68 	virtual CSession2* DoNewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const = 0;
       
    69 	virtual TVersion GetServerVersion() const = 0;
       
    70 	// destruction
       
    71 	virtual ~CSecureServerBase();
       
    72 public:
       
    73 	void IncSession();
       
    74 	void DecSession();
       
    75 
       
    76 	TInt GetSessionCount() const;
       
    77 	TTimeIntervalMicroSeconds32 GetShutdownDelay() const;
       
    78 	void SetShutdownDelay(const TTimeIntervalMicroSeconds32 aDelay);
       
    79 	// must be public to the sessions can so this is required.
       
    80 	void PanicServer(TInt aPanicCode) const;
       
    81 protected:
       
    82 	CSecureServerBase(TInt aPriority, const TPolicy& aSecurityPolicy);
       
    83 	void BaseConstructL(TBool aShutdownTimerRequired = ETrue);
       
    84 protected:
       
    85 	// property
       
    86 	// protected in case a derived class ever has to overload
       
    87 	/** number of sessions to the server */
       
    88 	TInt						iSessionCount;
       
    89 	/** shut down timer for the server */
       
    90 	CShutdownTimer*				iShutdownTimer;
       
    91 	/** shut down time delay */
       
    92 	TTimeIntervalMicroSeconds32 iShutdownDelay;
       
    93 private:
       
    94 	// property - really do mean private here
       
    95 	/** indicate whether the base construct has been called */
       
    96 	TBool iBaseConstructCalled;
       
    97 	};
       
    98 
       
    99 
       
   100 #endif  // __LBSSECURESERVERBASE_H__