realtimenetprots/sipfw/SIP/sipapi/src/sipdialogterminated.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2003-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          : sipdialogterminated.cpp
       
    15 // Part of       : SIPAPI
       
    16 // Version       : SIP/4.0
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "sipdialogterminated.h"
       
    23 #include "SipDialogImplementation.h"
       
    24 #include "sipclienttransaction.h"
       
    25 #include "sipmessageelements.h"
       
    26 #include "sipresponseelements.h"
       
    27 #include "sipconnectioncallback.h"
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CDialogTerminated::NewL
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CDialogTerminated* CDialogTerminated::NewL()
       
    35     {
       
    36     return new (ELeave) CDialogTerminated();
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CDialogTerminated::CDialogTerminated
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CDialogTerminated::CDialogTerminated()
       
    44 	{
       
    45 	}
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CDialogTerminated::~CDialogTerminated
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CDialogTerminated::~CDialogTerminated()
       
    52 	{
       
    53 	}
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CDialogTerminated::State
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CSIPDialog::TState CDialogTerminated::State() const
       
    60     {
       
    61     return CSIPDialog::ETerminated;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CDialogTerminated::IncomingResponseL
       
    66 // If a transaction is found, response is passed to application also in
       
    67 // terminated-state. Otherwise the response is ignored.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 TBool CDialogTerminated::IncomingResponseL(CSIPDialogImplementation& aDialog,
       
    71                                            CSIPResponseElements* aElements,
       
    72 		                                   TUint32 aRequestId,
       
    73                                            TUint32 /*aDialogId*/,
       
    74                                            CConnectionCallback& aCallback) const
       
    75     {
       
    76     __SIP_ASSERT_LEAVE(aElements, KErrArgument);
       
    77 
       
    78     CSIPTransactionBase* ta = NULL;
       
    79     CSIPDialogAssocBase* assoc = NULL;
       
    80     if (aDialog.FindTransactionAndAssoc(aRequestId, &ta, &assoc))
       
    81         {
       
    82         __SIP_ASSERT_LEAVE(ta->IsSIPClientTransaction(), KErrGeneral);
       
    83 
       
    84         CSIPClientTransaction* clientTa =
       
    85             static_cast<CSIPClientTransaction*>(ta);        
       
    86         clientTa->SetResponseElements(aElements);
       
    87         aCallback.Set(CConnectionCallback::EIncomingResponse,
       
    88                       ta,
       
    89                       NULL,
       
    90                       NULL,
       
    91                       assoc);
       
    92         return ETrue;
       
    93         }
       
    94     
       
    95     delete aElements;
       
    96     return EFalse;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CDialogTerminated::IncomingResponseL
       
   101 // Ignore the response
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 TBool
       
   105 CDialogTerminated::IncomingResponseL(CSIPDialogImplementation& /*aDialog*/,
       
   106                                      CSIPResponseElements* aElements,
       
   107 		                             TUint32 /*aRequestId*/,
       
   108                                      TUint32 /*aRefreshId*/,
       
   109                                      TUint32 /*aDialogId*/,
       
   110                                      CConnectionCallback& /*aCallback*/) const
       
   111     {
       
   112     __SIP_ASSERT_LEAVE(aElements, KErrArgument);
       
   113     
       
   114     delete aElements;
       
   115     return EFalse;    
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CDialogTerminated::ErrorOccurred
       
   120 // Ignore the error
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 TBool
       
   124 CDialogTerminated::ErrorOccured(CSIPDialogImplementation& /*aDialog*/,
       
   125                                 TInt /*aError*/,
       
   126                                 TUint32 /*aRequestId*/,
       
   127                                 CConnectionCallback& /*aCallback*/) const
       
   128     {
       
   129     return EFalse;
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CDialogTerminated::ErrorOccured
       
   134 // Ignore the error
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 TBool CDialogTerminated::ErrorOccured(CSIPDialogImplementation& /*aDialog*/,
       
   138                                 TInt /*aError*/,
       
   139                                 TUint32 /*aRefreshId*/,
       
   140                                 TUint32 /*aRequestId*/,
       
   141                                 CConnectionCallback& /*aCallback*/) const
       
   142     {
       
   143     return EFalse;
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CDialogTerminated::ConnectionLost
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 void
       
   151 CDialogTerminated::ConnectionLost(CSIPDialogImplementation& /*aDialog*/) const
       
   152     {
       
   153     //no action
       
   154     }