natfw/tsrc/natfwtestconsoles/natfwtestconsole/src/turntcpsettings.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 "turntcpsettings.h"
       
    22 
       
    23 #include <unsafprotocolscrkeys.h>
       
    24 
       
    25 
       
    26 //  CONSTANTS
       
    27 
       
    28 //Settings
       
    29 //Domain spesific settings
       
    30 _LIT8( KTURNServAddr, "193.65.183.11:3478" );
       
    31 _LIT8( KTURNUser, "markosaa" );
       
    32 _LIT8( KTURNPassword, "markosaaeb" );
       
    33 //const TInt KNATRefreshTCP = 1140;
       
    34 //const TInt KNATRefreshUDP = 30;
       
    35 //const TInt KEnableCRLFRefresh = 0;
       
    36 // none additional STUN server settings
       
    37 _LIT8( KNatProtocol, "nokia.turn" );
       
    38 //TURN specific in the Domain settings 
       
    39 //const TInt KLifeTime = 500;
       
    40 //const TInt KTimerValue = 1600;
       
    41 
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CTurnTcpSettings::NewL
       
    45 // -----------------------------------------------------------------------------
       
    46 // 
       
    47 CTurnTcpSettings* CTurnTcpSettings::NewL( const TDesC8& aDomain,
       
    48                                                  TUint aIapId )
       
    49     {
       
    50     CTurnTcpSettings* self = CTurnTcpSettings::NewLC(aDomain, aIapId );
       
    51     CleanupStack::Pop( self );
       
    52     return self;
       
    53     }
       
    54 
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CTurnTcpSettings::NewL
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CTurnTcpSettings* CTurnTcpSettings::NewLC( const TDesC8& aDomain,
       
    61                                                   TUint aIapId )
       
    62     {   
       
    63     CTurnTcpSettings* self = new( ELeave ) CTurnTcpSettings( aIapId );
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL( aDomain );
       
    66     return self;
       
    67     }
       
    68     
       
    69     
       
    70 // -----------------------------------------------------------------------------
       
    71 // CTurnTcpSettings::CTurnTcpSettings
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CTurnTcpSettings::CTurnTcpSettings( TUint aIapId )
       
    75     : CGeneralSettings( aIapId )
       
    76     {
       
    77     }
       
    78     
       
    79     
       
    80 // -----------------------------------------------------------------------------
       
    81 // CTurnTcpSettings::~CTurnTcpSettings
       
    82 // -----------------------------------------------------------------------------
       
    83 //   
       
    84 CTurnTcpSettings::~CTurnTcpSettings( )
       
    85     {
       
    86     EraseL( KUNSAFProtocolsDomainTableMask, 0xf0000000 );
       
    87  	EraseL( KUNSAFProtocolsIAPTableMask, 0xf0000000 );
       
    88     }
       
    89     
       
    90     
       
    91 // -----------------------------------------------------------------------------
       
    92 // CTurnTcpSettings::ConstructL
       
    93 // -----------------------------------------------------------------------------
       
    94 //    
       
    95 void CTurnTcpSettings::ConstructL( const TDesC8& aDomain )
       
    96     {
       
    97     CGeneralSettings::ConstructL( aDomain );
       
    98     }
       
    99     
       
   100     
       
   101 // -----------------------------------------------------------------------------
       
   102 // CTurnTcpSettings::CreateSettingsL
       
   103 // -----------------------------------------------------------------------------
       
   104 //   
       
   105 void CTurnTcpSettings::CreateSettingsL()
       
   106     {
       
   107     CGeneralSettings::CreateSettingsL();
       
   108     
       
   109     User::LeaveIfError( GetDomainKey( iDomainKey ) );
       
   110     
       
   111     //create key for the turn server settings in the domain settings
       
   112     TUint32 TURNServerKey = CreateNewTableKeyL(
       
   113         KUNSAFProtocolsTURNServerTableMask | iDomainKey,
       
   114         KUNSAFProtocolsSubTableFieldTypeMask );
       
   115    
       
   116     //Settings
       
   117     /************************************************************************/
       
   118     //domain specific
       
   119      StoreL( KUNSAFProtocolsUsedNATProtocolMask | iDomainKey, 
       
   120         KNatProtocol );
       
   121         
       
   122     /************************************************************************/
       
   123     //TURN-server settings in the domain
       
   124     StoreL( KUNSAFProtocolsTURNAddressMask | iDomainKey | TURNServerKey,
       
   125         KTURNServAddr );
       
   126     /*    
       
   127     StoreL( KUNSAFProtocolsTURNTCPTimeoutMask | iDomainKey | TURNServerKey,
       
   128         KNATRefreshTCP );
       
   129     StoreL( KUNSAFProtocolsTURNUDPTimeoutMask | iDomainKey | TURNServerKey,
       
   130         KNATRefreshUDP );
       
   131     StoreL( KUNSAFProtocolsTURNEnableCRLFRefreshMask | iDomainKey | TURNServerKey,
       
   132         KEnableCRLFRefresh );
       
   133     */
       
   134     StoreL( KUNSAFProtocolsTURNUsernameMask | iDomainKey | TURNServerKey,
       
   135         KTURNUser );
       
   136     StoreL( KUNSAFProtocolsTURNPasswordMask | iDomainKey | TURNServerKey,
       
   137         KTURNPassword );
       
   138     /************************************************************************/
       
   139     //TURN specific in the Domain settings
       
   140     StoreL( KUNSAFProtocolsTURNAddressMask | iDomainKey, KTURNServAddr );
       
   141     /*
       
   142     StoreL( KUNSAFProtocolsTURNLifeTimeMask | iDomainKey, KLifeTime );
       
   143     StoreL( KUNSAFProtocolsTURNTimerValueMask | iDomainKey, 
       
   144         KTimerValue );
       
   145     */
       
   146     }