natplugins/natptraversalcontroller/inc/cnatbindingrefresher.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CNATBINDINGREFRESHER_H
       
    19 #define CNATBINDINGREFRESHER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <es_sock.h>
       
    24 #include <securesocket.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MNATBindingRefresherObserver;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31 * A base class for refreshing NAT bindings.
       
    32 */
       
    33 class CNATBindingRefresher : public CBase
       
    34     {
       
    35     public:  // Constructors and destructor
       
    36 
       
    37         virtual ~CNATBindingRefresher();
       
    38 
       
    39     public: // New functions
       
    40 
       
    41         virtual TBool PersistentConnectionRequired() const;
       
    42 
       
    43         virtual TBool HasSocket( const RSocket& aSocket ) const = 0;
       
    44 
       
    45         virtual TBool HasSocket( const CSecureSocket& aSocket ) const;
       
    46 
       
    47         void SetRefresh( TBool aRefresh );
       
    48 
       
    49         void ContinueRefreshing();
       
    50 
       
    51         TBool IsRefreshed() const;
       
    52 
       
    53     public: // A callback for CDeltaTimer
       
    54 
       
    55         static TInt RefreshTimerExpired( TAny* aPtr );
       
    56 
       
    57     protected: // Constructors
       
    58 
       
    59         CNATBindingRefresher(
       
    60             CDeltaTimer& aDeltaTimer,
       
    61             MNATBindingRefresherObserver& aObserver );
       
    62 
       
    63     protected: // New functions
       
    64 
       
    65         virtual TInt RefreshInterval() = 0;
       
    66 
       
    67         virtual void RefreshTimerExpiredL() = 0;
       
    68 
       
    69         virtual void CancelRefresh() = 0;
       
    70 
       
    71     private: // New functions
       
    72 
       
    73         void StartTimer();
       
    74         void RefreshNow();
       
    75 
       
    76     protected: // Data
       
    77 
       
    78         MNATBindingRefresherObserver& iObserver;
       
    79 
       
    80     private: // Data
       
    81 
       
    82         CDeltaTimer& iDeltaTimer;
       
    83         TCallBack iDeltaTimerCallBack;
       
    84         TDeltaTimerEntry iDeltaTimerEntry;
       
    85         TBool iIsRefreshed;
       
    86         TBool iTimerRunning;
       
    87     };
       
    88 
       
    89 #endif // CNATBINDINGREFRESHER_H
       
    90 
       
    91 // End of File