natfw/natfwsettings/src/tnatfwicepreferences.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:    Encapsulates preference settings for ICE prioritization.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "tnatfwicepreferences.h"
       
    22 #include "natfwdefaultsettingsvalues.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 TNATFWIcePreferences::TNATFWIcePreferences()
       
    27     :
       
    28     iHostPref( KNATFWDefaultlHostPref ),
       
    29     iServerReflexivePref( KNATFWDefaultServerRefPref ),
       
    30     iRelayPref( KNATFWDefaultRelayPref ),
       
    31     iPeerReflexivePref( KNATFWDefaultPeerRefPref ),
       
    32     iIpv4AddrFamilyPref( KNATFWDefaultIPV4Pref ),
       
    33     iIpv6AddrFamilyPref( KNATFWDefaultIPV6Pref ),
       
    34     iVpnInterfacePref( KNATFWDefaultVPNPref ),
       
    35     iUdpTransportPref( KNATFWDefaultUDPPref ),
       
    36     iTcpTransportPref( KNATFWDefaultTCPPref ),
       
    37     iTcpDirActivePref( KNATFWDefaultTCPActivePref ),
       
    38     iTcpDirPassivePref( KNATFWDefaultTCPPassivePref ),
       
    39     iTcpDirSimultaneousOpenPref( KNATFWDefaultTCPSimultPref )
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // TNATFWIcePreferences::SetPrefValue
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 TInt TNATFWIcePreferences::SetPrefValue( 
       
    49         MNATFWIceSettings::TPrefSetting aSetting, TInt aValue )
       
    50     {
       
    51     switch ( aSetting )
       
    52         {
       
    53         case MNATFWIceSettings::EPrefHostCandidate:
       
    54             iHostPref = aValue;
       
    55             break;
       
    56         
       
    57         case MNATFWIceSettings::EPrefServerReflexiveCandidate:
       
    58             iServerReflexivePref = aValue;
       
    59             break;
       
    60         
       
    61         case MNATFWIceSettings::EPrefRelayCandidate:
       
    62             iRelayPref = aValue;
       
    63             break;
       
    64         
       
    65         case MNATFWIceSettings::EPrefPeerReflexiveCandidate:
       
    66             iPeerReflexivePref = aValue;
       
    67             break;
       
    68         
       
    69         case MNATFWIceSettings::EPrefIpv4AddrFamily:
       
    70             iIpv4AddrFamilyPref = aValue;
       
    71             break;
       
    72         
       
    73         case MNATFWIceSettings::EPrefIpv6AddrFamily:
       
    74             iIpv6AddrFamilyPref = aValue;
       
    75             break;
       
    76 
       
    77         case MNATFWIceSettings::EPrefVpnInterface:
       
    78             iVpnInterfacePref = aValue;
       
    79             break;
       
    80 
       
    81         case MNATFWIceSettings::EPrefUdpTransport:
       
    82             iUdpTransportPref = aValue;
       
    83             break;
       
    84         
       
    85         case MNATFWIceSettings::EPrefTcpTransport:
       
    86             iTcpTransportPref = aValue;
       
    87             break;
       
    88 
       
    89         case MNATFWIceSettings::EPrefTcpDirectionActive:
       
    90             iTcpDirActivePref = aValue;
       
    91             break;
       
    92         
       
    93         case MNATFWIceSettings::EPrefTcpDirectionPassive:
       
    94             iTcpDirPassivePref = aValue;
       
    95             break;
       
    96         
       
    97         case MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen:
       
    98             iTcpDirSimultaneousOpenPref = aValue;
       
    99             break;
       
   100         
       
   101         default:
       
   102             return KErrNotSupported;
       
   103         }
       
   104     
       
   105     return KErrNone;
       
   106     }
       
   107 
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // TNATFWIcePreferences::GetPrefValue
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 TInt TNATFWIcePreferences::GetPrefValue( 
       
   114         MNATFWIceSettings::TPrefSetting aSetting, 
       
   115         TInt& aValue ) const
       
   116     {
       
   117     switch ( aSetting )
       
   118         {
       
   119         case MNATFWIceSettings::EPrefHostCandidate:
       
   120             aValue = iHostPref;
       
   121             break;
       
   122         
       
   123         case MNATFWIceSettings::EPrefServerReflexiveCandidate:
       
   124             aValue = iServerReflexivePref;
       
   125             break;
       
   126         
       
   127         case MNATFWIceSettings::EPrefRelayCandidate:
       
   128             aValue = iRelayPref;
       
   129             break;
       
   130         
       
   131         case MNATFWIceSettings::EPrefPeerReflexiveCandidate:
       
   132             aValue = iPeerReflexivePref;
       
   133             break;
       
   134         
       
   135         case MNATFWIceSettings::EPrefIpv4AddrFamily:
       
   136             aValue = iIpv4AddrFamilyPref;
       
   137             break;
       
   138         
       
   139         case MNATFWIceSettings::EPrefIpv6AddrFamily:
       
   140             aValue = iIpv6AddrFamilyPref;
       
   141             break;
       
   142 
       
   143         case MNATFWIceSettings::EPrefVpnInterface:
       
   144             aValue = iVpnInterfacePref;
       
   145             break;
       
   146 
       
   147         case MNATFWIceSettings::EPrefUdpTransport:
       
   148             aValue = iUdpTransportPref;
       
   149             break;
       
   150         
       
   151         case MNATFWIceSettings::EPrefTcpTransport:
       
   152             aValue = iTcpTransportPref;
       
   153             break;
       
   154 
       
   155         case MNATFWIceSettings::EPrefTcpDirectionActive:
       
   156             aValue = iTcpDirActivePref;
       
   157             break;
       
   158         
       
   159         case MNATFWIceSettings::EPrefTcpDirectionPassive:
       
   160             aValue = iTcpDirPassivePref;
       
   161             break;
       
   162         
       
   163         case MNATFWIceSettings::EPrefTcpDirectionSimultaneousOpen:
       
   164             aValue = iTcpDirSimultaneousOpenPref;
       
   165             break;
       
   166         
       
   167         default:
       
   168             return KErrNotSupported;
       
   169         }
       
   170     
       
   171     return KErrNone;
       
   172     }