realtimenetprots/sipfw/SIP/TransactionUser/src/UserAgentState.h
author Petteri Saari <petteri.saari@digia.com>
Thu, 25 Nov 2010 13:59:42 +0200
branchMSRP_FrameWork
changeset 58 cdb720e67852
parent 0 307788aac0a8
permissions -rw-r--r--
This release addresses the following issues: 1. The crash bug fix when receiving file 2. Now the sending is based on MSRP messages, there is no longer file receiving or sending. Client sends data as MSRP was designed. 3. Soma MSRP stack was created so that the client told the correct session-id, Symbian stack generated it by itself. This is not allowed, it was changed so that clients tell the session-id (same as used in SIP INVITE). 4. Unnecessary division of data to chunks removed when there is no need to interrupt sending. The message is sent in as few chunks as possible. 5. Stack can now receive files and chunks with ?unlimited? size. Old stack wrote the incoming data to memory and did not utilize disk space until the end of chunk was reached (large chunks from another client crashed it). 6. Now when writing the incoming data to file, it will take into account the byte-range header values. So, this complies with the RFC4975 requirements that stack must be able to handle chunks that come in any sequence. 7. Some buffering changes to outgoing/incoming data. 8. The outgoing data is now checked that it does not contain the created transaction-id before sending the data. 9. MSRP success reports are now implemented and tested against servers. 10. Progress report system fixed so progress is now visible on client (all the way to 100%). 11. Message Cancel receiving / Cancel sending now corrected and made to work as rfc4975 requires. (termination from sender and error code from receiver when cancelling). 12. Bug correction related to messages received not belonging to any session, old stack implementation did send error response, but after response was written it did give the buffer to client anyway. Now corrected.

/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
* Name          : UserAgentState.h
* Part of       : TransactionUser
* Version       : SIP/5.0
*
*/




/**
 @internalComponent
*/

#ifndef USERAGENTSTATE_H
#define USERAGENTSTATE_H

// INCLUDES
#include <e32base.h>

#include "SipStackServerDefs.h"
#include "CSipConnectionMgr.h"
#include "Lwtimer.h"	// TTimerId

// FORWARD DECLARATIONS
class TInetAddr;
class RStringF;
class CSIPRequest;
class CSIPResponse;
class CURIContainer;

class MTransactionOwner;
class CUserAgent;

// CLASS DECLARATION

/**
 * Base class for all states of all UserAgent objects. 
 */
class CUserAgentState : public CBase
	{
public:
	virtual ~CUserAgentState();

	virtual void SendRequestL(CUserAgent& aUserAgent,
							  CSIPRequest* aReq,
							  TRegistrationId aRegisterId,
							  const CURIContainer& aRemoteTarget) const;
	virtual void SendResponseL(CUserAgent& aUserAgent,
							   CSIPResponse* aResp,
							   const TSIPTransportParams& aParams) const;
	virtual void SendCancelL(CUserAgent& aUserAgent,
							 TTransactionId aInviteTaId) const;
	virtual void SendAckL(CUserAgent& aUserAgent,
						  CSIPRequest* aAck,
						  MTransactionOwner& aObserver,
						  const TSIPTransportParams& aParams,
						  TRegistrationId aRegisterId,
						  const CURIContainer& aRemoteTarget,
						  TBool aDeleteRequest,
						  RStringF aBranch) const;

	virtual void AddressResolvedL(CUserAgent& aUserAgent) const;
	virtual void ResolvingFailed(CUserAgent& aUserAgent) const;

	virtual void TransactionEndsL(CUserAgent& aUserAgent, TInt aReason) const;

    virtual void ReceiveL(CUserAgent& aUserAgent, CSIPRequest* aRequest) const;
	virtual void ReceiveL(CUserAgent& aUserAgent,
						  CSIPResponse* aResponse) const;

	virtual void OwnerFoundL(CUserAgent& aUserAgent,
							 MTransactionOwner* aOwner) const;
	virtual void OwnerNotFoundL(CUserAgent& aUserAgent,
								CSIPResponse* aResp) const;

	virtual void SendCompleteL(CUserAgent& aUserAgent) const;
	virtual void SendFailedL(CUserAgent& aUserAgent, TInt aErrcode) const;

	virtual void SIPSecCacheUpdatedL(CUserAgent& aUserAgent,
									 TBool aSuccess) const;

	virtual void TimerExpiredL(CUserAgent& aUserAgent,
							   TTimerId aTimerId,
							   TAny* aTimerParam) const;
    virtual void RequestRouterErrorL(CUserAgent& aUserAgent) const;

	virtual void IcmpErrorL(CUserAgent& aUserAgent,
							const TInetAddr& aAddress,
							CSipConnectionMgr::TICMPError aError) const;

	/**
	 * Tells if the UA is waiting an address to be resolved.	 
	 * @return value ETrue if UA is resolving, EFalse otherwise
	 */
	virtual TBool IsResolving() const;

	/**
	 * Tells whether the UA can continue without the outgoing SIP message.
	 * @param aFinalRespPassed ETrue if a final response has been passed to
	 *	upper layer, EFalse otherwise
	 * @return value ETrue if the UserAgent can continue, EFalse otherwise
	 */
	virtual TBool CanContinueWithoutOutgoingMsg(TBool aFinalRespPassed) const;

	/**
	 * Finds out if this is an UAS that must be stopped now that upper layer
	 * clears the callback. If this is an INVITE UAS which waiting for upper
	 * layer to provide a final response, then the UAS must be stopped.	 
	 * @return value ETrue UAS must stop
	 *			     EFalse otherwise
	 */
	virtual TBool ShouldUASStop() const;

	/**
	 * A CANCEL request has been received from network. If the UA is in such
	 * a state that it can be canceled, it'll do so and returns ETrue.
	 * @return value ETrue UA is canceled
	 *				 EFalse otherwise
	 */
	virtual TBool CancelL(CUserAgent& aUserAgent) const;

protected:

	CUserAgentState();

	void HandleTimerExpirationL(CUserAgent& aUserAgent,
								TTimerId aTimerId,
								TAny* aTimerParam) const;	
	};

#endif // end of USERAGENTSTATE_H

// End of File