realtimenetprots/sipfw/SIP/Transaction/src/ResponseQueueItem.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          : ResponseQueueItem.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef RESPONSEQUEUEITEM_H
       
    30 #define RESPONSEQUEUEITEM_H
       
    31 
       
    32 // INCLUDES
       
    33 #include <e32base.h>
       
    34 #include "TSIPTransportParams.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CSIPResponse;
       
    38 
       
    39 
       
    40 /**
       
    41  * This class contains a SIP response and the related transport parameters.
       
    42  */
       
    43 class CResponseQueueItem : public CBase
       
    44 	{
       
    45 public: // Constructor and destructor
       
    46 
       
    47 	/**
       
    48 	 * Creates a new instance of CResponseQueueItem. CResponseQueueItem never
       
    49 	 * takes ownership of a 2xx response that is sent to INVITE.
       
    50 	 *
       
    51 	 * @pre aResp != NULL
       
    52 	 *
       
    53 	 * @param aResp SIP response, ownership is not transferred yet.
       
    54 	 *	Ownership transfer is done later by using SetResponseOwnership(ETrue)
       
    55 	 * @param aParams Transport parameters
       
    56 	 * @param aRespToInvite ETrue if aResp is a response to INVITE
       
    57 	 * @return new CResponseQueueItem object, ownership is transferred
       
    58 	 */
       
    59 	static CResponseQueueItem* NewLC(CSIPResponse* aResp,
       
    60 									 const TSIPTransportParams& aParams,
       
    61 									 TBool aRespToInvite);
       
    62 
       
    63 	~CResponseQueueItem();
       
    64 
       
    65 public: // New functions
       
    66 
       
    67 	/**
       
    68 	 * Takes or releases the ownership of iResp member. If iResp is 2xx and
       
    69 	 * iRespToInvite is ETrue, the ownership is not taken, regardless of the
       
    70 	 * value of aOwnsResponse.
       
    71 	 *
       
    72 	 * @param aOwnsResponse If ETrue, the CResponseQueueItem owns the response
       
    73 	 *	stored in iResp.
       
    74 	 */
       
    75 	void SetResponseOwnership(TBool aOwnsResponse);
       
    76 
       
    77 	/**	
       
    78 	 * Returns the stored SIP response.
       
    79 	 *
       
    80 	 * @return SIP response.
       
    81 	 */
       
    82 	CSIPResponse& Response();
       
    83 
       
    84 	/**
       
    85 	 * Returns the stored transport parameters.
       
    86 	 *
       
    87 	 * @return Transport parameters
       
    88 	 */
       
    89 	const TSIPTransportParams& TransportParams() const;
       
    90 
       
    91 	/**	
       
    92 	 * Checks if the response is to an INVITE request.
       
    93 	 *	 
       
    94 	 * @return ETrue Response is to an INVITE request, EFalse otherwise
       
    95 	 */
       
    96 	TBool IsRespToInvite() const;
       
    97 
       
    98 private: // Constructor, for internal use
       
    99 
       
   100 	/**	
       
   101 	 * Constructor
       
   102 	 *
       
   103 	 * @pre aUri != NULL
       
   104 	 *
       
   105 	 * @param aResp SIP response, ownership is transferred
       
   106 	 * @param aParams Transport parameters	 
       
   107 	 */
       
   108 	CResponseQueueItem(CSIPResponse* aResp,
       
   109 					   const TSIPTransportParams& aParams,
       
   110 					   TBool aRespToInvite);
       
   111 
       
   112 private: // Data
       
   113 	
       
   114 	CSIPResponse* iResp;
       
   115 	TSIPTransportParams iParams;	
       
   116 
       
   117 	//If ETrue, the SIP response in iResp is a response to INVITE.
       
   118 	//If iResp is 2xx and iRespToInvite is ETrue, iOwnsResponse remains always
       
   119 	//EFalse, as UAS owns the 2xx response to INVITE.
       
   120 	TBool iRespToInvite;
       
   121 
       
   122 	//If ETrue, CResponseQueueItem owns the response in iResp.
       
   123 	TBool iOwnsResponse;
       
   124 	};
       
   125 
       
   126 #endif // end of RESPONSEQUEUEITEM_H
       
   127 
       
   128 // End of File