realtimenetprots/sipfw/SIP/Transaction/src/ResponseQueueItem.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : ResponseQueueItem.cpp
       
    15 // Part of       : Transaction
       
    16 // Version       : SIP/4.0
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "sipresponse.h"
       
    23 
       
    24 #include "ResponseQueueItem.h"
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CResponseQueueItem::NewLC
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 CResponseQueueItem*
       
    31 CResponseQueueItem::NewLC(CSIPResponse* aResp,
       
    32 						  const TSIPTransportParams& aParams,
       
    33 						  TBool aRespToInvite)
       
    34 	{
       
    35     __SIP_ASSERT_LEAVE(aResp, KErrArgument);
       
    36 
       
    37 	CResponseQueueItem* self = new (ELeave) CResponseQueueItem(aResp,
       
    38 															   aParams,
       
    39 															   aRespToInvite);
       
    40     CleanupStack::PushL(self);
       
    41     return self;
       
    42 	}
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CResponseQueueItem::CResponseQueueItem
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CResponseQueueItem::CResponseQueueItem(CSIPResponse* aResp,
       
    49 									   const TSIPTransportParams& aParams,
       
    50 									   TBool aRespToInvite) :
       
    51 	iResp(aResp),
       
    52 	iParams(aParams),
       
    53 	iRespToInvite(aRespToInvite),
       
    54 	iOwnsResponse(EFalse)	
       
    55 	{	
       
    56 	}
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CResponseQueueItem::~CResponseQueueItem
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CResponseQueueItem::~CResponseQueueItem()
       
    63 	{
       
    64 	if (iOwnsResponse)
       
    65 		{		
       
    66 		delete iResp;
       
    67 		}
       
    68 	}
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CResponseQueueItem::SetResponseOwnership
       
    72 // CResponseQueueItem can never own a 2xx response to INVITE.
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CResponseQueueItem::SetResponseOwnership(TBool aOwnsResponse)
       
    76 	{
       
    77 	if (!(iResp->Type() == CSIPResponse::E2XX && iRespToInvite))
       
    78 		{
       
    79 		iOwnsResponse = aOwnsResponse;
       
    80 		}
       
    81 	}
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CResponseQueueItem::Response
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 CSIPResponse& CResponseQueueItem::Response()
       
    88 	{	
       
    89 	return *iResp;
       
    90 	}
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CResponseQueueItem::TransportParams
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 const TSIPTransportParams& CResponseQueueItem::TransportParams() const
       
    97 	{
       
    98 	return iParams;
       
    99 	}
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CResponseQueueItem::IsRespToInvite
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TBool CResponseQueueItem::IsRespToInvite() const
       
   106 	{
       
   107 	return iRespToInvite;
       
   108 	}