vpnengine/kmdserver/inc/kmdsession.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Server side session of KMD server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_KMDSESSION_H
       
    20 #define C_KMDSESSION_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <es_sock.h>
       
    24 
       
    25 #include "activationstarter.h"
       
    26 #include "connectionstarter.h"
       
    27 #include "connectionstopper.h"
       
    28 #include "fqdnresolver.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CKmdServer;
       
    32 class CKmdSessionHandler;
       
    33 class MIkeDebug;
       
    34 class TVPNAddress;
       
    35 
       
    36 /**
       
    37  *  KMD session.
       
    38  *  Server side session of KMD server. Handles client requests.
       
    39  *
       
    40  *  @lib internal (kmdserver.exe)
       
    41  */
       
    42 class CKmdSession : public CSession2,
       
    43                     public MActivationStarterCallback,
       
    44                     public MConnectionStarterCallback,
       
    45                     public MConnectionStopperCallback,
       
    46                     public MFqdnResolverCallback
       
    47     {
       
    48 public: 
       
    49                
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aServer KMD server
       
    53      * @param aDebug Debug trace interface
       
    54      */
       
    55     static CKmdSession* NewL( CKmdServer& aServer,
       
    56                               MIkeDebug& aDebug );    
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     ~CKmdSession();
       
    62     
       
    63 // from base class CSession2
       
    64     
       
    65     /**
       
    66      * From CSession2
       
    67      * Handles client request.
       
    68      *
       
    69      * @param aMessage Message request
       
    70      */
       
    71     void ServiceL( const RMessage2& aMessage );
       
    72         
       
    73 // from base class MConnectionStarterCallback
       
    74     
       
    75     /**
       
    76      * From MConnectionStarterCallback
       
    77      * Notification about completion of real connection starting.
       
    78      *
       
    79      * @param aStatus Completion status
       
    80      * @param aRealIapId IAP Id of started connection
       
    81      * @param aRealNetId Net Id of started connection
       
    82      */
       
    83     void RealConnectionStarted( TInt aStatus,
       
    84                                 TInt aRealIapId,
       
    85                                 TInt aRealNetId );
       
    86     
       
    87 // from base class MConnectionStopperCallback
       
    88     
       
    89     /**
       
    90      * From MConnectionStopperCallback
       
    91      * Notification about completion of VPN connection stopping.
       
    92      *
       
    93      * @param aStatus Completion status
       
    94      */
       
    95     void VpnConnectionStopped( TInt aStatus );
       
    96     
       
    97 // from base class MFqdnResolverCallback
       
    98     
       
    99     /**
       
   100      * From MFqdnResolverCallback
       
   101      * Notifies about completion of FQDN address resolving.
       
   102      *
       
   103      * @param aStatus Completion status
       
   104      * @param aNameEntry Result of name resolution
       
   105      */
       
   106     void AddressResolveCompleted( TInt aStatus,
       
   107                                   TNameEntry aNameEntry );
       
   108 
       
   109 // from base class MActivationStarterCallback
       
   110     
       
   111     /**
       
   112      * From MActivationStarterCallback
       
   113      * Notification about completion of activation.
       
   114      *
       
   115      * @param aStatus Completion status
       
   116      * @param aVirtualIp Internal address info
       
   117      */
       
   118     void ActivationCompleted( TInt aStatus,
       
   119                               const TVPNAddress& aVirtualIp );
       
   120         
       
   121 private:
       
   122     CKmdSession( CKmdServer& aServer,
       
   123                  MIkeDebug& aDebug );      
       
   124     
       
   125     /**
       
   126      * Cancels real connection starting.
       
   127      */
       
   128     void DoCancelStartConnection();
       
   129     
       
   130     /**
       
   131      * Cancels activating
       
   132      */
       
   133     void DoCancelActivate();
       
   134     
       
   135     /**
       
   136      * Cancels FQDN address resolving.
       
   137      */
       
   138     void DoCancelResolveAddress();
       
   139         
       
   140 private: // data    
       
   141     /**
       
   142      * KMD server.
       
   143      * Not own.
       
   144      */
       
   145     CKmdServer&         iServer;    
       
   146     
       
   147     /**
       
   148      * VPN IAP Id.
       
   149      * Not own.
       
   150      */
       
   151     TUint32             iVpnIapId;
       
   152     
       
   153     /**
       
   154      * Connection starter active object.
       
   155      * Own.
       
   156      */
       
   157     CConnectionStarter* iConnectionStarter;  
       
   158 
       
   159     /**
       
   160      * Connection stopper active object.
       
   161      * Own.
       
   162      */
       
   163     CConnectionStopper*  iConnectionStopper;
       
   164 
       
   165     /**
       
   166      * FQDN address resolver active object.
       
   167      * Own.
       
   168      */
       
   169     CFqdnResolver*      iFqdnResolver;
       
   170     
       
   171     /**
       
   172      * Activation starter active object.
       
   173      * Own.
       
   174      */
       
   175     CActivationStarter* iActivationStarter;
       
   176     
       
   177     /**
       
   178      * Pending start connection message.
       
   179      * Own.
       
   180      */
       
   181     RMessage2           iPendingStartConnection;
       
   182 
       
   183     /**
       
   184      * Pending stop connection message.
       
   185      * Own.
       
   186      */
       
   187     RMessage2           iPendingStopConnection;
       
   188 
       
   189     /**
       
   190      * Pending FQDN resolve message.
       
   191      * Own.
       
   192      */
       
   193     RMessage2           iPendingFqdnResolve;
       
   194 
       
   195     /**
       
   196      * Pending activate message.
       
   197      * Own.
       
   198      */
       
   199     RMessage2           iPendingActivate;
       
   200         
       
   201     /**
       
   202      * Debug trace interface.
       
   203      * Not own.
       
   204      */
       
   205     MIkeDebug&          iDebug;
       
   206 
       
   207     };
       
   208 
       
   209 #endif // C_KMDSESSION_H