realtimenetprots/sipfw/SIP/ConnectionMgr/src/CConnectionMonitor.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004-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:
       
    15 * Name        : CConnectionMonitor.h
       
    16 * Part of     : NetworkMonitor
       
    17 * See class definition below.
       
    18 * Version     : SIP/4.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @internalComponent
       
    27 */
       
    28 
       
    29 #ifndef __CCONNECTIONMONITOR_H__
       
    30 #define __CCONNECTIONMONITOR_H__
       
    31 
       
    32 // INCLUDES
       
    33 #include <es_sock.h>
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class MSIPNetworkObserver;
       
    37 
       
    38 // CLASS DEFINITION
       
    39 /**
       
    40  * CConnectionMonitor implements an active object for observing RConnection
       
    41  * progress notifications and reporting them to the MBearerOwner interface.
       
    42  */
       
    43 class CConnectionMonitor
       
    44 	: public CActive
       
    45 	{
       
    46 	public:	// Constructors and destructor
       
    47 
       
    48 		/**
       
    49 		 * Static constructor.
       
    50 		 *
       
    51 		 * @param aObserver Reference to observer
       
    52 		 * @param aConnection Reference to observed connection
       
    53 		 * @return An initialized instance of this class.
       
    54 		 */
       
    55 		static CConnectionMonitor* NewL( MSIPNetworkObserver& aObserver,
       
    56 								   		 RConnection& aConnection );
       
    57 
       
    58 		/// Destructor
       
    59 		~CConnectionMonitor();
       
    60 
       
    61 	public: // New methods
       
    62 
       
    63 		void StartMonitoring();
       
    64 		void StopMonitoring();
       
    65 		void MonitorConnectionClosure();
       
    66 
       
    67 	protected: // From CActive
       
    68 
       
    69 		void DoCancel();
       
    70 		void RunL();
       
    71 
       
    72 	private: // New methods
       
    73 
       
    74 		/**
       
    75 		 * Translates state information from TNifProgress to
       
    76 		 * a boolean value.
       
    77 		 *
       
    78 		 * @param aProgress Reference Nif progress information
       
    79 		 * @return ETrue if the progress stage is KConnectionOpen
       
    80 		 *		   or KLinkLayerOpen, EFalse otherwise.
       
    81 		 */
       
    82 		TBool TranslateStage( const TNifProgress& aProgress );
       
    83 		
       
    84 		void StartMonitor();
       
    85 
       
    86 	private: // Constructors
       
    87 
       
    88 		/**
       
    89 		 * Constructor.
       
    90 		 *
       
    91 		 * @param aObserver Reference to observer
       
    92 		 * @param aConnection Reference to observed connection
       
    93 		 */
       
    94 		CConnectionMonitor( MSIPNetworkObserver& aObserver,
       
    95 					 		RConnection& aConnection );
       
    96 
       
    97 		/// Default constructor. Not implemented.
       
    98 		CConnectionMonitor();
       
    99 
       
   100 	private: // Data
       
   101 
       
   102 		/// Reference to our observer. Not owned.
       
   103 		MSIPNetworkObserver& iObserver;
       
   104 
       
   105 		/// Reference to the observed connection. Not owned.
       
   106 		RConnection& iConnection;
       
   107 
       
   108 		/// Network interface progress state.
       
   109 		TNifProgressBuf iProgress;
       
   110 		
       
   111 		TBool iMonitorTotalClosure;
       
   112 	};
       
   113 
       
   114 #endif // __CCONNECTIONMONITOR_H__