natplugins/natpdevmgmtnatfwadapter/src/natfwdomainentry.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  Device Management NAT-FW Traversal domain specific settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <e32base.h>
       
    21 #include    "natfwdomainentry.h"
       
    22 #include    "natfwdefaults.h"
       
    23 
       
    24 const TInt KNotSet     = -1;
       
    25 _LIT8( KValueNotSet, "NotSet" );
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS =============================
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // CNATFWDomainEntry::NewL
       
    31 // 
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CNATFWDomainEntry* CNATFWDomainEntry::NewL()
       
    35     {
       
    36     CNATFWDomainEntry* self = NewLC();
       
    37     CleanupStack::Pop( self );
       
    38     return self;
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // CNATFWDomainEntry::NewLC
       
    43 // 
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CNATFWDomainEntry* CNATFWDomainEntry::NewLC()
       
    47     {
       
    48     CNATFWDomainEntry* self = new (ELeave) CNATFWDomainEntry();
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL();
       
    51     return self;
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CNATFWDomainEntry::CNATFWDomainEntry
       
    56 //
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CNATFWDomainEntry::CNATFWDomainEntry()
       
    60     {
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CNATFWDomainEntry::ConstructL
       
    65 //
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 void CNATFWDomainEntry::ConstructL()
       
    69     {
       
    70     iDomain                  = HBufC8::NewL( 0 );
       
    71     iSTUNServerAddr          = HBufC8::NewL( 0 );
       
    72     iSTUNServerPort          = KDefaultSTUNPort;
       
    73     iNATRefreshTCP           = KDefaultTCPRefreshInterval;
       
    74     iNATRefreshUDP           = KDefaultUDPRefreshInterval;
       
    75     iSTUNUsername            = HBufC8::NewL( 0 );
       
    76     iSTUNPassword            = HBufC8::NewL( 0 );
       
    77     iDisableStunSharedSecret = KNotSet;
       
    78     iStartPortRange          = KNotSet;
       
    79     iEndPortRange            = KNotSet;
       
    80     iUsedNatProtocol         = HBufC8::NewL( 0 );
       
    81     iNatUtilities            = HBufC8::NewL( 0 );
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // CNATFWDomainEntry::~CNATFWDomainEntry
       
    86 //
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 CNATFWDomainEntry::~CNATFWDomainEntry()
       
    90     {
       
    91     delete iDomain;
       
    92     delete iSTUNServerAddr;
       
    93     delete iSTUNUsername;
       
    94     delete iSTUNPassword;
       
    95     delete iUsedNatProtocol;
       
    96     delete iNatUtilities;
       
    97     iStunSrvAddrArray.ResetAndDestroy();
       
    98     iStunSrvPortArray.Close();
       
    99     iStunUsernameArray.ResetAndDestroy();
       
   100     iStunPasswordArray.ResetAndDestroy();
       
   101     iTurnSrvAddrArray.ResetAndDestroy();
       
   102     iTurnSrvPortArray.Close();
       
   103     iTurnUsernameArray.ResetAndDestroy();
       
   104     iTurnPasswordArray.ResetAndDestroy();
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CNATFWDomainEntry::SetDomainKey
       
   109 //
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 void CNATFWDomainEntry::SetDomainKey( TUint32 aDomainKey )
       
   113     {
       
   114     iDomainKey = aDomainKey;
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CNATFWDomainEntry::SetDomainL
       
   119 //
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 void CNATFWDomainEntry::SetDomainL( const TDesC8& aDomain )
       
   123     {
       
   124     HBufC8* temp = aDomain.AllocL();
       
   125     delete iDomain;
       
   126     iDomain = NULL;
       
   127     iDomain = temp;
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CNATFWDomainEntry::SetSTUNServerAddrL
       
   132 //
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 void CNATFWDomainEntry::SetSTUNServerAddrL( const TDesC8& aSTUNServerAddr )
       
   136     {
       
   137     HBufC8* temp = aSTUNServerAddr.AllocL();
       
   138     delete iSTUNServerAddr;
       
   139     iSTUNServerAddr = NULL;
       
   140     iSTUNServerAddr = temp;
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CNATFWDomainEntry::SetSTUNServerPort
       
   145 //
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void CNATFWDomainEntry::SetSTUNServerPort( TUint aSTUNServerPort )
       
   149     {
       
   150     iSTUNServerPort = aSTUNServerPort;
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // CNATFWDomainEntry::SetNATRefreshTCP
       
   155 //
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void CNATFWDomainEntry::SetNATRefreshTCP( TInt aNATRefreshTCP )
       
   159     {
       
   160     iNATRefreshTCP = aNATRefreshTCP;
       
   161     }
       
   162 
       
   163 // ---------------------------------------------------------------------------
       
   164 // CNATFWDomainEntry::SetNATRefreshUDP
       
   165 //
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void CNATFWDomainEntry::SetNATRefreshUDP( TInt aNATRefreshUDP )
       
   169     {
       
   170     iNATRefreshUDP = aNATRefreshUDP;
       
   171     }
       
   172 
       
   173 // ---------------------------------------------------------------------------
       
   174 // CNATFWDomainEntry::SetEnableCRLFRefresh
       
   175 //
       
   176 // ---------------------------------------------------------------------------
       
   177 //
       
   178 void CNATFWDomainEntry::SetEnableCRLFRefresh( TInt aEnableCRLFRefresh )
       
   179     {
       
   180     iEnableCRLFRefresh = aEnableCRLFRefresh;
       
   181     }
       
   182 
       
   183 // ---------------------------------------------------------------------------
       
   184 // CNATFWDomainEntry::GetDomain
       
   185 //
       
   186 // ---------------------------------------------------------------------------
       
   187 //
       
   188 const TDesC8& CNATFWDomainEntry::GetDomain() const
       
   189     {
       
   190     return *iDomain;
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CNATFWDomainEntry::GetDomainKey
       
   195 //
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 TUint32 CNATFWDomainEntry::GetDomainKey() const
       
   199     {
       
   200     return iDomainKey;
       
   201     }
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // CNATFWDomainEntry::GetSTUNAddr
       
   205 //
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 const TDesC8& CNATFWDomainEntry::GetSTUNAddr() const
       
   209     {
       
   210     return *iSTUNServerAddr;
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CNATFWDomainEntry::GetSTUNPort
       
   215 //
       
   216 // ---------------------------------------------------------------------------
       
   217 //
       
   218 TInt CNATFWDomainEntry::GetSTUNPort() const
       
   219     {
       
   220     return iSTUNServerPort;
       
   221     }
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // CNATFWDomainEntry::GetNATRefreshTCP
       
   225 //
       
   226 // ---------------------------------------------------------------------------
       
   227 //
       
   228 TInt CNATFWDomainEntry::GetNATRefreshTCP() const
       
   229     {
       
   230     return iNATRefreshTCP;
       
   231     }
       
   232 
       
   233 // ---------------------------------------------------------------------------
       
   234 // CNATFWDomainEntry::GetNATRefreshUDP
       
   235 //
       
   236 // ---------------------------------------------------------------------------
       
   237 //
       
   238 TInt CNATFWDomainEntry::GetNATRefreshUDP() const
       
   239     {
       
   240     return iNATRefreshUDP;
       
   241     }
       
   242 
       
   243 // ---------------------------------------------------------------------------
       
   244 // CNATFWDomainEntry::GetEnableCRLFRefresh
       
   245 //
       
   246 // ---------------------------------------------------------------------------
       
   247 //
       
   248 TInt CNATFWDomainEntry::GetEnableCRLFRefresh() const
       
   249     {
       
   250     return iEnableCRLFRefresh;
       
   251     }
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // CNATFWDomainEntry::SetSTUNUsernameL
       
   255 //
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 void CNATFWDomainEntry::SetSTUNUsernameL( const TDesC8& aSTUNUsername )
       
   259     {
       
   260     HBufC8* temp = aSTUNUsername.AllocL();
       
   261     delete iSTUNUsername;
       
   262     iSTUNUsername = NULL;
       
   263     iSTUNUsername = temp;
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // CNATFWDomainEntry::SetSTUNPasswordL
       
   268 //
       
   269 // ---------------------------------------------------------------------------
       
   270 //
       
   271 void CNATFWDomainEntry::SetSTUNPasswordL( const TDesC8& aSTUNPassword )
       
   272     {
       
   273     HBufC8* temp = aSTUNPassword.AllocL();
       
   274     delete iSTUNPassword;
       
   275     iSTUNPassword = NULL;
       
   276     iSTUNPassword = temp;
       
   277     }
       
   278 
       
   279 // ----------------------------------------------------------------------------
       
   280 // CNATFWDomainEntry::AddStunSrvAddrL
       
   281 //
       
   282 // ----------------------------------------------------------------------------
       
   283 //
       
   284 void CNATFWDomainEntry::AddStunSrvAddrL( const TDesC8& aStunSrvAddr )
       
   285     {
       
   286     HBufC8* temp = aStunSrvAddr.AllocLC();
       
   287     iStunSrvAddrArray.AppendL( temp );
       
   288     CleanupStack::Pop( temp );
       
   289     }
       
   290 
       
   291 // ----------------------------------------------------------------------------
       
   292 // CNATFWDomainEntry::AddStunSrvPortL
       
   293 //
       
   294 // ----------------------------------------------------------------------------
       
   295 //
       
   296 void CNATFWDomainEntry::AddStunSrvPortL( TInt aStunSrvPort )
       
   297     {
       
   298     iStunSrvPortArray.AppendL( aStunSrvPort );
       
   299     }
       
   300 
       
   301 // ----------------------------------------------------------------------------
       
   302 // CNATFWDomainEntry::AddStunUsernameL
       
   303 //
       
   304 // ----------------------------------------------------------------------------
       
   305 //
       
   306 void CNATFWDomainEntry::AddStunUsernameL( const TDesC8& aStunUsername )
       
   307     {
       
   308     HBufC8* temp = aStunUsername.AllocLC();
       
   309     iStunUsernameArray.AppendL( temp );
       
   310     CleanupStack::Pop( temp );
       
   311     }
       
   312 
       
   313 // ----------------------------------------------------------------------------
       
   314 // CNATFWDomainEntry::AddStunPasswordL
       
   315 //
       
   316 // ----------------------------------------------------------------------------
       
   317 //
       
   318 void CNATFWDomainEntry::AddStunPasswordL( const TDesC8& aStunPassword )
       
   319     {
       
   320     HBufC8* temp = aStunPassword.AllocLC();
       
   321     iStunPasswordArray.AppendL( temp );
       
   322     CleanupStack::Pop( temp );
       
   323     }
       
   324 
       
   325 // ----------------------------------------------------------------------------
       
   326 // CNATFWDomainEntry::SetDisableStunSharedSecret
       
   327 //
       
   328 // ----------------------------------------------------------------------------
       
   329 //
       
   330 void CNATFWDomainEntry::SetDisableStunSharedSecret( 
       
   331     TInt aDisableStunSharedSecret )
       
   332     {
       
   333     iDisableStunSharedSecret = aDisableStunSharedSecret;
       
   334     }
       
   335 
       
   336 // ---------------------------------------------------------------------------
       
   337 // CNATFWDomainEntry::SetStartPortRange
       
   338 // 
       
   339 // ---------------------------------------------------------------------------
       
   340 //
       
   341 void CNATFWDomainEntry::SetStartPortRange( TInt aStartPortRange )
       
   342     {
       
   343     iStartPortRange = aStartPortRange;
       
   344     }
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // CNATFWDomainEntry::SetEndPortRange
       
   348 // 
       
   349 // ---------------------------------------------------------------------------
       
   350 //
       
   351 void CNATFWDomainEntry::SetEndPortRange( TInt aEndPortRange )
       
   352     {
       
   353     iEndPortRange = aEndPortRange;
       
   354     }
       
   355 
       
   356 // ---------------------------------------------------------------------------
       
   357 // CNATFWDomainEntry::SetNatProtocolL
       
   358 // 
       
   359 // ---------------------------------------------------------------------------
       
   360 //
       
   361 void CNATFWDomainEntry::SetNatProtocolL( const TDesC8& aNatProtocol )
       
   362     {
       
   363     HBufC8* temp = aNatProtocol.AllocL();
       
   364     delete iUsedNatProtocol;
       
   365     iUsedNatProtocol = NULL;
       
   366     iUsedNatProtocol = temp;
       
   367     }
       
   368 
       
   369 // ----------------------------------------------------------------------------
       
   370 // CNATFWDomainEntry::SetNatUtilitiesL
       
   371 //
       
   372 // ----------------------------------------------------------------------------
       
   373 //
       
   374 void CNATFWDomainEntry::SetNatUtilitiesL( const TDesC8& aNatUtilities )
       
   375     {
       
   376     HBufC8* temp = aNatUtilities.AllocL();
       
   377     delete iNatUtilities;
       
   378     iNatUtilities = NULL;
       
   379     iNatUtilities = temp;
       
   380     }
       
   381 
       
   382 // ----------------------------------------------------------------------------
       
   383 // CNATFWDomainEntry::SetHostPref
       
   384 //
       
   385 // ----------------------------------------------------------------------------
       
   386 //
       
   387 void CNATFWDomainEntry::SetHostPref( TInt aHostPref )
       
   388     {
       
   389     iHostPref = aHostPref;
       
   390     }
       
   391 
       
   392 // ----------------------------------------------------------------------------
       
   393 // CNATFWDomainEntry::SetServerReflexPref
       
   394 //
       
   395 // ----------------------------------------------------------------------------
       
   396 //
       
   397 void CNATFWDomainEntry::SetServerReflexPref( TInt aServerReflexPref )
       
   398     {
       
   399     iServerReflexPref = aServerReflexPref;
       
   400     }
       
   401 
       
   402 // ----------------------------------------------------------------------------
       
   403 // CNATFWDomainEntry::SetRelayPref
       
   404 //
       
   405 // ----------------------------------------------------------------------------
       
   406 //
       
   407 void CNATFWDomainEntry::SetRelayPref( TInt aRelayPref )
       
   408     {
       
   409     iRelayPref = aRelayPref;
       
   410     }
       
   411 
       
   412 // ----------------------------------------------------------------------------
       
   413 // CNATFWDomainEntry::SetPeerReflexPref
       
   414 //
       
   415 // ----------------------------------------------------------------------------
       
   416 //
       
   417 void CNATFWDomainEntry::SetPeerReflexPref( TInt aPeerReflexPref )
       
   418     {
       
   419     iPeerReflexPref = aPeerReflexPref;
       
   420     }
       
   421 
       
   422 // ----------------------------------------------------------------------------
       
   423 // CNATFWDomainEntry::SetIPv4Pref
       
   424 //
       
   425 // ----------------------------------------------------------------------------
       
   426 //
       
   427 void CNATFWDomainEntry::SetIPv4Pref( TInt aIPv4Pref )
       
   428     {
       
   429     iIPv4Pref = aIPv4Pref;
       
   430     }
       
   431 
       
   432 // ----------------------------------------------------------------------------
       
   433 // CNATFWDomainEntry::SetIPv6Pref
       
   434 //
       
   435 // ----------------------------------------------------------------------------
       
   436 //
       
   437 void CNATFWDomainEntry::SetIPv6Pref( TInt aIPv6Pref )
       
   438     {
       
   439     iIPv6Pref = aIPv6Pref;
       
   440     }
       
   441 
       
   442 // ----------------------------------------------------------------------------
       
   443 // CNATFWDomainEntry::SetVpnPref
       
   444 //
       
   445 // ----------------------------------------------------------------------------
       
   446 //
       
   447 void CNATFWDomainEntry::SetVpnPref( TInt aVpnPref )
       
   448     {
       
   449     iVpnPref = aVpnPref;
       
   450     }
       
   451 
       
   452 // ----------------------------------------------------------------------------
       
   453 // CNATFWDomainEntry::SetUdpPref
       
   454 //
       
   455 // ----------------------------------------------------------------------------
       
   456 //
       
   457 void CNATFWDomainEntry::SetUdpPref( TInt aUdpPref )
       
   458     {
       
   459     iUdpPref = aUdpPref;
       
   460     }
       
   461 
       
   462 // ----------------------------------------------------------------------------
       
   463 // CNATFWDomainEntry::SetTcpPref
       
   464 //
       
   465 // ----------------------------------------------------------------------------
       
   466 //
       
   467 void CNATFWDomainEntry::SetTcpPref( TInt aTcpPref )
       
   468     {
       
   469     iTcpPref = aTcpPref;
       
   470     }
       
   471 
       
   472 // ----------------------------------------------------------------------------
       
   473 // CNATFWDomainEntry::SetTcpActivePref
       
   474 //
       
   475 // ----------------------------------------------------------------------------
       
   476 //
       
   477 void CNATFWDomainEntry::SetTcpActivePref( TInt aTcpActivePref )
       
   478     {
       
   479     iTcpActivePref = aTcpActivePref;
       
   480     }
       
   481 
       
   482 // ----------------------------------------------------------------------------
       
   483 // CNATFWDomainEntry::SetTcpPassivePref
       
   484 //
       
   485 // ----------------------------------------------------------------------------
       
   486 //
       
   487 void CNATFWDomainEntry::SetTcpPassivePref( TInt aTcpPassivePref )
       
   488     {
       
   489     iTcpPassivePref = aTcpPassivePref;
       
   490     }
       
   491 
       
   492 // ----------------------------------------------------------------------------
       
   493 // CNATFWDomainEntry::SetTcpSimultPref
       
   494 //
       
   495 // ----------------------------------------------------------------------------
       
   496 //
       
   497 void CNATFWDomainEntry::SetTcpSimultPref( TInt aTcpSimultPref )
       
   498     {
       
   499     iTcpSimultPref = aTcpSimultPref;
       
   500     }
       
   501 
       
   502 // ----------------------------------------------------------------------------
       
   503 // CNATFWDomainEntry::AddTurnSrvAddrL
       
   504 //
       
   505 // ----------------------------------------------------------------------------
       
   506 //
       
   507 void CNATFWDomainEntry::AddTurnSrvAddrL( const TDesC8& aTurnSrvAddr )
       
   508     {
       
   509     HBufC8* temp = aTurnSrvAddr.AllocLC();
       
   510     iTurnSrvAddrArray.AppendL( temp );
       
   511     CleanupStack::Pop( temp );
       
   512     }
       
   513 
       
   514 // ----------------------------------------------------------------------------
       
   515 // CNATFWDomainEntry::AddTurnSrvPortL
       
   516 //
       
   517 // ----------------------------------------------------------------------------
       
   518 //
       
   519 void CNATFWDomainEntry::AddTurnSrvPortL( TInt aTurnSrvPort )
       
   520     {
       
   521     iTurnSrvPortArray.AppendL( aTurnSrvPort );
       
   522     }
       
   523 
       
   524 // ----------------------------------------------------------------------------
       
   525 // CNATFWDomainEntry::AddTurnUsernameL
       
   526 //
       
   527 // ----------------------------------------------------------------------------
       
   528 //
       
   529 void CNATFWDomainEntry::AddTurnUsernameL( const TDesC8& aTurnUsername )
       
   530     {
       
   531     HBufC8* temp = aTurnUsername.AllocLC();
       
   532     iTurnUsernameArray.AppendL( temp );
       
   533     CleanupStack::Pop( temp );
       
   534     }
       
   535 
       
   536 // ----------------------------------------------------------------------------
       
   537 // CNATFWDomainEntry::AddTurnPasswordL
       
   538 //
       
   539 // ----------------------------------------------------------------------------
       
   540 //
       
   541 void CNATFWDomainEntry::AddTurnPasswordL( const TDesC8& aTurnPassword )
       
   542     {
       
   543     HBufC8* temp = aTurnPassword.AllocLC();
       
   544     iTurnPasswordArray.AppendL( temp );
       
   545     CleanupStack::Pop( temp );
       
   546     }
       
   547 
       
   548 // ---------------------------------------------------------------------------
       
   549 // CNATFWDomainEntry::UpdateStunSrvAddrL()
       
   550 //
       
   551 // ---------------------------------------------------------------------------
       
   552 //
       
   553 TInt CNATFWDomainEntry::UpdateStunSrvAddrL( TInt aIndex, const TDesC8& aAddr )
       
   554     {
       
   555     if ( aIndex < 0 || aIndex >= iStunSrvAddrArray.Count() )
       
   556         {
       
   557         return KErrArgument;
       
   558         }
       
   559     HBufC8* temp = aAddr.AllocLC();
       
   560     delete iStunSrvAddrArray[ aIndex ];
       
   561     iStunSrvAddrArray.Remove( aIndex );
       
   562     iStunSrvAddrArray.Compress();
       
   563     iStunSrvAddrArray.InsertL( temp, aIndex );
       
   564     CleanupStack::Pop( temp );
       
   565     
       
   566     return KErrNone;
       
   567     }
       
   568 
       
   569 // ---------------------------------------------------------------------------
       
   570 // CNATFWDomainEntry::UpdateStunSrvPort()
       
   571 //
       
   572 // ---------------------------------------------------------------------------
       
   573 //
       
   574 TInt CNATFWDomainEntry::UpdateStunSrvPort( TInt aIndex, TInt aPort )
       
   575     {
       
   576     if ( aIndex < 0 || aIndex >= iStunSrvPortArray.Count() )
       
   577         {
       
   578         return KErrArgument;
       
   579         }
       
   580     iStunSrvPortArray[aIndex] = aPort;
       
   581     return KErrNone;
       
   582     }
       
   583 
       
   584 // ---------------------------------------------------------------------------
       
   585 // CNATFWDomainEntry::UpdateStunUsernameL()
       
   586 //
       
   587 // ---------------------------------------------------------------------------
       
   588 //
       
   589 TInt CNATFWDomainEntry::UpdateStunUsernameL( TInt aIndex, 
       
   590     const TDesC8& aUsername )
       
   591     {
       
   592     if ( aIndex < 0 || aIndex >= iStunUsernameArray.Count() )
       
   593         {
       
   594         return KErrArgument;
       
   595         }
       
   596     HBufC8* temp = aUsername.AllocLC();
       
   597     delete iStunUsernameArray[ aIndex ];
       
   598     iStunUsernameArray.Remove( aIndex );
       
   599     iStunUsernameArray.Compress();
       
   600     iStunUsernameArray.InsertL( temp, aIndex );
       
   601     CleanupStack::Pop( temp );
       
   602     
       
   603     return KErrNone;
       
   604     }
       
   605 
       
   606 // ---------------------------------------------------------------------------
       
   607 // CNATFWDomainEntry::UpdateStunPasswordL()
       
   608 //
       
   609 // ---------------------------------------------------------------------------
       
   610 //
       
   611 TInt CNATFWDomainEntry::UpdateStunPasswordL( TInt aIndex,
       
   612     const TDesC8& aPassword )
       
   613     {
       
   614     if ( aIndex < 0 || aIndex >= iStunPasswordArray.Count() )
       
   615         {
       
   616         return KErrArgument;
       
   617         }
       
   618     HBufC8* temp = aPassword.AllocLC();
       
   619     delete iStunPasswordArray[ aIndex ];
       
   620     iStunPasswordArray.Remove( aIndex );
       
   621     iStunPasswordArray.Compress();
       
   622     iStunPasswordArray.InsertL( temp, aIndex );
       
   623     CleanupStack::Pop( temp );
       
   624     
       
   625     return KErrNone;
       
   626     }
       
   627 
       
   628 // ---------------------------------------------------------------------------
       
   629 // CNATFWDomainEntry::UpdateTurnSrvAddrL()
       
   630 //
       
   631 // ---------------------------------------------------------------------------
       
   632 //
       
   633 TInt CNATFWDomainEntry::UpdateTurnSrvAddrL( TInt aIndex, const TDesC8& aAddr )
       
   634     {
       
   635     if ( aIndex < 0 || aIndex >= iTurnSrvAddrArray.Count() )
       
   636         {
       
   637         return KErrArgument;
       
   638         }
       
   639     HBufC8* temp = aAddr.AllocLC();
       
   640     delete iTurnSrvAddrArray[ aIndex ];
       
   641     iTurnSrvAddrArray.Remove( aIndex );
       
   642     iTurnSrvAddrArray.Compress();
       
   643     iTurnSrvAddrArray.InsertL( temp, aIndex );
       
   644     CleanupStack::Pop( temp );
       
   645     
       
   646     return KErrNone;
       
   647     }
       
   648 
       
   649 // ---------------------------------------------------------------------------
       
   650 // CNATFWDomainEntry::UpdateTurnSrvPort()
       
   651 //
       
   652 // ---------------------------------------------------------------------------
       
   653 //
       
   654 TInt CNATFWDomainEntry::UpdateTurnSrvPort( TInt aIndex, TInt aPort )
       
   655     {
       
   656     if ( aIndex < 0 || aIndex >= iTurnSrvPortArray.Count() )
       
   657         {
       
   658         return KErrArgument;
       
   659         }
       
   660     iTurnSrvPortArray[aIndex] = aPort;
       
   661     return KErrNone;
       
   662     }
       
   663 
       
   664 // ---------------------------------------------------------------------------
       
   665 // CNATFWDomainEntry::UpdateTurnUsernameL()
       
   666 //
       
   667 // ---------------------------------------------------------------------------
       
   668 //
       
   669 TInt CNATFWDomainEntry::UpdateTurnUsernameL( TInt aIndex,
       
   670     const TDesC8& aUsername )
       
   671     {
       
   672     if ( aIndex < 0 || aIndex >= iTurnUsernameArray.Count() )
       
   673         {
       
   674         return KErrArgument;
       
   675         }
       
   676     HBufC8* temp = aUsername.AllocLC();
       
   677     delete iTurnUsernameArray[ aIndex ];
       
   678     iTurnUsernameArray.Remove( aIndex );
       
   679     iTurnUsernameArray.Compress();
       
   680     iTurnUsernameArray.InsertL( temp, aIndex );
       
   681     CleanupStack::Pop( temp );
       
   682     
       
   683     return KErrNone;
       
   684     }
       
   685 
       
   686 // ---------------------------------------------------------------------------
       
   687 // CNATFWDomainEntry::UpdateTurnPasswordL()
       
   688 //
       
   689 // ---------------------------------------------------------------------------
       
   690 //
       
   691 TInt CNATFWDomainEntry::UpdateTurnPasswordL( TInt aIndex,
       
   692     const TDesC8& aPassword )
       
   693     {
       
   694     if ( aIndex < 0 || aIndex >= iTurnPasswordArray.Count() )
       
   695         {
       
   696         return KErrArgument;
       
   697         }
       
   698     HBufC8* temp = aPassword.AllocLC();
       
   699     delete iTurnPasswordArray[ aIndex ];
       
   700     iTurnPasswordArray.Remove( aIndex );
       
   701     iTurnPasswordArray.Compress();
       
   702     iTurnPasswordArray.InsertL( temp, aIndex );
       
   703     CleanupStack::Pop( temp );
       
   704     
       
   705     return KErrNone;
       
   706     }
       
   707 
       
   708 // ---------------------------------------------------------------------------
       
   709 // CNATFWDomainEntry::RemoveStunSrvAddr()
       
   710 //
       
   711 // ---------------------------------------------------------------------------
       
   712 //
       
   713 TInt CNATFWDomainEntry::RemoveStunSrvAddr( TInt aIndex )
       
   714     {
       
   715     if ( aIndex < 0 || aIndex >= iStunSrvAddrArray.Count() )
       
   716         {
       
   717         return KErrArgument;
       
   718         }
       
   719     delete iStunSrvAddrArray[ aIndex ];
       
   720     iStunSrvAddrArray.Remove( aIndex );
       
   721     iStunSrvAddrArray.Compress();
       
   722     return KErrNone;
       
   723     }
       
   724 
       
   725 // ---------------------------------------------------------------------------
       
   726 // CNATFWDomainEntry::RemoveStunSrvPort()
       
   727 //
       
   728 // ---------------------------------------------------------------------------
       
   729 //
       
   730 TInt CNATFWDomainEntry::RemoveStunSrvPort( TInt aIndex )
       
   731     {
       
   732     if ( aIndex < 0 || aIndex >= iStunSrvPortArray.Count() )
       
   733         {
       
   734         return KErrArgument;
       
   735         }
       
   736     iStunSrvPortArray.Remove( aIndex );
       
   737     iStunSrvPortArray.Compress();
       
   738     return KErrNone;
       
   739     }
       
   740 
       
   741 // ---------------------------------------------------------------------------
       
   742 // CNATFWDomainEntry::RemoveStunUsername()
       
   743 //
       
   744 // ---------------------------------------------------------------------------
       
   745 //
       
   746 TInt CNATFWDomainEntry::RemoveStunUsername( TInt aIndex )
       
   747     {
       
   748     if ( aIndex < 0 || aIndex >= iStunUsernameArray.Count() )
       
   749         {
       
   750         return KErrArgument;
       
   751         }
       
   752     delete iStunUsernameArray[ aIndex ];
       
   753     iStunUsernameArray.Remove( aIndex );
       
   754     iStunUsernameArray.Compress();
       
   755     return KErrNone;
       
   756     }
       
   757 
       
   758 // ---------------------------------------------------------------------------
       
   759 // CNATFWDomainEntry::RemoveStunPassword()
       
   760 //
       
   761 // ---------------------------------------------------------------------------
       
   762 //
       
   763 TInt CNATFWDomainEntry::RemoveStunPassword( TInt aIndex )
       
   764     {
       
   765     if ( aIndex < 0 || aIndex >= iStunPasswordArray.Count() )
       
   766         {
       
   767         return KErrArgument;
       
   768         }
       
   769     delete iStunPasswordArray[ aIndex ];
       
   770     iStunPasswordArray.Remove( aIndex );
       
   771     iStunPasswordArray.Compress();
       
   772     return KErrNone;
       
   773     }
       
   774 
       
   775 // ---------------------------------------------------------------------------
       
   776 // CNATFWDomainEntry::RemoveTurnSrvAddr()
       
   777 //
       
   778 // ---------------------------------------------------------------------------
       
   779 //
       
   780 TInt CNATFWDomainEntry::RemoveTurnSrvAddr( TInt aIndex )
       
   781     {
       
   782     if ( aIndex < 0 || aIndex >= iTurnSrvAddrArray.Count() )
       
   783         {
       
   784         return KErrArgument;
       
   785         }
       
   786     delete iTurnSrvAddrArray[ aIndex ];
       
   787     iTurnSrvAddrArray.Remove( aIndex );
       
   788     iTurnSrvAddrArray.Compress();
       
   789     return KErrNone;
       
   790     }
       
   791 
       
   792 // ---------------------------------------------------------------------------
       
   793 // CNATFWDomainEntry::RemoveTurnSrvPort()
       
   794 //
       
   795 // ---------------------------------------------------------------------------
       
   796 //
       
   797 TInt CNATFWDomainEntry::RemoveTurnSrvPort( TInt aIndex )
       
   798     {
       
   799     if ( aIndex < 0 || aIndex >= iTurnSrvPortArray.Count() )
       
   800         {
       
   801         return KErrArgument;
       
   802         }
       
   803     iTurnSrvPortArray.Remove( aIndex );
       
   804     iTurnSrvPortArray.Compress();
       
   805     return KErrNone;
       
   806     }
       
   807 
       
   808 // ---------------------------------------------------------------------------
       
   809 // CNATFWDomainEntry::RemoveTurnUsername()
       
   810 //
       
   811 // ---------------------------------------------------------------------------
       
   812 //
       
   813 TInt CNATFWDomainEntry::RemoveTurnUsername( TInt aIndex )
       
   814     {
       
   815     if ( aIndex < 0 || aIndex >= iTurnUsernameArray.Count() )
       
   816         {
       
   817         return KErrArgument;
       
   818         }
       
   819     delete iTurnUsernameArray[ aIndex ];
       
   820     iTurnUsernameArray.Remove( aIndex );
       
   821     iTurnUsernameArray.Compress();
       
   822     return KErrNone;
       
   823     }
       
   824 
       
   825 // ---------------------------------------------------------------------------
       
   826 // CNATFWDomainEntry::RemoveTurnPassword()
       
   827 //
       
   828 // ---------------------------------------------------------------------------
       
   829 //
       
   830 TInt CNATFWDomainEntry::RemoveTurnPassword( TInt aIndex )
       
   831     {
       
   832     if ( aIndex < 0 || aIndex >= iTurnPasswordArray.Count() )
       
   833         {
       
   834         return KErrArgument;
       
   835         }
       
   836     delete iTurnPasswordArray[ aIndex ];
       
   837     iTurnPasswordArray.Remove( aIndex );
       
   838     iTurnPasswordArray.Compress();
       
   839     return KErrNone;
       
   840     }
       
   841 
       
   842 // ---------------------------------------------------------------------------
       
   843 // CNATFWDomainEntry::GetSTUNUsername
       
   844 //
       
   845 // ---------------------------------------------------------------------------
       
   846 //
       
   847 const TDesC8& CNATFWDomainEntry::GetSTUNUsername() const
       
   848     {
       
   849     return *iSTUNUsername;
       
   850     }
       
   851 
       
   852 // ---------------------------------------------------------------------------
       
   853 // CNATFWDomainEntry::GetSTUNPassword
       
   854 //
       
   855 // ---------------------------------------------------------------------------
       
   856 //
       
   857 const TDesC8& CNATFWDomainEntry::GetSTUNPassword() const
       
   858     {
       
   859     return *iSTUNPassword;
       
   860     }
       
   861 
       
   862 // ----------------------------------------------------------------------------
       
   863 // CNATFWDomainEntry::StunSrvAddrL
       
   864 //
       
   865 // ----------------------------------------------------------------------------
       
   866 //
       
   867 const TDesC8& CNATFWDomainEntry::StunSrvAddrL( TInt aIndex ) const
       
   868     {
       
   869     if ( aIndex < iStunSrvAddrArray.Count() && aIndex >= 0 )
       
   870         {
       
   871         return *( iStunSrvAddrArray[aIndex] );
       
   872         }
       
   873     return *( KValueNotSet().AllocL() );
       
   874     }
       
   875 
       
   876 // ----------------------------------------------------------------------------
       
   877 // CNATFWDomainEntry::StunSrvPort
       
   878 //
       
   879 // ----------------------------------------------------------------------------
       
   880 //
       
   881 TInt CNATFWDomainEntry::StunSrvPort( TInt aIndex ) const
       
   882     {
       
   883     if ( aIndex < iStunSrvPortArray.Count() && aIndex >= 0 )
       
   884         {
       
   885         return iStunSrvPortArray[aIndex];
       
   886         }
       
   887     return KErrNotFound;
       
   888     }
       
   889 
       
   890 // ----------------------------------------------------------------------------
       
   891 // CNATFWDomainEntry::StunUsernameL
       
   892 //
       
   893 // ----------------------------------------------------------------------------
       
   894 //
       
   895 const TDesC8& CNATFWDomainEntry::StunUsernameL( TInt aIndex ) const
       
   896     {
       
   897     if ( aIndex < iStunUsernameArray.Count() && aIndex >= 0 )
       
   898         {
       
   899         return *( iStunUsernameArray[aIndex] );
       
   900         }
       
   901     return *( KValueNotSet().AllocL() );
       
   902     }
       
   903 
       
   904 // ----------------------------------------------------------------------------
       
   905 // CNATFWDomainEntry::StunPasswordL
       
   906 //
       
   907 // ----------------------------------------------------------------------------
       
   908 //
       
   909 const TDesC8& CNATFWDomainEntry::StunPasswordL( TInt aIndex ) const
       
   910     {
       
   911     if ( aIndex < iStunPasswordArray.Count() && aIndex >= 0 )
       
   912         {
       
   913         return *( iStunPasswordArray[aIndex] );
       
   914         }
       
   915     return *( KValueNotSet().AllocL() );
       
   916     }
       
   917 
       
   918 
       
   919 // ----------------------------------------------------------------------------
       
   920 // CNATFWDomainEntry::DisableStunSharedSecret
       
   921 //
       
   922 // ----------------------------------------------------------------------------
       
   923 //
       
   924 TInt CNATFWDomainEntry::DisableStunSharedSecret() const
       
   925     {
       
   926     return iDisableStunSharedSecret;
       
   927     }
       
   928 
       
   929 // ---------------------------------------------------------------------------
       
   930 // CNATFWDomainEntry::StartPortRange
       
   931 // 
       
   932 // ---------------------------------------------------------------------------
       
   933 //
       
   934 TInt CNATFWDomainEntry::StartPortRange() const
       
   935     {
       
   936     return iStartPortRange;
       
   937     }
       
   938 
       
   939 // ---------------------------------------------------------------------------
       
   940 // CNATFWDomainEntry::EndPortRange
       
   941 // 
       
   942 // ---------------------------------------------------------------------------
       
   943 //
       
   944 TInt CNATFWDomainEntry::EndPortRange() const
       
   945     {
       
   946     return iEndPortRange;
       
   947     }
       
   948 
       
   949 // ---------------------------------------------------------------------------
       
   950 // CNATFWDomainEntry::UsedNatProtocol
       
   951 // 
       
   952 // ---------------------------------------------------------------------------
       
   953 //
       
   954 const TDesC8& CNATFWDomainEntry::UsedNatProtocol() const
       
   955     {
       
   956     return *iUsedNatProtocol;
       
   957     }
       
   958 
       
   959 // ----------------------------------------------------------------------------
       
   960 // CNATFWDomainEntry::NatUtilities
       
   961 //
       
   962 // ----------------------------------------------------------------------------
       
   963 //
       
   964 const TDesC8& CNATFWDomainEntry::NatUtilities() const
       
   965     {
       
   966     return *iNatUtilities;
       
   967     }
       
   968 
       
   969 // ----------------------------------------------------------------------------
       
   970 // CNATFWDomainEntry::HostPref
       
   971 //
       
   972 // ----------------------------------------------------------------------------
       
   973 //
       
   974 TInt CNATFWDomainEntry::HostPref() const
       
   975     {
       
   976     return iHostPref;
       
   977     }
       
   978 
       
   979 // ----------------------------------------------------------------------------
       
   980 // CNATFWDomainEntry::ServerReflexPref
       
   981 //
       
   982 // ----------------------------------------------------------------------------
       
   983 //
       
   984 TInt CNATFWDomainEntry::ServerReflexPref() const
       
   985     {
       
   986     return iServerReflexPref;
       
   987     }
       
   988 
       
   989 // ----------------------------------------------------------------------------
       
   990 // CNATFWDomainEntry::RelayPref
       
   991 //
       
   992 // ----------------------------------------------------------------------------
       
   993 //
       
   994 TInt CNATFWDomainEntry::RelayPref() const
       
   995     {
       
   996     return iRelayPref;
       
   997     }
       
   998 
       
   999 // ----------------------------------------------------------------------------
       
  1000 // CNATFWDomainEntry::PeerReflexPref
       
  1001 //
       
  1002 // ----------------------------------------------------------------------------
       
  1003 //
       
  1004 TInt CNATFWDomainEntry::PeerReflexPref() const
       
  1005     {
       
  1006     return iPeerReflexPref;
       
  1007     }
       
  1008 
       
  1009 // ----------------------------------------------------------------------------
       
  1010 // CNATFWDomainEntry::IPv4Pref
       
  1011 //
       
  1012 // ----------------------------------------------------------------------------
       
  1013 //
       
  1014 TInt CNATFWDomainEntry::IPv4Pref() const
       
  1015     {
       
  1016     return iIPv4Pref;
       
  1017     }
       
  1018 
       
  1019 // ----------------------------------------------------------------------------
       
  1020 // CNATFWDomainEntry::IPv6Pref
       
  1021 //
       
  1022 // ----------------------------------------------------------------------------
       
  1023 //
       
  1024 TInt CNATFWDomainEntry::IPv6Pref() const
       
  1025     {
       
  1026     return iIPv6Pref;
       
  1027     }
       
  1028 
       
  1029 // ----------------------------------------------------------------------------
       
  1030 // CNATFWDomainEntry::VpnPref
       
  1031 //
       
  1032 // ----------------------------------------------------------------------------
       
  1033 //
       
  1034 TInt CNATFWDomainEntry::VpnPref() const
       
  1035     {
       
  1036     return iVpnPref;
       
  1037     }
       
  1038 
       
  1039 // ----------------------------------------------------------------------------
       
  1040 // CNATFWDomainEntry::UdpPref
       
  1041 //
       
  1042 // ----------------------------------------------------------------------------
       
  1043 //
       
  1044 TInt CNATFWDomainEntry::UdpPref() const
       
  1045     {
       
  1046     return iUdpPref;
       
  1047     }
       
  1048 
       
  1049 // ----------------------------------------------------------------------------
       
  1050 // CNATFWDomainEntry::TcpPref
       
  1051 //
       
  1052 // ----------------------------------------------------------------------------
       
  1053 //
       
  1054 TInt CNATFWDomainEntry::TcpPref() const
       
  1055     {
       
  1056     return iTcpPref;
       
  1057     }
       
  1058 
       
  1059 // ----------------------------------------------------------------------------
       
  1060 // CNATFWDomainEntry::TcpActivePref
       
  1061 //
       
  1062 // ----------------------------------------------------------------------------
       
  1063 //
       
  1064 TInt CNATFWDomainEntry::TcpActivePref() const
       
  1065     {
       
  1066     return iTcpActivePref;
       
  1067     }
       
  1068 
       
  1069 // ----------------------------------------------------------------------------
       
  1070 // CNATFWDomainEntry::TcpPassivePref
       
  1071 //
       
  1072 // ----------------------------------------------------------------------------
       
  1073 //
       
  1074 TInt CNATFWDomainEntry::TcpPassivePref() const
       
  1075     {
       
  1076     return iTcpPassivePref;
       
  1077     }
       
  1078 
       
  1079 // ----------------------------------------------------------------------------
       
  1080 // CNATFWDomainEntry::TcpSimultPref
       
  1081 //
       
  1082 // ----------------------------------------------------------------------------
       
  1083 //
       
  1084 TInt CNATFWDomainEntry::TcpSimultPref() const
       
  1085     {
       
  1086     return iTcpSimultPref;
       
  1087     }
       
  1088 
       
  1089 // ----------------------------------------------------------------------------
       
  1090 // CNATFWDomainEntry::TurnSrvAddrL
       
  1091 //
       
  1092 // ----------------------------------------------------------------------------
       
  1093 //
       
  1094 const TDesC8& CNATFWDomainEntry::TurnSrvAddrL( TInt aIndex ) const
       
  1095     {
       
  1096     if ( aIndex < iTurnSrvAddrArray.Count() && aIndex >= 0 )
       
  1097         {
       
  1098         return *( iTurnSrvAddrArray[aIndex] );
       
  1099         }
       
  1100     return *( KValueNotSet().AllocL() );
       
  1101     }
       
  1102 
       
  1103 // ----------------------------------------------------------------------------
       
  1104 // CNATFWDomainEntry::TurnSrvPort
       
  1105 //
       
  1106 // ----------------------------------------------------------------------------
       
  1107 //
       
  1108 TInt CNATFWDomainEntry::TurnSrvPort( TInt aIndex ) const
       
  1109     {
       
  1110     if ( aIndex < iTurnSrvPortArray.Count() && aIndex >= 0 )
       
  1111         {
       
  1112         return iTurnSrvPortArray[aIndex];
       
  1113         }
       
  1114     return KErrNotFound;
       
  1115     }
       
  1116 
       
  1117 // ----------------------------------------------------------------------------
       
  1118 // CNATFWDomainEntry::TurnUsernameL
       
  1119 //
       
  1120 // ----------------------------------------------------------------------------
       
  1121 //
       
  1122 const TDesC8& CNATFWDomainEntry::TurnUsernameL( TInt aIndex ) const
       
  1123     {
       
  1124     if ( aIndex < iTurnUsernameArray.Count() && aIndex >= 0 )
       
  1125         {
       
  1126         return *( iTurnUsernameArray[aIndex] );
       
  1127         }
       
  1128     return *( KValueNotSet().AllocL() );
       
  1129     }
       
  1130 
       
  1131 // ----------------------------------------------------------------------------
       
  1132 // CNATFWDomainEntry::TurnPasswordL
       
  1133 //
       
  1134 // ----------------------------------------------------------------------------
       
  1135 //
       
  1136 const TDesC8& CNATFWDomainEntry::TurnPasswordL( TInt aIndex ) const
       
  1137     {
       
  1138     if ( aIndex < iTurnPasswordArray.Count() && aIndex >= 0 )
       
  1139         {
       
  1140         return *( iTurnPasswordArray[aIndex] );
       
  1141         }
       
  1142     return *( KValueNotSet().AllocL() );
       
  1143     }
       
  1144 
       
  1145 //  End of File