vpnengine/kmdserver/inc/connectionstopper.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 stopping of connection
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CONNECTIONSTOPPER_H
       
    20 #define C_CONNECTIONSTOPPER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class CVpnConnection;
       
    26 
       
    27 /**
       
    28  *  Connection stopper callback interface.
       
    29  *  Callback interface which is used by CConnectionStopper object to notify
       
    30  *  about completion of VPN connection stopping.
       
    31  * 
       
    32  *  @lib internal (kmdserver.exe)
       
    33   */
       
    34 class MConnectionStopperCallback
       
    35     {
       
    36 public:
       
    37     /**
       
    38      * Notifies about completion of VPN connection stopping.
       
    39      * @param aStatus Completion status
       
    40      */
       
    41     virtual void VpnConnectionStopped( TInt aStatus ) = 0;
       
    42     };
       
    43 
       
    44 /**
       
    45  *  Connection stopper.
       
    46  *  Active object provides functionality for stopping of VPN connection.
       
    47  *
       
    48  *  @lib internal (kmdserver.exe)
       
    49   */
       
    50 class CConnectionStopper : public CActive
       
    51     {
       
    52 public:
       
    53     /**
       
    54      * Two-phased constructor.
       
    55      * @param aConnection VPN connection object
       
    56      * @param aCallback Callback interface
       
    57      */
       
    58     static CConnectionStopper* NewL( CVpnConnection& aVpnConnection,
       
    59                                      MConnectionStopperCallback& aCallback );
       
    60 
       
    61     /**
       
    62      * Destructor.
       
    63      */
       
    64     ~CConnectionStopper();
       
    65 
       
    66     /**
       
    67      * Stops VPN connection. Completion is notified via MConnectionStopperCallback
       
    68      * interface.
       
    69      * @param aSilentClose Specified if a silent close in question (Delete
       
    70      *                     payloads not transmitted to remote host)
       
    71      */
       
    72     void StopVpnConnection( TBool aSilentClose );            
       
    73 
       
    74 private:
       
    75     CConnectionStopper( CVpnConnection& aVpnConnection,
       
    76                         MConnectionStopperCallback& aCallback );
       
    77     
       
    78 // from base class CActive
       
    79     
       
    80     /**
       
    81      * From CActive
       
    82      * Handles completion of asynchronous connection stopping request.
       
    83      */    
       
    84     void RunL();
       
    85 
       
    86     /**
       
    87      * From CActive
       
    88      * Handles cancellation of asynchronous connection stopping request.
       
    89      */    
       
    90     void DoCancel();
       
    91         
       
    92 private: // data
       
    93     
       
    94     /**
       
    95      * VPN connection object.
       
    96      * Not own.
       
    97      */
       
    98     CVpnConnection&                 iVpnConnection;    
       
    99 
       
   100     /**
       
   101      * Callback interface.
       
   102      * Not own.
       
   103      */
       
   104     MConnectionStopperCallback&     iCallback;
       
   105     };
       
   106 
       
   107 #endif // C_CONNECTIONSTOPPER_H