realtimenetprots/sipfw/SIP/TransactionUser/src/UserAgentState.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2006-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          : UserAgentState.h
       
    16 * Part of       : TransactionUser
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef USERAGENTSTATE_H
       
    29 #define USERAGENTSTATE_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 
       
    34 #include "SipStackServerDefs.h"
       
    35 #include "CSipConnectionMgr.h"
       
    36 #include "Lwtimer.h"	// TTimerId
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class TInetAddr;
       
    40 class RStringF;
       
    41 class CSIPRequest;
       
    42 class CSIPResponse;
       
    43 class CURIContainer;
       
    44 
       
    45 class MTransactionOwner;
       
    46 class CUserAgent;
       
    47 
       
    48 // CLASS DECLARATION
       
    49 
       
    50 /**
       
    51  * Base class for all states of all UserAgent objects. 
       
    52  */
       
    53 class CUserAgentState : public CBase
       
    54 	{
       
    55 public:
       
    56 	virtual ~CUserAgentState();
       
    57 
       
    58 	virtual void SendRequestL(CUserAgent& aUserAgent,
       
    59 							  CSIPRequest* aReq,
       
    60 							  TRegistrationId aRegisterId,
       
    61 							  const CURIContainer& aRemoteTarget) const;
       
    62 	virtual void SendResponseL(CUserAgent& aUserAgent,
       
    63 							   CSIPResponse* aResp,
       
    64 							   const TSIPTransportParams& aParams) const;
       
    65 	virtual void SendCancelL(CUserAgent& aUserAgent,
       
    66 							 TTransactionId aInviteTaId) const;
       
    67 	virtual void SendAckL(CUserAgent& aUserAgent,
       
    68 						  CSIPRequest* aAck,
       
    69 						  MTransactionOwner& aObserver,
       
    70 						  const TSIPTransportParams& aParams,
       
    71 						  TRegistrationId aRegisterId,
       
    72 						  const CURIContainer& aRemoteTarget,
       
    73 						  TBool aDeleteRequest,
       
    74 						  RStringF aBranch) const;
       
    75 
       
    76 	virtual void AddressResolvedL(CUserAgent& aUserAgent) const;
       
    77 	virtual void ResolvingFailed(CUserAgent& aUserAgent) const;
       
    78 
       
    79 	virtual void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;
       
    80 
       
    81     virtual void ReceiveL(CUserAgent& aUserAgent, CSIPRequest* aRequest) const;
       
    82 	virtual void ReceiveL(CUserAgent& aUserAgent,
       
    83 						  CSIPResponse* aResponse) const;
       
    84 
       
    85 	virtual void OwnerFoundL(CUserAgent& aUserAgent,
       
    86 							 MTransactionOwner* aOwner) const;
       
    87 	virtual void OwnerNotFoundL(CUserAgent& aUserAgent,
       
    88 								CSIPResponse* aResp) const;
       
    89 
       
    90 	virtual void SendCompleteL(CUserAgent& aUserAgent) const;
       
    91 	virtual void SendFailedL(CUserAgent& aUserAgent, TInt aErrcode) const;
       
    92 
       
    93 	virtual void SIPSecCacheUpdatedL(CUserAgent& aUserAgent,
       
    94 									 TBool aSuccess) const;
       
    95 
       
    96 	virtual void TimerExpiredL(CUserAgent& aUserAgent,
       
    97 							   TTimerId aTimerId,
       
    98 							   TAny* aTimerParam) const;
       
    99     virtual void RequestRouterErrorL(CUserAgent& aUserAgent) const;
       
   100 
       
   101 	virtual void IcmpErrorL(CUserAgent& aUserAgent,
       
   102 							const TInetAddr& aAddress,
       
   103 							CSipConnectionMgr::TICMPError aError) const;
       
   104 
       
   105 	/**
       
   106 	 * Tells if the UA is waiting an address to be resolved.	 
       
   107 	 * @return value ETrue if UA is resolving, EFalse otherwise
       
   108 	 */
       
   109 	virtual TBool IsResolving() const;
       
   110 
       
   111 	/**
       
   112 	 * Tells whether the UA can continue without the outgoing SIP message.
       
   113 	 * @param aFinalRespPassed ETrue if a final response has been passed to
       
   114 	 *	upper layer, EFalse otherwise
       
   115 	 * @return value ETrue if the UserAgent can continue, EFalse otherwise
       
   116 	 */
       
   117 	virtual TBool CanContinueWithoutOutgoingMsg(TBool aFinalRespPassed) const;
       
   118 
       
   119 	/**
       
   120 	 * Finds out if this is an UAS that must be stopped now that upper layer
       
   121 	 * clears the callback. If this is an INVITE UAS which waiting for upper
       
   122 	 * layer to provide a final response, then the UAS must be stopped.	 
       
   123 	 * @return value ETrue UAS must stop
       
   124 	 *			     EFalse otherwise
       
   125 	 */
       
   126 	virtual TBool ShouldUASStop() const;
       
   127 
       
   128 	/**
       
   129 	 * A CANCEL request has been received from network. If the UA is in such
       
   130 	 * a state that it can be canceled, it'll do so and returns ETrue.
       
   131 	 * @return value ETrue UA is canceled
       
   132 	 *				 EFalse otherwise
       
   133 	 */
       
   134 	virtual TBool CancelL(CUserAgent& aUserAgent) const;
       
   135 
       
   136 protected:
       
   137 
       
   138 	CUserAgentState();
       
   139 
       
   140 	void HandleTimerExpirationL(CUserAgent& aUserAgent,
       
   141 								TTimerId aTimerId,
       
   142 								TAny* aTimerParam) const;	
       
   143 	};
       
   144 
       
   145 #endif // end of USERAGENTSTATE_H
       
   146 
       
   147 // End of File