natfw/natfwstunturnclient/src/cstunsharedsecretconnecting.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 "cstunsharedsecretconnecting.h"
       
    23 #include "cstunsharedsecret.h"
       
    24 
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting(
       
    33     const CSTUNSharedSecretState& aWaitResponse ) :
       
    34     iWaitResponse( aWaitResponse )
       
    35     {
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting
       
    40 // Dummy implementation. Default constructor is declared private and not used.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting() :
       
    44     iWaitResponse( *( CSTUNSharedSecretState* )0x1 )
       
    45     {
       
    46     }
       
    47 // ---------------------------------------------------------------------------
       
    48 // CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting
       
    49 // Dummy implementation, as copy constructor is declared private and not used.
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CSTUNSharedSecretConnecting::CSTUNSharedSecretConnecting(
       
    53     const CSTUNSharedSecretConnecting& aConnecting ) :
       
    54     CSTUNSharedSecretState(),
       
    55     iWaitResponse( aConnecting.iWaitResponse )
       
    56     {
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CSTUNSharedSecretConnecting::~CSTUNSharedSecretConnecting
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CSTUNSharedSecretConnecting::~CSTUNSharedSecretConnecting()
       
    64     {    
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CSTUNSharedSecretConnecting::TlsConnectedL
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void
       
    72 CSTUNSharedSecretConnecting::TlsConnectedL( CSTUNSharedSecret& aContext ) const
       
    73     {    
       
    74     aContext.SendRequestL();    
       
    75     aContext.ChangeState( &iWaitResponse );
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CSTUNSharedSecretConnecting::ErrorOccured
       
    80 // Treat all errors as KErrCouldNotConnect
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CSTUNSharedSecretConnecting::ErrorOccured( CSTUNSharedSecret& aContext,
       
    84                                                 TInt aError ) const
       
    85     {
       
    86     __STUN_ASSERT_RETURN( aError != KErrNone, KErrArgument );
       
    87     
       
    88     aContext.Terminate( KErrCouldNotConnect );
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CSTUNSharedSecretConnecting::TimerExpiredL
       
    93 // Timeout while creating a TLS connection.
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void
       
    97 CSTUNSharedSecretConnecting::TimerExpiredL( CSTUNSharedSecret& aContext ) const
       
    98     {
       
    99     aContext.Terminate( KErrCouldNotConnect );
       
   100     }