mmsharing/mmshavailability/tsrc/ut_availability/Stubs/src/Csipservertransaction.cpp
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 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 *
       
    16 */
       
    17 
       
    18 #include "sipservertransaction.h"
       
    19 #include "siprequestelements.h"
       
    20 #include "sipresponseelements.h"
       
    21 #include <sipstrings.h>
       
    22 #include <sipstrconsts.h>
       
    23 #include "CSipSseTestTls.h"
       
    24 #include "musunittesting.h"
       
    25 
       
    26 #include "CSipSseTestTls.h"
       
    27 
       
    28 EXPORT_C CSIPServerTransaction::~CSIPServerTransaction()
       
    29 	{
       
    30 	delete iRequestElements;
       
    31 	}
       
    32 
       
    33 
       
    34 CSIPServerTransaction::CSIPServerTransaction( RStringF aType )
       
    35  : CSIPTransactionBase( aType, EFalse )
       
    36 	{
       
    37 	}
       
    38 
       
    39 
       
    40 EXPORT_C CSIPServerTransaction* CSIPServerTransaction::NewL( RStringF aType )
       
    41 	{
       
    42 	return new(ELeave)CSIPServerTransaction( aType );
       
    43 	}
       
    44 
       
    45 
       
    46 EXPORT_C void CSIPServerTransaction::SetRequestElements(
       
    47     CSIPRequestElements* aElements)
       
    48     {
       
    49     if( iRequestElements )
       
    50     	{
       
    51     	delete iRequestElements;
       
    52     	}
       
    53     
       
    54     iRequestElements = aElements;
       
    55     }
       
    56 
       
    57 
       
    58 EXPORT_C void CSIPServerTransaction::SendResponseL(
       
    59     CSIPResponseElements *aElements)
       
    60     {
       
    61     CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
    62     if ( tls )
       
    63         {
       
    64         User::LeaveIfError( tls->Error() );
       
    65         tls->ClientResponse( iRequestElements->Method(), aElements );
       
    66         // tls->SIPSends( Type(), aElements );
       
    67         }
       
    68     else
       
    69         {
       
    70         if( iResponseElements)
       
    71             {
       
    72             delete iResponseElements;
       
    73             iResponseElements = NULL;
       
    74             }
       
    75         iResponseElements = aElements;
       
    76         }
       
    77     }
       
    78 
       
    79 
       
    80 EXPORT_C const CSIPRequestElements* CSIPServerTransaction::RequestElements() const
       
    81     {
       
    82     return iRequestElements;
       
    83     }
       
    84     
       
    85 EXPORT_C TBool CSIPServerTransaction::ResponseAllowed() const
       
    86     {
       
    87     if ( Type() == SIPStrings::StringF( SipStrConsts::EAck ) )
       
    88         {
       
    89         return EFalse;
       
    90         }
       
    91     else
       
    92         {
       
    93         return ETrue;
       
    94         }
       
    95     }