realtimenetprots/sipfw/SIP/sipapi/api/sipnotifydialogassoc.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) 2005-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        : sipnotifydialogassoc.h
* Part of     : SIP Client
* Interface   : SDK API, SIP Client API
* Version     : 1.0
*
*/




#ifndef CSIPNOTIFYDIALOGASSOC_H
#define CSIPNOTIFYDIALOGASSOC_H

// INCLUDES
#include <e32base.h>
#include "sipdialogassocbase.h"

// CONSTANTS

// FORWARD DECLARATIONS
class CSIPEventHeader;
class CSIPSubscriptionStateHeader;
class MSIPRegistrationContext;

// CLASS DECLARATION

/**
* @publishedAll
* @released
*
* Class for managing SIP NOTIFY dialog associations.
* It provides services for creating, using and
* terminating SIP NOTIFY dialog associations. The user can have multiple
* NOTIFY dialog associations per same SIP dialog.
* Implementation handles SUBSCRIBE on the dialog level defined by Call-Id,
* local and remote tags; user is responsible for "Event" and
* "Subscription-State" header semantics.
* @lib sipclient.lib
*/
class CSIPNotifyDialogAssoc: public CSIPDialogAssocBase
	{
	public: // Constructors and destructor

        /**
		* Two-phased constructor.
		* The response to the received SIP request will create a SIP NOTIFY
		* dialog association that will be correlated with the SIP dialog in
		* which SIP server transaction was received. If the server transaction
		* was not received within a SIP dialog, a new SIP dialog is created.
		* The server transaction must be either SUBSCRIBE or REFER transaction.
		* @pre aTransaction.State()==ETrying || EProceeding
		* @pre aTransaction.Type() == 
		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
        * @pre aEvent != 0 && aState != 0
		* @param aTransaction a SIP server transaction 
		* @param aEvent an event to send a notification about; the ownership
		*        is transferred.
		* @param aState a subscription state; the ownership is transferred.
		* @return New object; the ownership is transferred
		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
		*	transaction, or aEvent == 0 or aState == 0.
		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
		*	state
		*/
		IMPORT_C static CSIPNotifyDialogAssoc*
			NewL(CSIPServerTransaction& aTransaction,
			     CSIPEventHeader* aEvent,
				 CSIPSubscriptionStateHeader* aState);

		/**
		* Two-phased constructor.
		* The response to the received SIP request will create a SIP NOTIFY
		* dialog association that will be correlated with the SIP dialog in
		* which SIP server transaction was received. If the server transaction
		* was not received within a SIP dialog, a new SIP dialog is created.
		* The server transaction must be either SUBSCRIBE or REFER transaction.
		* @pre aTransaction.State()==ETrying || EProceeding
		* @pre aTransaction.Type() == 
		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer	
        * @pre aEvent != 0 && aState != 0
		* @param aTransaction a SIP server transaction
		* @param aEvent an event to send a notification about; the ownership
		*        is transferred.
		* @param aState a subscription state; the ownership is transferred.
		* @return New object; the ownership is transferred
		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
		*	transaction, or aEvent == 0 or aState == 0.
		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
		*	state
		*/
		IMPORT_C static CSIPNotifyDialogAssoc*
			NewLC(CSIPServerTransaction& aTransaction,
			      CSIPEventHeader* aEvent,
				  CSIPSubscriptionStateHeader* aState);
				  
        /**
		* Two-phased constructor.
		* The response to the received SIP request will create a SIP NOTIFY
		* dialog association that will be correlated with the SIP dialog in
		* which SIP server transaction was received. If the server transaction
		* was not received within a SIP dialog, a new SIP dialog is created.
		* The server transaction must be either SUBSCRIBE or REFER transaction.
		* @pre aTransaction.State()==ETrying || EProceeding
		* @pre aTransaction.Type() == 
		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
		* @pre aContext.IsContextActive() == ETrue	
        * @pre aEvent != 0 && aState != 0
		* @param aTransaction a SIP server transaction
        * @param aContext that will be used for populating 
        *        the Contact-header of the response to aTransaction		
		* @param aEvent an event to send a notification about; the ownership
		*        is transferred.
		* @param aState a subscription state; the ownership is transferred.
		* @return New object; the ownership is transferred
		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
		*	transaction, or aEvent == 0 or aState == 0.
		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
		*	state
		*/
		IMPORT_C static CSIPNotifyDialogAssoc*
			NewL(CSIPServerTransaction& aTransaction,
                 const MSIPRegistrationContext& aContext,			
			     CSIPEventHeader* aEvent,
				 CSIPSubscriptionStateHeader* aState);

		/**
		* Two-phased constructor.
		* The response to the received SIP request will create a SIP NOTIFY
		* dialog association that will be correlated with the SIP dialog in
		* which SIP server transaction was received. If the server transaction
		* was not received within a SIP dialog, a new SIP dialog is created.
		* The server transaction must be either SUBSCRIBE or REFER transaction.
		* @pre aTransaction.State()==ETrying || EProceeding
		* @pre aTransaction.Type() == 
		*      SipStrConsts::ESubscribe || SipStrConsts::ERefer
		* @pre aContext.IsContextActive() == ETrue	
        * @pre aEvent != 0 && aState != 0
		* @param aTransaction a SIP server transaction
        * @param aContext that will be used for populating 
        *        the Contact-header of the response to aTransaction		
		* @param aEvent an event to send a notification about; the ownership
		*        is transferred.
		* @param aState a subscription state; the ownership is transferred.
		* @return New object; the ownership is transferred
		* @leave KErrArgument if aTransaction is not a SUBSCRIBE or REFER
		*	transaction, or aEvent == 0 or aState == 0.
		* @leave KErrSIPInvalidTransactionState if aTransaction is in a wrong
		*	state
		*/
		IMPORT_C static CSIPNotifyDialogAssoc*
			NewLC(CSIPServerTransaction& aTransaction,
                  const MSIPRegistrationContext& aContext,
			      CSIPEventHeader* aEvent,
				  CSIPSubscriptionStateHeader* aState);				  

		/**
		* Destructor
		*/
		IMPORT_C ~CSIPNotifyDialogAssoc();
			                                  
	public: // New functions

        /**
		* Creates NOTIFY and sends it to the remote target.		
		* If client provides optional SIP headers they must
		* not contain Event and Subscription-State headers.		
		* @pre Dialog().Connection().State()==EActive
		* @pre Dialog().State()==CSIPDialog::TState::EConfirmed		
		* @param aElements optional SIP message headers and body.
		*	Ownership is transferred.
		* @return NOTIFY SIP UAC transaction
		* @leave KErrSIPInvalidDialogState if dialog's state is incorrect
		* @leave KErrSIPResourceNotAvailable if a required SIP Client API
		*	object has been deleted.
		* @capability NetworkServices
		*/
		IMPORT_C CSIPClientTransaction*
            SendNotifyL(CSIPMessageElements* aElements=0);

		/**
		* Gets an event about which the notification is done
		* @return an event
		*/
		IMPORT_C const CSIPEventHeader& Event() const;

		/**
		* Gets subscription state
		* @return subscription state
		*/
		IMPORT_C CSIPSubscriptionStateHeader& SubscriptionState();
		
		/**
		* Gets subscription state
		* @return subscription state
		*/
		IMPORT_C const CSIPSubscriptionStateHeader& SubscriptionState() const;

	public: // New functions, for internal use

		CSIPClientTransaction*
			DoSendNotifyWithinDialogL(CSIPMessageElements* aElements);

	private: // Constructors

		CSIPNotifyDialogAssoc();

        void ConstructL(CSIPServerTransaction& aTransaction,
                        const MSIPRegistrationContext* aContext,
                        CSIPEventHeader* aEvent,
                        CSIPSubscriptionStateHeader* aState);

	private: // Data

		CSIPEventHeader* iEvent;
		CSIPSubscriptionStateHeader* iSubscriptionState;
	};

#endif