natfw/natfwstunturnclient/src/cstunclientresolvingtls.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 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 
       
    19 
       
    20 
       
    21 #include "stunassert.h"
       
    22 #include "cstunclientimplementation.h"
       
    23 #include "cstunclientresolvingtls.h"
       
    24 
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CSTUNClientResolvingTLS::CSTUNClientResolvingTLS
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSTUNClientResolvingTLS::CSTUNClientResolvingTLS(
       
    33     const CSTUNClientState& aResolvingUDP ) :
       
    34     iResolvingUDP( aResolvingUDP )
       
    35     {
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CSTUNClientResolvingTLS::CSTUNClientResolvingTLS
       
    40 // Dummy implementation. Default constructor is declared private and not used.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CSTUNClientResolvingTLS::CSTUNClientResolvingTLS() :
       
    44     iResolvingUDP( *( CSTUNClientState* )0x1 )
       
    45     {
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CSTUNClientResolvingTLS::~CSTUNClientResolvingTLS
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CSTUNClientResolvingTLS::~CSTUNClientResolvingTLS()
       
    53     {    
       
    54     }
       
    55     
       
    56 // ---------------------------------------------------------------------------
       
    57 // CSTUNClientResolvingTLS::ResolvingCompletedL        
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CSTUNClientResolvingTLS::ResolvingCompletedL(
       
    61     CSTUNClientImplementation& aContext,
       
    62     TBool /*aObtainSharedSecret*/ ) const
       
    63     {
       
    64     aContext.TlsResolvedL( );
       
    65     aContext.ChangeState( &iResolvingUDP );
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CSTUNClientResolvingTLS::ResolvingFailed
       
    70 // Continue without using shared secret as TLS address couldn't be obtained.
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 void CSTUNClientResolvingTLS::ResolvingFailed(
       
    74     CSTUNClientImplementation& aContext,
       
    75     TInt aError ) const
       
    76     {
       
    77     __STUN_ASSERT_RETURN( aError != KErrNone, KErrArgument );
       
    78     
       
    79     // ignore error, continue with udp resolver
       
    80     TRAPD( err, ResolvingCompletedL( aContext, EFalse ) );
       
    81     if ( err != KErrNone )
       
    82         {
       
    83         aContext.Terminate( err );
       
    84         }
       
    85     }