realtimenetprots/sipfw/ProfileAgent/IETF_Agent/inc/sipietfprofileagent.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2003-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        : sipietfprofileagent.h
       
    16 * Part of     : sip ietf1 agent
       
    17 * Interface   : private
       
    18 * Version     : 1.0
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @internalComponent
       
    27 */
       
    28 
       
    29 #ifndef CSIPIETFPROFILEAGENT_H
       
    30 #define CSIPIETFPROFILEAGENT_H
       
    31 
       
    32 //  INCLUDES
       
    33 #include <e32base.h>
       
    34 #include "sipprofileagent.h"
       
    35 #include "sipprofileagentobserver.h"
       
    36 #include "sipprofilefsmuser.h"
       
    37 #include "sipobserver.h"
       
    38 #include "siphttpdigestchallengeobserver2.h"
       
    39 #include <sipprofileagentextensionparams.h>
       
    40 
       
    41 
       
    42 //FORWARD DECLARATIONS
       
    43 class CSIP;
       
    44 class CSIPHttpDigest;
       
    45 class TSIPProfileTypeInfo;
       
    46 class CSIPIetfConnectionContext;
       
    47 class CSIPPrflInitState;
       
    48 class CSIPPrflResolvingProxiesState;
       
    49 class CSIPPrflRegisterRequestedState;
       
    50 class CSIPPrflRegistrationInProgressState;
       
    51 class CSIPPrflRegisteredState;
       
    52 class CSIPPrflDeregisterRequestedState;
       
    53 class CSIPPrflDeregistrationInProgressState;
       
    54 class CSIPPrflRegisterDelayRequestedState;
       
    55 class CSIPIetfProfileContext;
       
    56 class CSIPProfileQueueHandling;
       
    57 
       
    58 // CLASS DECLARATION
       
    59 /**
       
    60 *  Registers profiles and maintains
       
    61 *  profile registrations as per RFC3261.
       
    62 *  
       
    63 *  @lib n/a
       
    64 */
       
    65 class CSIPIetfProfileAgent: 
       
    66     public CSIPProfileAgent, 
       
    67 	public MSIPProfileAgentObserver,
       
    68 	public MSIPProfileFSMUser,
       
    69 	public MSIPObserver,
       
    70 	public MSIPHttpDigestChallengeObserver2
       
    71 	{
       
    72 	public: // Constructors and destructor
       
    73 		   
       
    74         /**
       
    75         * Two-phased constructor.
       
    76 	    * @param aInitParams parameters passed in the construction
       
    77         */
       
    78         static CSIPIetfProfileAgent* NewL(TAny* aInitParams);
       
    79 	
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         virtual ~CSIPIetfProfileAgent();
       
    84 
       
    85 	public: // From CSIPProfileAgent
       
    86 
       
    87         const TSIPProfileTypeInfo& Type() const;
       
    88         
       
    89 		CSIPConcreteProfile* CreateL();
       
    90 	
       
    91 	    void RegisterL(
       
    92 			CSIPConcreteProfile& aSIPConcreteProfile);
       
    93 
       
    94 		void UpdateL(
       
    95 			CSIPConcreteProfile& aNewProfile, 
       
    96 			CSIPConcreteProfile& aOldProfile);
       
    97 
       
    98 	    void DeregisterL(
       
    99 			CSIPConcreteProfile& aSIPConcreteProfile);
       
   100 
       
   101 		TInt GetProfileState(
       
   102 		    CSIPConcreteProfile::TStatus& aState, 
       
   103 			CSIPConcreteProfile& aProfile) const;
       
   104 
       
   105 	    TBool IsIdle();
       
   106 		
       
   107         TBool RegisterPending(CSIPConcreteProfile& aSIPProfile) const;
       
   108 
       
   109 		TInt TerminateHandling(CSIPConcreteProfile& aProfile);
       
   110 
       
   111         TInt Extension(TInt aOperationCode, TAny* aParams); 
       
   112 
       
   113     public: // From MSIPProfileAgentObserver
       
   114     
       
   115 		void SIPProfileStatusEvent(
       
   116 		    CSIPConcreteProfile& aProfile,
       
   117 		    TUint32 aContextId);
       
   118 
       
   119 		void SIPProfileErrorEvent(
       
   120 		    CSIPConcreteProfile& aProfile,
       
   121 		    TInt aError);
       
   122 
       
   123 		TBool ProceedRegistration(CSIPConcreteProfile& aProfile, TInt aError);
       
   124 		
       
   125 		void GetFailedProfilesL( 
       
   126 		    const TSIPProfileTypeInfo& aType,
       
   127 		    RPointerArray<CSIPConcreteProfile>& aFailedProfiles) const;    
       
   128 
       
   129 
       
   130     public: // From MSIPProfileFSMUser
       
   131 
       
   132         void RegisterProfileL(
       
   133             CSIPConcreteProfile& aSIPConcreteProfile);
       
   134 
       
   135         void DeregisterProfileL(
       
   136             CSIPConcreteProfile& aSIPConcreteProfile);
       
   137 
       
   138         void RetryProfileRegistrationL( 
       
   139             CSIPConcreteProfile& aSIPProfile );
       
   140 
       
   141         TBool AddProfileIntoQueue( 
       
   142             CSIPConcreteProfile& aSIPConcreteProfile ) const;
       
   143 
       
   144         void RegisterProfileAfterQueueL( 
       
   145             CSIPConcreteProfile& aSIPConcreteProfile );
       
   146 
       
   147         void DeregisterProfileAfterQueueL( 
       
   148             CSIPConcreteProfile& aSIPConcreteProfile );
       
   149 
       
   150         void RetryProfileRegistrationAfterQueueL( 
       
   151             CSIPConcreteProfile& aSIPConcreteProfile );
       
   152             
       
   153         TBool IsInQueue( 
       
   154             CSIPConcreteProfile& aSIPProfile ) const;
       
   155 
       
   156 		void SetInterimProfile( CSIPConcreteProfile* 
       
   157         									aSIPConcreteProfile );
       
   158 
       
   159     public: // From MSIPObserver
       
   160 
       
   161         void IncomingRequest(
       
   162             TUint32 aIapId,
       
   163             CSIPServerTransaction* aTransaction);
       
   164 
       
   165         void TimedOut(CSIPServerTransaction& aTransaction);
       
   166 
       
   167     public: // From MSIPHttpDigestChallengeObserver2
       
   168     
       
   169         void ChallengeReceived(const CSIPClientTransaction& aTransaction);
       
   170 
       
   171         void ChallengeReceived(const CSIPRefresh& aRefresh);
       
   172 
       
   173 
       
   174 	private: // Constructors
       
   175 
       
   176 	    /**
       
   177 		* C++ default constructor.
       
   178 		*/
       
   179 		CSIPIetfProfileAgent(TSIPProfileAgentInitParams* aInitParams);
       
   180 
       
   181 		/**
       
   182 		* By default Symbian 2nd phase constructor is private.
       
   183 		*/
       
   184 		void ConstructL();
       
   185 
       
   186 		
       
   187     private: // New functions		
       
   188 
       
   189 		/**
       
   190 		* Provides profile context
       
   191 		* @param aProfile a profile
       
   192 		* @return a profile context
       
   193 		*/
       
   194 		CSIPIetfProfileContext& ProvideProfileContextL(CSIPConcreteProfile& aProfile);
       
   195 
       
   196 		/**
       
   197 		* Finds profile context
       
   198 		* @param aSIPConcreteProfile a profile
       
   199 		* @return profile context, the ownership is not transferred
       
   200 		*/
       
   201 		CSIPIetfProfileContext* FindProfileContext(CSIPConcreteProfile& aSIPConcreteProfile) const;
       
   202 
       
   203 		/**
       
   204 		* Finds profile context
       
   205 		* @param aProfileId identifier of the profile
       
   206 		* @return profile context, the ownership is not transferred
       
   207 		*/
       
   208 		CSIPIetfProfileContext* FindProfileContext(TUint32 aProfileId) const;
       
   209 
       
   210 		/**
       
   211 		* Finds connection context
       
   212 		* @param aPriofile a profile
       
   213 		* @return a connection context
       
   214 		*/
       
   215 		CSIPIetfConnectionContext* FindConnectionContext(CSIPConcreteProfile& aProfile) const;
       
   216 		
       
   217 		/**
       
   218 		* Finds connection context
       
   219 		* @param aIapId a iap id
       
   220 		* @return a connection context
       
   221 		*/
       
   222 		CSIPIetfConnectionContext* FindConnectionContext( TUint32 aIapId ) const;
       
   223 	
       
   224 		/**
       
   225 		* Destroys idle connection contexts
       
   226 		*/
       
   227 		void CleanIdleConnectionContexts();
       
   228 				
       
   229 		TBool DeregisterToWaitingQueueL( CSIPIetfProfileContext* aContext );
       
   230 		
       
   231 		
       
   232 		void RegisterQueue( CSIPConcreteProfile& aProfile, TBool aReportError );
       
   233     
       
   234 		TBool AllowedTakeFromQueue( CSIPConcreteProfile& aSIPConcreteProfile );
       
   235 	
       
   236 	
       
   237 	private: //  Data
       
   238 
       
   239 		CSIP*									iSIP;
       
   240 		CSIPHttpDigest*                         iHttpDigest;
       
   241 		MSIPProfileAgentObserver&				iSIPProfileAgentObserver;
       
   242 		CDeltaTimer&							iDeltaTimer;
       
   243 		TSIPProfileTypeInfo						iType;
       
   244 		CSIPPrflInitState*						iInit;
       
   245 		CSIPPrflResolvingProxiesState*			iResolvingProxies;
       
   246 		CSIPPrflRegisterRequestedState*			iRegRequested;
       
   247 		CSIPPrflRegistrationInProgressState*	iRegInProgress;
       
   248 		CSIPPrflRegisteredState*				iRegistered;
       
   249 		CSIPPrflDeregisterRequestedState*		iDeregRequested;
       
   250 		CSIPPrflDeregistrationInProgressState*	iDeregInProgress;
       
   251 		CSIPPrflRegisterDelayRequestedState*    iRegDelayRequested;
       
   252 		RPointerArray<CSIPIetfConnectionContext> iConnectionCtxArray;
       
   253 		CSIPProfileQueueHandling* 				iProfileQueueHandling;
       
   254 		CSipProfileAgentConfigExtension*		iConfigExtension;//not owned
       
   255 
       
   256 
       
   257 #ifdef CPPUNIT_TEST	
       
   258 	    friend class CSIPIetfProfileAgentTest;
       
   259 #endif
       
   260 	};
       
   261 
       
   262 #endif CSIPIETFPROFILEAGENT_H