vpnengine/ikev2lib/inc/ikev2sender.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 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:  Sender of UDP datagrams
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_IKEV2SENDER_H
       
    20 #define C_IKEV2SENDER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 // FORWARD DECLARATIONS
       
    25 class MIkeDataInterface;
       
    26 class TInetAddr;
       
    27 
       
    28 /**
       
    29  *  IKEv2 sender callback interface.
       
    30  *  Callback interface which is used by CIkev2Sender object to notify
       
    31  *  about completion of sending.
       
    32  * 
       
    33  *  @lib internal (ikev2lib.lib)
       
    34   */
       
    35 NONSHARABLE_CLASS(MIkev2SenderCallback)
       
    36     {
       
    37 public:        
       
    38     /**
       
    39      * Notifies about completion of sending.
       
    40      *
       
    41      * @param aStatus Completion status
       
    42      * @param aMsg IKE message
       
    43      */
       
    44     virtual void SendIkeMsgCompleted( TInt aStatus ) = 0;
       
    45 
       
    46     };
       
    47 
       
    48 /**
       
    49  *  IKEv1 sender.
       
    50  *  Active object provides functionality for sending UDP datagrams.
       
    51  *
       
    52  *  @lib internal (ikev1lib.lib)
       
    53   */
       
    54 NONSHARABLE_CLASS(CIkev2Sender) : public CActive
       
    55     {
       
    56 public:
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      * @param aDataInterface IKE data interface
       
    60      * @param aCallback Callback interface
       
    61      */
       
    62     static CIkev2Sender* NewL( MIkeDataInterface& aDataInterface,
       
    63                                MIkev2SenderCallback& aCallback );
       
    64 
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     ~CIkev2Sender();
       
    69 
       
    70     /**
       
    71     * Sends IKE message.
       
    72     * @param aLocalPort Local port
       
    73     * @param aDestAddr Destination IP address/port
       
    74     * @param aIkeMsg IKE message
       
    75     */
       
    76     void SendIkeMsg( TInt aLocalPort,
       
    77                      TInetAddr& aDestAddr,
       
    78                      TUint8 aDscp,
       
    79                      const TDesC8& aIkeMsg );
       
    80         
       
    81     
       
    82 private:
       
    83     
       
    84     CIkev2Sender( MIkeDataInterface& aDataInterface,
       
    85                   MIkev2SenderCallback& aCallback );
       
    86 
       
    87 // from base class CActive            
       
    88     
       
    89     /**
       
    90      * From CActive
       
    91      * Handles completion of asynchronous sending.
       
    92      */    
       
    93     void RunL();
       
    94 
       
    95     /**
       
    96      * From CActive
       
    97      * Handles cancellation of asynchronous sending.
       
    98      */    
       
    99     void DoCancel();
       
   100         
       
   101 private: // data
       
   102         
       
   103     /**
       
   104      * IKE data interface.
       
   105      * Not own.
       
   106      */
       
   107     MIkeDataInterface&          iDataInterface;
       
   108     
       
   109     /**
       
   110      * Callback interface.
       
   111      * Not own.
       
   112      */
       
   113     MIkev2SenderCallback&       iCallback;
       
   114     };
       
   115 
       
   116 #endif // C_IKEV2SENDER_H