realtimenetprots/sipfw/SIP/Transaction/src/ResponseQueue.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          : ResponseQueue.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef RESPONSEQUEUE_H
       
    30 #define RESPONSEQUEUE_H
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CResponseQueueItem;
       
    34 
       
    35 
       
    36 /**
       
    37  * This class represents a queue for storing SIP responses in the order they
       
    38  * are sent. Server transactions need to queue the responses because
       
    39  * transaction can't send another response until the previous asynchronous send
       
    40  * has been completed.
       
    41  */
       
    42 class CResponseQueue : public CBase
       
    43 	{
       
    44 public: // Constructor and destructor
       
    45 
       
    46 	static CResponseQueue* NewL();
       
    47 
       
    48 	~CResponseQueue();
       
    49 
       
    50 public: // New functions
       
    51 
       
    52 	/**	
       
    53 	 * Adds a SIP response into the queue.
       
    54 	 *
       
    55 	 * @pre aResp != NULL
       
    56 	 *
       
    57 	 * @param aRespItem Response item which is stored to the queue, ownership is
       
    58 	 *	transferred if Add returns KErrNone
       
    59 	 * @return KErrNone If successful and the ownership of aRespItem is
       
    60 	 *	transferred. Otherwise a system wide error code and the ownership of
       
    61 	 *  aRespItem is not transferred.
       
    62 	 */
       
    63 	TInt Add(CResponseQueueItem* aRespItem);
       
    64 
       
    65 	/**
       
    66 	 * Extracts the oldest response item from the queue.
       
    67 	 *
       
    68 	 * @return value Response item, or NULL if there were no items in the queue.
       
    69 	 *	Ownership is transferred.
       
    70 	 */
       
    71 	CResponseQueueItem* GetNext();
       
    72 
       
    73 private: // Constructor, for internal use
       
    74 
       
    75     CResponseQueue();
       
    76 
       
    77 private: // Data
       
    78 
       
    79 	//Response queue. The items are owned.
       
    80 	RPointerArray<CResponseQueueItem> iQueue;
       
    81 
       
    82 	// For testing purposes
       
    83 #ifdef CPPUNIT_TEST	
       
    84 	friend class CTransactionUser_Test;
       
    85 #endif
       
    86 	};
       
    87 
       
    88 #endif // end of RESPONSEQUEUE_H
       
    89 
       
    90 // End of File