vpnengine/ikev1lib/inc/ikev1nokianattkeepalive.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Keepalive object for Nokia IPsec over NAT
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_IKEV1NOKIANATTKEEPALIVE_H
       
    20 #define C_IKEV1NOKIANATTKEEPALIVE_H
       
    21 
       
    22 #include <in_sock.h> // TInetAddr
       
    23 
       
    24 class CIkev1PluginSession;
       
    25 class MIkeDebug;
       
    26 
       
    27 /**
       
    28  * Nokia IPsec over NAT keepalive object. Sends
       
    29  * UDP packets to specified host with specified
       
    30  * interval to keep NAT mapping alive. Constructing
       
    31  * the object starts sending and sending is stopped
       
    32  * when destruction happens.
       
    33  * @internalComponent
       
    34  */
       
    35 NONSHARABLE_CLASS(CIkev1NokiaNattKeepAlive) : public CBase
       
    36 	{
       
    37 	
       
    38 public: // Public constructor and destructor
       
    39 	static CIkev1NokiaNattKeepAlive* NewL( CIkev1PluginSession&  aPluginSession, 
       
    40 			                          TInetAddr& aDestAddr,
       
    41 			                          TUint16 aPort,
       
    42 			                          TUint aInterval,
       
    43 			                          MIkeDebug& aDebug );
       
    44 	virtual ~CIkev1NokiaNattKeepAlive();
       
    45 
       
    46 private: // Private constructors
       
    47 
       
    48 	CIkev1NokiaNattKeepAlive( CIkev1PluginSession&  aPluginSession,
       
    49 	                          TInetAddr& aDestAddr, 
       
    50 	                          TUint16 aPort,
       
    51 	                          MIkeDebug& aDebug );
       
    52 	void ConstructL( TUint aInterval );
       
    53 	
       
    54 private:
       
    55 	
       
    56 	/**
       
    57 	 * Send
       
    58 	 * Sends keepalive packet
       
    59 	 */
       
    60 	void Send();
       
    61 
       
    62 	/**
       
    63 	 * PeriodicCallback
       
    64 	 * Callback function which is called everytime
       
    65 	 * the interval is reached.
       
    66 	 */
       
    67 	static TInt PeriodicCallback(TAny *aPtr);
       
    68 
       
    69 private:
       
    70     CIkev1PluginSession&  iPluginSession;
       
    71 
       
    72 	TInetAddr iDestAddr;
       
    73 	TUint iPort;
       
    74 	
       
    75 	/** Data to send in keepalive packet */
       
    76 	TBuf8<1> iMsg;
       
    77 	
       
    78 	CPeriodic *iTimer;
       
    79 	
       
    80 	MIkeDebug& iDebug;
       
    81 	
       
    82 	};
       
    83 
       
    84 #endif // C_IKEV1NOKIANATTKEEPALIVE_H