voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlsiphandler.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2009-2010 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:  SIP handler for VoIP XML processor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32cmn.h>
       
    20 #include <coecntrl.h>
       
    21 #include <sipmanagedprofile.h>
       
    22 #include <sipmanagedprofileregistry.h>
       
    23 #include <sysutil.h>
       
    24 #include <wlaninternalpskeys.h>
       
    25 #include <pathinfo.h>
       
    26 #include <authority16.h>
       
    27 #include <StringLoader.h>
       
    28 #include <escapeutils.h>
       
    29 
       
    30 #include "voipxmlutils.h"
       
    31 #include "voipxmlsiphandler.h"
       
    32 #include "voipxmlprocessorlogger.h"
       
    33 #include "voipxmlprocessordefaults.h"
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CVoipXmlSipHandler::CVoipXmlSipHandler
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CVoipXmlSipHandler::CVoipXmlSipHandler()
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CVoipXmlSipHandler::NewL
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CVoipXmlSipHandler* CVoipXmlSipHandler::NewL()
       
    48     {
       
    49     CVoipXmlSipHandler* self = new ( ELeave ) CVoipXmlSipHandler;
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CVoipXmlSipHandler::ConstructL
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CVoipXmlSipHandler::ConstructL()
       
    61     {
       
    62     DBG_PRINT( "CVoipXmlSipHandler::ConstructL begin" );
       
    63 
       
    64     // SIP Managed Profile Registry.
       
    65     iRegistry = CSIPManagedProfileRegistry::NewL( *this );
       
    66 
       
    67     // Create an empty SIP profile in which all settings will be set.
       
    68     iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
       
    69     iProfileType.iSIPProfileName.Copy( KIetf() );
       
    70     iProfile = iRegistry->CreateL( iProfileType );
       
    71 
       
    72     iProxyUri           = HBufC8::NewL( KMaxNodeValueLength );
       
    73     iProxyTransport     = EAutomatic;
       
    74     iProxyPort          = KErrNotFound;
       
    75     iLr                 = EFalse;
       
    76     iRegistrarUri       = HBufC8::NewL( KMaxNodeValueLength );
       
    77     iRegistrarTransport = EAutomatic;
       
    78     iRegistrarPort      = KErrNotFound;
       
    79 
       
    80     const TInt ipTosShift( 2 );
       
    81     const TUint32 tosBits( KDefaultSigQos << ipTosShift );
       
    82     iProfile->SetParameter( KSIPSoIpTOS, tosBits );
       
    83 
       
    84     DBG_PRINT( "CVoipXmlSipHandler::ConstructL end" );
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CVoipXmlSipHandler::~CVoipXmlSipHandler
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 CVoipXmlSipHandler::~CVoipXmlSipHandler()
       
    92     {
       
    93     delete iProfile;
       
    94     delete iRegistry;
       
    95     delete iProxyUri;
       
    96     delete iRegistrarUri;
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // Sets SIP setting.
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CVoipXmlSipHandler::SetSetting( TInt aType, TInt aParam, 
       
   104     const TDesC8& aValue )
       
   105     {
       
   106     // Ignore too long descriptors.
       
   107     if ( KMaxNodeValueLength < aValue.Length() )
       
   108         {
       
   109         return;
       
   110         }
       
   111 
       
   112     switch ( aParam )
       
   113         {
       
   114         case EName:
       
   115             {
       
   116             TRAPD( err, CreateProviderNameL( aValue ) );
       
   117             if ( KErrNone == err )
       
   118                 {
       
   119                 iSettingsSet = ETrue;
       
   120                 }
       
   121             break;
       
   122             }
       
   123         case ESignalingQos:
       
   124             {
       
   125             // We need to do bitshifting on the IP TOS, because it's the 
       
   126             // upper 6 bits that are set and settings provide us the IP TOS
       
   127             // as the lower 6 bits.
       
   128             // The lower 2 bits are reserver for explicit congestion
       
   129             // notification. 
       
   130             // See also more from:
       
   131             // Symbian Developer Library 
       
   132             //    => in_sock.h Global variables
       
   133             //       => KSoIpTOS
       
   134             const TInt ipTosShift( 2 );
       
   135             TInt value( KErrNotFound );
       
   136             // don't need to check return value because 'TInt value' is checked
       
   137             // coverity[check_return] coverity[unchecked_value]
       
   138             VoipXmlUtils::Des8ToInt( aValue, value );
       
   139             if ( 0 <= value )
       
   140                 {
       
   141                 const TUint32 tosBits( value << ipTosShift );
       
   142                 iProfile->SetParameter( KSIPSoIpTOS, tosBits );
       
   143                 iSettingsSet = ETrue;
       
   144                 }
       
   145             break;
       
   146             }
       
   147         case EType:
       
   148             {
       
   149             TBuf8<KMaxNodeValueLength> value;
       
   150             value.Copy( aValue );
       
   151             value.UpperCase();
       
   152             if ( 0 == value.Compare( KIms() ) )
       
   153                 {
       
   154                 iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EIms;
       
   155                 value.LowerCase();
       
   156                 iProfileType.iSIPProfileName.Copy( value );
       
   157                 iProfile->SetType( iProfileType );
       
   158                 iSettingsSet = ETrue;
       
   159                 }
       
   160             else if ( 0 == value.Compare( KIetf() ) )
       
   161                 {
       
   162                 iProfileType.iSIPProfileClass = 
       
   163                     TSIPProfileTypeInfo::EInternet;
       
   164                 iProfileType.iSIPProfileName.Copy( value );
       
   165                 iProfile->SetType( iProfileType );
       
   166                 iSettingsSet = ETrue;
       
   167                 }
       
   168             else
       
   169                 {
       
   170                 iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EOther;
       
   171                 iProfileType.iSIPProfileName.Copy( aValue );
       
   172                 iProfile->SetType( iProfileType );
       
   173                 iSettingsSet = ETrue;
       
   174                 }
       
   175             break;
       
   176             }
       
   177         case EPublicUserId:
       
   178             {
       
   179             TBuf8<KMaxNodeValueLength> value;
       
   180             value.Copy( aValue );
       
   181             TRAPD( err, ModifyPuidL( value ) );
       
   182             if ( KErrNone == err )
       
   183                 {
       
   184                 iProfile->SetParameter( KSIPUserAor, value );
       
   185                 iSettingsSet = ETrue;
       
   186                 }
       
   187             break;
       
   188             }
       
   189         case ESignalCompression:
       
   190             {
       
   191             TInt value;
       
   192             if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
       
   193                 {
       
   194                 iProfile->SetParameter( KSIPSigComp, (TBool)value );
       
   195                 iSettingsSet = ETrue;
       
   196                 }
       
   197             break;
       
   198             }
       
   199         case ESecurityNegotiation:
       
   200             {
       
   201             TInt value;
       
   202             if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
       
   203                 {
       
   204                 iProfile->SetParameter( 
       
   205                     KSIPSecurityNegotiation, (TBool)value );
       
   206                 iSettingsSet = ETrue;
       
   207                 }
       
   208             break;
       
   209             }
       
   210         case EProfileLock:
       
   211             {
       
   212             TInt value;
       
   213             if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
       
   214                 {
       
   215                 iProfile->SetParameter( KSIPProfileLocked, (TBool)value );
       
   216                 iSettingsSet = ETrue;
       
   217                 }
       
   218             break;
       
   219             }
       
   220         case EAutoRegistration:
       
   221             {
       
   222             TInt value;
       
   223             if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
       
   224                 {
       
   225                 iProfile->SetParameter( KSIPAutoRegistration, (TBool)value );
       
   226                 iSettingsSet = ETrue;
       
   227                 }
       
   228             break;
       
   229             }
       
   230         case EUri:
       
   231             {
       
   232             TBuf8<KMaxNodeValueLength> tempBuf( KNullDesC8 );
       
   233             if ( 0 != aValue.Find( KSip() ) &&
       
   234                 0 != aValue.Find( KSips() ) )
       
   235                 {
       
   236                 tempBuf.Copy( KSip() );
       
   237                 }
       
   238             tempBuf.Append( aValue );
       
   239             //lint -e{960} No need for else statement here
       
   240             if ( EProxy == aType )
       
   241                 {
       
   242                 iProxyUri->Des().Copy( tempBuf );
       
   243                 iSettingsSet = ETrue;
       
   244                 }
       
   245             else if ( ERegistrar == aType )
       
   246                 {
       
   247                 iRegistrarUri->Des().Copy( tempBuf );
       
   248                 iSettingsSet = ETrue;
       
   249                 }
       
   250             break;
       
   251             }
       
   252         case ETransport:
       
   253             {
       
   254             //lint -e{960} No need for else statement here
       
   255             if ( EProxy == aType )
       
   256                 {
       
   257                 iProxyTransport = ValidateTransport( aValue );
       
   258                 iSettingsSet = ETrue;
       
   259                 }
       
   260             else if ( ERegistrar == aType )
       
   261                 {
       
   262                 iRegistrarTransport = ValidateTransport( aValue );
       
   263                 iSettingsSet = ETrue;
       
   264                 }
       
   265             break;
       
   266             }
       
   267         case EPort:
       
   268             {
       
   269             TInt value;
       
   270             TInt err = VoipXmlUtils::Des8ToInt( aValue, value );
       
   271             //lint -e{960} No need for else statement here
       
   272             if ( EProxy == aType && KErrNone == err )
       
   273                 {
       
   274                 iProxyPort = value;
       
   275                 iSettingsSet = ETrue;
       
   276                 }
       
   277             else if ( ERegistrar == aType && KErrNone == err )
       
   278                 {
       
   279                 iRegistrarPort = value;
       
   280                 iSettingsSet = ETrue;
       
   281                 }
       
   282             break;
       
   283             }
       
   284         case ELooseRouting:
       
   285             {
       
   286             TInt value;
       
   287             if ( EProxy == aType && 
       
   288                 KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
       
   289                 {
       
   290                 iLr = (TBool)value;
       
   291                 iSettingsSet = ETrue;
       
   292                 }
       
   293             break;
       
   294             }
       
   295         case EUsername:
       
   296             {
       
   297             //lint -e{960} No need for else statement here
       
   298             if ( EProxy == aType )
       
   299                 {
       
   300                 if ( TSIPProfileTypeInfo::EInternet == 
       
   301                     iProfileType.iSIPProfileClass )
       
   302                     {
       
   303                     iProfile->SetParameter( KSIPOutboundProxy, 
       
   304                         KSIPDigestUserName, aValue );
       
   305                     iSettingsSet = ETrue;
       
   306                     }
       
   307                 else
       
   308                     {
       
   309                     iProfile->SetParameter( KSIPPrivateIdentity, aValue );
       
   310                     iSettingsSet = ETrue;
       
   311                     }
       
   312                 }
       
   313             else if ( ERegistrar == aType )
       
   314                 {
       
   315                 if ( TSIPProfileTypeInfo::EInternet == 
       
   316                     iProfileType.iSIPProfileClass )
       
   317                     {
       
   318                     iProfile->SetParameter( KSIPRegistrar, KSIPDigestUserName,
       
   319                         aValue );
       
   320                     iSettingsSet = ETrue;
       
   321                     }
       
   322                 else
       
   323                     {
       
   324                     iProfile->SetParameter( KSIPPrivateIdentity, aValue );
       
   325                     iSettingsSet = ETrue;
       
   326                     }
       
   327                 }
       
   328             break;
       
   329             }
       
   330         case EPassword:
       
   331             {
       
   332             //lint -e{960} No need for else statement here
       
   333             if ( EProxy == aType )
       
   334                 {
       
   335                 iProfile->SetParameter( KSIPOutboundProxy, KSIPDigestPassword,
       
   336                     aValue );
       
   337                 iSettingsSet = ETrue;
       
   338                 }
       
   339             else if ( ERegistrar == aType )
       
   340                 {
       
   341                 iProfile->SetParameter( KSIPRegistrar, KSIPDigestPassword,
       
   342                     aValue );
       
   343                 iSettingsSet = ETrue;
       
   344                 }
       
   345             break;
       
   346             }
       
   347         default:
       
   348             break;
       
   349         }
       
   350     }
       
   351 
       
   352 // ---------------------------------------------------------------------------
       
   353 // Stores settings to SIP managed profile registry.
       
   354 // ---------------------------------------------------------------------------
       
   355 //
       
   356 TInt CVoipXmlSipHandler::StoreSettings()
       
   357     {
       
   358     if ( !iSettingsSet )
       
   359         {
       
   360         // No settings to be stored => method not supported.
       
   361         return KErrNotSupported;
       
   362         }
       
   363 
       
   364     TBuf8<KMaxNodeValueLength> tempBuf( KNullDesC8 );
       
   365 
       
   366     // ==============================
       
   367     // Set components to proxy URI.
       
   368     // ==============================
       
   369     //
       
   370     if ( KErrNotFound != iProxyPort )
       
   371         {
       
   372         tempBuf.Copy( KColon() );
       
   373         tempBuf.AppendNum( iProxyPort );
       
   374         }
       
   375     //lint -e{960} No need for else statement here
       
   376     if ( EUdp == iProxyTransport )
       
   377         {
       
   378         tempBuf.Append( KTransport() );
       
   379         tempBuf.Append( KUdp() );
       
   380         }
       
   381     else if ( ETcp == iProxyTransport )
       
   382         {
       
   383         tempBuf.Append( KTransport() );
       
   384         tempBuf.Append( KTcp() );
       
   385         }
       
   386     else if ( ETls == iProxyTransport )
       
   387         {
       
   388         tempBuf.Append( KTransport() );
       
   389         tempBuf.Append( KTls() );
       
   390         }
       
   391     if ( iLr )
       
   392         {
       
   393         tempBuf.Append( KLr() );
       
   394         }
       
   395 
       
   396     if ( iProxyUri->Des().MaxLength() >= 
       
   397         ( iProxyUri->Des().Length() + tempBuf.Length() ) )
       
   398         {
       
   399         iProxyUri->Des().Append( tempBuf );
       
   400         }
       
   401     iProfile->SetParameter( KSIPOutboundProxy, KSIPServerAddress, 
       
   402         iProxyUri->Des() );
       
   403 
       
   404     // ==============================
       
   405     // Set components to registrar URI.
       
   406     // ==============================
       
   407     //
       
   408     tempBuf.Zero();
       
   409     if ( KErrNotFound != iRegistrarPort )
       
   410         {
       
   411         tempBuf.Copy( KColon() );
       
   412         tempBuf.AppendNum( iRegistrarPort );
       
   413         }
       
   414     //lint -e{960} No need for else statement here
       
   415     if ( EUdp == iRegistrarTransport )
       
   416         {
       
   417         tempBuf.Append( KTransport() );
       
   418         tempBuf.Append( KUdp() );
       
   419         }
       
   420     else if ( ETcp == iRegistrarTransport )
       
   421         {
       
   422         tempBuf.Append( KTransport() );
       
   423         tempBuf.Append( KTcp() );
       
   424         }
       
   425     else if ( ETls == iProxyTransport )
       
   426         {
       
   427         tempBuf.Append( KTransport() );
       
   428         tempBuf.Append( KTls() );
       
   429         }
       
   430     if ( iRegistrarUri->Des().MaxLength() >= 
       
   431         ( iRegistrarUri->Des().Length() + tempBuf.Length() ) )
       
   432         {
       
   433         iRegistrarUri->Des().Append( tempBuf );
       
   434         }
       
   435     iProfile->SetParameter( KSIPRegistrar, KSIPServerAddress, 
       
   436         iRegistrarUri->Des() );
       
   437 
       
   438     TRAPD( err, iRegistry->SaveL( *iProfile ) );
       
   439     if ( KErrNone != err )
       
   440         {
       
   441         // No need for specifying what went wrong because paramhandler
       
   442         // is only intrested in KErrNotSupported, KErrCompletion and KErrNone.
       
   443         err = KErrCompletion;
       
   444         }
       
   445     // Store SIP settings ID for later use.
       
   446     iProfile->GetParameter( KSIPProfileId, iProfileId );
       
   447     return err;
       
   448     }
       
   449 
       
   450 // ---------------------------------------------------------------------------
       
   451 // Returns the profile ID if the profile saved in StoreSettings.
       
   452 // ---------------------------------------------------------------------------
       
   453 //
       
   454 TUint32 CVoipXmlSipHandler::SettingsId()
       
   455     {
       
   456     return iProfileId;
       
   457     }
       
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // Saves linkage information.
       
   461 // ---------------------------------------------------------------------------
       
   462 //
       
   463 void CVoipXmlSipHandler::LinkSettings( TInt aType, TUint32 aSettingsId )
       
   464     {
       
   465     if ( EDestination == aType && aSettingsId )
       
   466         {
       
   467         iProfile->SetParameter( KSIPSnapId, aSettingsId );
       
   468         }
       
   469     }
       
   470 
       
   471 // ---------------------------------------------------------------------------
       
   472 // Finalizes settings saving.
       
   473 // ---------------------------------------------------------------------------
       
   474 //
       
   475 TInt CVoipXmlSipHandler::FinalizeSettings()
       
   476     {
       
   477     TRAPD( err, iRegistry->SaveL( *iProfile ) );
       
   478     if ( KErrNone != err )
       
   479         {
       
   480         // ParamHandler is only intrested in KErrNone and KErrCompletion.
       
   481         err = KErrCompletion;
       
   482         }
       
   483     return err;
       
   484     }
       
   485 
       
   486 // ---------------------------------------------------------------------------
       
   487 // From class MSIPProfileRegistryObserver.
       
   488 // ---------------------------------------------------------------------------
       
   489 //
       
   490 void CVoipXmlSipHandler::ProfileRegistryEventOccurred( 
       
   491     TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ )
       
   492     {
       
   493     }
       
   494 
       
   495 // ---------------------------------------------------------------------------
       
   496 // From class MSIPProfileRegistryObserver. 
       
   497 // ---------------------------------------------------------------------------
       
   498 //
       
   499 void CVoipXmlSipHandler::ProfileRegistryErrorOccurred( 
       
   500     TUint32 /*aSIPProfileId*/, TInt /*aError*/ )
       
   501     {
       
   502     }
       
   503 
       
   504 // ---------------------------------------------------------------------------
       
   505 // CVoipXmlSipHandler::CreateProviderNameL
       
   506 // Checks if duplicate named SIP profiles. Renames if same.
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 void CVoipXmlSipHandler::CreateProviderNameL( const TDesC8& aName )
       
   510     {
       
   511     DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL begin" );
       
   512     
       
   513     const TInt maxModifyLength = 
       
   514         KMaxNodeNameLength - KMaxProfileNameAppendLength;
       
   515     
       
   516     RPointerArray<CSIPProfile> profiles;
       
   517     CleanupResetAndDestroyL( profiles ); // CS:1
       
   518     
       
   519     // Get all profiles based on profile types.
       
   520     iRegistry->ProfilesL( profiles );
       
   521     const TInt profileCount = profiles.Count();
       
   522     
       
   523     // Go through loaded profiles and check for name duplicates.
       
   524     HBufC8* name = HBufC8::NewLC( KMaxNodeNameLength ); // CS:2
       
   525     name->Des().Copy( aName.Left( maxModifyLength ) );
       
   526     TUint i( 1 ); // Add number to the name if name already in use.
       
   527     const TInt count( profiles.Count() );
       
   528     for ( TInt counter = 0; counter < count; counter++ )
       
   529         {
       
   530         CSIPManagedProfile* profile = 
       
   531             static_cast<CSIPManagedProfile*>( profiles[counter] );
       
   532         const TDesC8* existingName;
       
   533         profile->GetParameter( KSIPProviderName, existingName );
       
   534         if ( 0 == existingName->Compare( *name ) )
       
   535             {
       
   536             name->Des().Copy( aName.Left( maxModifyLength ) );
       
   537             name->Des().Append( KOpenParenthesis8() );
       
   538             name->Des().AppendNum( i );
       
   539             name->Des().Append( KClosedParenthesis8() );  
       
   540             counter = 0;
       
   541             i++;
       
   542             if ( KMaxProfileNames < i )
       
   543                 {
       
   544                 User::Leave( KErrBadName );
       
   545                 }
       
   546             }
       
   547         }
       
   548     iProfile->SetParameter( KSIPProviderName, name->Des() );
       
   549 
       
   550     // name, &profiles
       
   551     CleanupStack::PopAndDestroy( 2, &profiles ); // CS:0
       
   552     DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL end" );
       
   553     }
       
   554 
       
   555 // ---------------------------------------------------------------------------
       
   556 // Modifies public user ID, i.e. escapes and adds sip: prefix if necessary.
       
   557 // ---------------------------------------------------------------------------
       
   558 //
       
   559 void CVoipXmlSipHandler::ModifyPuidL( TDes8& aValue )
       
   560     {
       
   561     if ( KErrNotFound == aValue.Find( KEscaped() ) )
       
   562         {
       
   563         HBufC8* tempPuid = EscapeUtils::EscapeEncodeL( aValue,
       
   564             EscapeUtils::EEscapeNormal );
       
   565         aValue.Copy( tempPuid->Des() );
       
   566         delete tempPuid;
       
   567         tempPuid = NULL;
       
   568         }
       
   569     if ( 0 != aValue.Find( KSip() ) && 0 != aValue.Find( KSips() ) )
       
   570         {
       
   571         if ( aValue.MaxLength() >= ( aValue.Length() + KSip().Length() ) )
       
   572             {
       
   573             aValue.Insert( 0, KSip() );
       
   574             }
       
   575         else
       
   576             {
       
   577             User::Leave( KErrTooBig );
       
   578             }
       
   579         }
       
   580     }
       
   581 
       
   582 // ---------------------------------------------------------------------------
       
   583 // Validates transport type.
       
   584 // ---------------------------------------------------------------------------
       
   585 //
       
   586 CVoipXmlSipHandler::TTransportType CVoipXmlSipHandler::ValidateTransport( 
       
   587     const TDesC8& aValue )
       
   588     {
       
   589     TBuf8<KMaxNodeValueLength> value;
       
   590     value.Copy( aValue );
       
   591     value.UpperCase();
       
   592     if ( 0 == value.Compare( KUdp() ) )
       
   593         {
       
   594         return EUdp;
       
   595         }
       
   596     else if ( 0 == value.Compare( KTcp() ) )
       
   597         {
       
   598         return ETcp;
       
   599         }
       
   600     else if ( 0 == value.Compare( KTls() ) )
       
   601         {
       
   602         return ETls;
       
   603         }
       
   604     else
       
   605         {
       
   606         return EAutomatic;
       
   607         }
       
   608     }
       
   609 
       
   610 // End of file.