pkiutilities/DeviceToken/Inc/DevTokenServer.h
changeset 0 164170e6151a
child 11 510c10de8083
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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:   The header file of DevTokenServer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __DEVTOKENSERVER_H__
       
    21 #define __DEVTOKENSERVER_H__
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include "DevTokenCliServ.h"
       
    26 #include "DevTokenTypesEnum.h"
       
    27 
       
    28 class CDevCertKeyStoreServer;
       
    29 class CDevandTruSrvCertStoreServer;
       
    30 class CTrustedSitesServer;
       
    31 
       
    32 /**
       
    33  * Implements shutdown of the server.  When the last client disconnects, this
       
    34  * class is activated, and when the timer expires, causes the server to
       
    35  * close.
       
    36  *
       
    37  *  @lib
       
    38  *  @since S60 v3.2
       
    39  */
       
    40 class CShutdown : public CTimer
       
    41     {  
       
    42     public:
       
    43     
       
    44         inline CShutdown();
       
    45         
       
    46         inline void ConstructL();
       
    47         
       
    48         inline void Start();
       
    49         
       
    50     private:
       
    51         
       
    52         void RunL();
       
    53     };
       
    54 
       
    55 
       
    56 /** 
       
    57  * Device Tokens server class, manages sessions. 
       
    58  * 
       
    59  *  @lib
       
    60  *  @since S60 v3.2
       
    61  */
       
    62 class CDevTokenServer : public CServer2
       
    63     {
       
    64     public:
       
    65         
       
    66         static CServer2* NewLC();
       
    67         
       
    68         ~CDevTokenServer();
       
    69         
       
    70         void AddSession();
       
    71         
       
    72         void DropSession();
       
    73         
       
    74         /**
       
    75          * return the server object of keystore
       
    76          *
       
    77          * @param 
       
    78          * @return server object of keystore
       
    79          */
       
    80         CDevCertKeyStoreServer& KeyStoreServerL() const;
       
    81         
       
    82         /**
       
    83          * return the server object of certstore
       
    84          *
       
    85          * @param 
       
    86          * @return server object of certstore
       
    87          */
       
    88         CDevandTruSrvCertStoreServer& CertStoreServerL() const;
       
    89         
       
    90         /**
       
    91          * return the server object of Trusted Sites
       
    92          *
       
    93          * @param 
       
    94          * @return server object of Truste sites
       
    95          */
       
    96         CTrustedSitesServer& CDevTokenServer::TrustedSitesL() const;
       
    97         
       
    98     // For CServer2
       
    99     private:
       
   100 
       
   101         virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
   102     
       
   103     private:
       
   104     
       
   105         CDevTokenServer();
       
   106        
       
   107         void ConstructL();
       
   108     
       
   109     private:
       
   110        
       
   111         TInt iSessionCount;
       
   112        
       
   113         CShutdown iShutdown;
       
   114        
       
   115         mutable CDevCertKeyStoreServer* iKeyStoreServer;
       
   116        
       
   117         mutable CDevandTruSrvCertStoreServer* iCertStoreServer;
       
   118        
       
   119         mutable CTrustedSitesServer* iTrustedSitesServer;
       
   120     };
       
   121 
       
   122 /**
       
   123  * Base class for session objects.
       
   124  *
       
   125  *  @lib
       
   126  *  @since S60 v3.2
       
   127  */
       
   128 class CDevTokenServerSession : public CSession2
       
   129     {
       
   130     public:
       
   131        
       
   132         CDevTokenServerSession();
       
   133        
       
   134         virtual ~CDevTokenServerSession();
       
   135        
       
   136         inline CDevTokenServer& Server();
       
   137     
       
   138     protected:
       
   139        
       
   140         virtual void DoServiceL(const RMessage2& aMessage) = 0;
       
   141     
       
   142     private:
       
   143        
       
   144         virtual void CreateL();
       
   145        
       
   146         virtual void ServiceError(const RMessage2& aMessage, TInt aError);
       
   147        
       
   148         virtual void ServiceL(const RMessage2& aMessage);
       
   149     };
       
   150 
       
   151 #endif  //  __DEVTOKENSERVER_H__
       
   152 
       
   153 //EOF
       
   154