vpnengine/kmdserver/inc/activationstarter.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:  active object, that monitors activating
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_ACTIVATIONSTARTER_H
       
    20 #define C_ACTIVATIONSTARTER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <in_sock.h>
       
    24 
       
    25 #include "vpnmandefs.h"
       
    26 #include "ikesocketdefs.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CIkeData;
       
    30 class CVpnConnection;
       
    31 class MIkeDebug;
       
    32 class TVPNAddress;
       
    33 
       
    34 /**
       
    35  *  Activation starter callback interface.
       
    36  *  Callback interface which is used by CActivationStarter object to notify
       
    37  *  about completion of activation.
       
    38  * 
       
    39  *  @lib internal (kmdserver.exe)
       
    40   */
       
    41 class MActivationStarterCallback
       
    42     {
       
    43 public:        
       
    44     /**
       
    45      * Notifies about completion of activation.
       
    46      * @param aStatus Completion status
       
    47      * @param aVirtualIp Internal address info
       
    48      */
       
    49     virtual void ActivationCompleted( TInt aStatus,
       
    50                                       const TVPNAddress& aVirtualIp ) = 0;
       
    51     };
       
    52 
       
    53 
       
    54 /**
       
    55  *  Activating starter.
       
    56  *  Active object provides functionality for starting activating.
       
    57  *
       
    58  *  @lib internal (kmdserver.exe)
       
    59  */
       
    60 class CActivationStarter : public CActive
       
    61     {
       
    62 public:
       
    63     /**
       
    64      * Two-phased constructor.
       
    65      * @param aConnection VPN connection object
       
    66      * @param aCallback Callback interface
       
    67      * @param aDebug Debug trace interface
       
    68      */
       
    69     static CActivationStarter* NewL( CVpnConnection& aConnection,
       
    70                                      MActivationStarterCallback& aCallback,
       
    71                                      MIkeDebug& aDebug );
       
    72     
       
    73     /**
       
    74      * Destructor.
       
    75      */
       
    76     ~CActivationStarter();
       
    77 
       
    78     /**
       
    79      * Starts activating. Completion is notified via
       
    80      * MActivatingStarterCallback interface.
       
    81      * @param aIkeConf IKE policy data
       
    82      * @param aVpnIfName VPN interface name
       
    83      */
       
    84     void Activate( CIkeData& aIkeData,
       
    85                    const TDesC& aVpnIfName );
       
    86 
       
    87 private:
       
    88     
       
    89     CActivationStarter( CVpnConnection& aConnection,
       
    90                         MActivationStarterCallback& aCallback,
       
    91                         MIkeDebug& aDebug );    
       
    92     
       
    93     /**
       
    94      * Gets VPN interface index.
       
    95      * @param aVpnIfName VPN interface name
       
    96      * @param aVpnInterfaceIndex VPN interface index (returned)
       
    97      * @return Error code
       
    98      */
       
    99     TInt GetVpnInterfaceIndex( const TDesC& aVpnIfName,
       
   100                                TUint32& aVpnInterfaceIndex );
       
   101         
       
   102 // from base class CActive
       
   103     
       
   104     /**
       
   105      * From CActive
       
   106      * Handles completion of asynchronous activating.
       
   107      */    
       
   108     void RunL();
       
   109     
       
   110     /**
       
   111      * From CActive
       
   112      * Handles cancellation of asynchronous activating.
       
   113      */    
       
   114     void DoCancel();
       
   115     
       
   116 private: // data
       
   117     
       
   118     /**
       
   119      * Internal address.
       
   120      * Own.
       
   121      */
       
   122     TVPNAddress                 iInternalAddress;
       
   123     
       
   124     /**
       
   125      * IP version.
       
   126      * Own.
       
   127      */
       
   128     IkeSocket::TIpVersion       iIpVersion;
       
   129     
       
   130     /**
       
   131      * DNS server address from IKE policy data.
       
   132      * Own.
       
   133      */
       
   134     TInetAddr                   iDnsServerAddr;
       
   135     
       
   136     /**
       
   137      * VPN connection object.
       
   138      * Not own.
       
   139      */
       
   140     CVpnConnection&             iConnection;
       
   141     
       
   142     /**
       
   143      * Callback interface.
       
   144      * Not own.
       
   145      */
       
   146     MActivationStarterCallback& iCallback;
       
   147     
       
   148     /**
       
   149      * Debug trace interface.
       
   150      * Not own.
       
   151      */
       
   152     MIkeDebug&                   iDebug;
       
   153     };
       
   154 
       
   155 
       
   156 #endif // C_ACTIVATIONSTARTER_H