dbcreator/commsdatcreator/Src/cdcreaderxml.cpp
changeset 27 489cf6208544
parent 2 086aae6fc07e
child 32 5c4486441ae6
equal deleted inserted replaced
23:7ec726f93df1 27:489cf6208544
   167 //---------------
   167 //---------------
   168 //WPA security
   168 //WPA security
   169 //---------------
   169 //---------------
   170 //WPAPresharedKey         string    WPA/WPA2 pre-shared key in plain text. 
   170 //WPAPresharedKey         string    WPA/WPA2 pre-shared key in plain text. 
   171 //WPAKeyLength            integer   The length of the WPA/WPA2 pre-shared key.
   171 //WPAKeyLength            integer   The length of the WPA/WPA2 pre-shared key.
   172 //WPAListOfEAPs           string    A list of EAPs in use
   172 //WPAEapMethod            string    A EAP method in use
   173 //WPAUseOfPresharedKey    string    WPA/WPA2 pre-shared key usage.
   173 //WPAUseOfPresharedKey    string    WPA/WPA2 pre-shared key usage.
   174 //=============
   174 //=============
   175 //VPN specific:
   175 //VPN specific:
   176 //=============
   176 //=============
   177 //KVpnIapName             string    IAP name used for the connection
   177 //KVpnIapName             string    IAP name used for the connection
   321 _LIT16( KWEPKey4Data,               "WEPKey4Data" );
   321 _LIT16( KWEPKey4Data,               "WEPKey4Data" );
   322 
   322 
   323 //WPA security
   323 //WPA security
   324 _LIT16( KWPAPresharedKey,           "WPAPresharedKey" );
   324 _LIT16( KWPAPresharedKey,           "WPAPresharedKey" );
   325 _LIT16( KWPAKeyLength,              "WPAKeyLength" );
   325 _LIT16( KWPAKeyLength,              "WPAKeyLength" );
   326 _LIT16( KWPAListOfEAPs,             "WPAListOfEAPs" );
   326 _LIT16( KWPAEapMethod,              "WPAEapMethod");
   327 _LIT16( KWPAUseOfPresharedKey,      "WPAUseOfPresharedKey" );
   327 _LIT16( KWPAUseOfPresharedKey,      "WPAUseOfPresharedKey" );
   328 
   328 
   329 //EAP security
   329 //EAP security
   330 _LIT16( KEapGtcUsername,            "EapGtcUsername" );
   330 _LIT16( KEapGtcUsername,            "EapGtcUsername" );
   331 _LIT16( KEapGtcSessionValidityTime, "EapGtcSessionValidityTime" );
   331 _LIT16( KEapGtcSessionValidityTime, "EapGtcSessionValidityTime" );
   490 _LIT16( KWlanShortRetry,            "WlanShortRetry" );
   490 _LIT16( KWlanShortRetry,            "WlanShortRetry" );
   491 _LIT16( KWlanRTS,                   "WlanRTS" );
   491 _LIT16( KWlanRTS,                   "WlanRTS" );
   492 _LIT16( KWlanTxPowerLevel,          "WlanTxPowerLevel" );
   492 _LIT16( KWlanTxPowerLevel,          "WlanTxPowerLevel" );
   493 _LIT16( KWlanRadioMeasurements,     "WlanRadioMeasurements" );
   493 _LIT16( KWlanRadioMeasurements,     "WlanRadioMeasurements" );
   494 _LIT16( KWlanPowerMode,             "WlanPowerMode" );
   494 _LIT16( KWlanPowerMode,             "WlanPowerMode" );
   495 
       
   496 
       
   497 //maximum number of PacketData AP parameters
       
   498 const TInt KMaxPacketDataParam = 28;
       
   499 const TInt KMaxLANParam = 26;
       
   500 const TInt KMaxWLANParam = 125;
       
   501 const TInt KMaxGlobalParam = 42;
       
   502 const TInt KMaxVPNParam = 12;
       
   503 const TInt KMaxDNParam = 19;
       
   504 
   495 
   505 
   496 
   506 // ================= MEMBER FUNCTIONS =======================
   497 // ================= MEMBER FUNCTIONS =======================
   507 
   498 
   508 // ---------------------------------------------------------
   499 // ---------------------------------------------------------
   910     {
   901     {
   911     TDbCreatorFeatures feature( EFeatureNone );
   902     TDbCreatorFeatures feature( EFeatureNone );
   912     
   903     
   913     if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound )
   904     if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound )
   914         {
   905         {
       
   906         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeaturePacketData" );
   915         feature = EFeaturePacketData;
   907         feature = EFeaturePacketData;
   916         }
   908         }
   917     else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound )
   909     else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound )
   918         {
   910         {
       
   911         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureWLAN" );
   919         feature = EFeatureWLAN;
   912         feature = EFeatureWLAN;
   920         }
   913         }
   921     else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound )
   914     else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound )
   922         {
   915         {
       
   916         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureLAN" );
   923         feature = EFeatureLAN;
   917         feature = EFeatureLAN;
   924         }
   918         }
   925     else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound )
   919     else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound )
   926         {
   920         {
       
   921         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureVPN" );
   927         feature = EFeatureVPN;
   922         feature = EFeatureVPN;
   928         }
   923         }
   929     else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound )
   924     else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound )
   930         {
   925         {
       
   926         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureDN" );
   931         feature = EFeatureDN;
   927         feature = EFeatureDN;
   932         }
   928         }
   933     else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound )
   929     else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound )
   934         {
   930         {
       
   931         CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureGlobal" );
   935         feature = EFeatureGlobal;
   932         feature = EFeatureGlobal;
   936         iFoundGlobal = ETrue;        
   933         iFoundGlobal = ETrue;        
   937         }
   934         }
   938     else
   935     else
   939         {
   936         {
  1018 // CReaderXML::DetectParamL
  1015 // CReaderXML::DetectParamL
  1019 // ---------------------------------------------------------
  1016 // ---------------------------------------------------------
  1020 //
  1017 //
  1021 TInt CReaderXML::DetectParam()
  1018 TInt CReaderXML::DetectParam()
  1022     {
  1019     {
  1023     TInt maxParam( 0 );           //maximum nunber of params in array
       
  1024     TInt fieldId( KErrNotFound ); //field id of detected parameter 
  1020     TInt fieldId( KErrNotFound ); //field id of detected parameter 
  1025     RArray<EInputParams> *params( NULL ); //pointer to the table used 
  1021     RArray<EInputParams> *params( NULL ); //pointer to the table used 
  1026                                         //for or detection    
  1022                                         //for or detection    
  1027 
  1023 
  1028     switch ( CurrentFeature() )        
  1024     switch ( CurrentFeature() )        
  1029         {
  1025         {
  1030         case EFeaturePacketData:
  1026         case EFeaturePacketData:
  1031             maxParam = KMaxPacketDataParam;
       
  1032             params   = &iPDParams;
  1027             params   = &iPDParams;
  1033             break;
  1028             break;
  1034         case EFeatureWLAN:
  1029         case EFeatureWLAN:
  1035             maxParam = KMaxWLANParam;
       
  1036             params   = &iWLanParams;
  1030             params   = &iWLanParams;
  1037             break;
  1031             break;
  1038         case EFeatureLAN:
  1032         case EFeatureLAN:
  1039             maxParam = KMaxLANParam;
       
  1040             params   = &iLanParams;
  1033             params   = &iLanParams;
  1041             break;
  1034             break;
  1042         case EFeatureVPN:
  1035         case EFeatureVPN:
  1043             maxParam = KMaxVPNParam;
       
  1044             params   = &iVpnParams;
  1036             params   = &iVpnParams;
  1045             break;
  1037             break;
  1046         case EFeatureDN:
  1038         case EFeatureDN:
  1047             maxParam = KMaxDNParam;
       
  1048             params =   &iDNParams;
  1039             params =   &iDNParams;
  1049             break;
  1040             break;
  1050         case EFeatureGlobal:
  1041         case EFeatureGlobal:
  1051             maxParam = KMaxGlobalParam;
       
  1052             params   = &iGlobalParams;
  1042             params   = &iGlobalParams;
  1053             break;
  1043             break;
  1054         default:
  1044         default:
  1055             User::Panic( KPanicInvalidCase, KErrInvalidCase );
  1045             User::Panic( KPanicInvalidCase, KErrInvalidCase );
  1056         }
  1046         }
  1057        
  1047        
  1058     //looks for parameter match
  1048     //looks for parameter match
  1059     HBufC16* paramName = ReadParam( EParamName );
  1049     HBufC16* paramName = ReadParam( EParamName );
  1060     TBool found ( EFalse );
       
  1061     
       
  1062     if ( paramName == NULL )
  1050     if ( paramName == NULL )
  1063             {
  1051             {
  1064             return fieldId;
  1052             return fieldId;
  1065             }
  1053             }
  1066 
  1054 
  1067     for ( TInt idx = 0; idx < maxParam && !found; idx++ )
  1055     TBool found ( EFalse );
       
  1056     for ( TInt idx = 0; idx < params->Count() && !found; idx++ )
  1068         {        
  1057         {        
  1069         if ( paramName->CompareF( (*params)[idx].iParam ) == 0 )
  1058         if ( paramName->CompareF( (*params)[idx].iParam ) == 0 )
  1070             {
  1059             {
  1071             fieldId = (*params)[idx].iId;
  1060             fieldId = (*params)[idx].iId;
  1072             found = ETrue;            
  1061             found = ETrue;            
  1125         if( ret == NULL )
  1114         if( ret == NULL )
  1126             {
  1115             {
  1127             CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:",
  1116             CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:",
  1128                                      &tag );
  1117                                      &tag );
  1129             }
  1118             }
       
  1119 // Debugging help; commented out for clearer log.
       
  1120 //        else 
       
  1121 //            {
       
  1122 //            if (aSegment == EParamValue)
       
  1123 //                {
       
  1124 //                CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: value %S", &tag );
       
  1125 //                }
       
  1126 //            else if (aSegment == EParamName)
       
  1127 //                {
       
  1128 //                CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: name %S", &tag );
       
  1129 //                }
       
  1130 //            }
  1130         }
  1131         }
  1131     return ret;
  1132     return ret;
  1132     }
  1133     }
  1133 
  1134 
  1134 
  1135 
  1640     iWLanParams.Append( EInputParams( EWEPKey4Length,               KWEPKey4Length ) );
  1641     iWLanParams.Append( EInputParams( EWEPKey4Length,               KWEPKey4Length ) );
  1641     iWLanParams.Append( EInputParams( EWEPKey4Format,               KWEPKey4Format ) );
  1642     iWLanParams.Append( EInputParams( EWEPKey4Format,               KWEPKey4Format ) );
  1642     iWLanParams.Append( EInputParams( EWEPKey4Data,                 KWEPKey4Data ) );
  1643     iWLanParams.Append( EInputParams( EWEPKey4Data,                 KWEPKey4Data ) );
  1643     iWLanParams.Append( EInputParams( EWPAPresharedKey,             KWPAPresharedKey ) );
  1644     iWLanParams.Append( EInputParams( EWPAPresharedKey,             KWPAPresharedKey ) );
  1644     iWLanParams.Append( EInputParams( EWPAKeyLength,                KWPAKeyLength ) );
  1645     iWLanParams.Append( EInputParams( EWPAKeyLength,                KWPAKeyLength ) );
  1645     iWLanParams.Append( EInputParams( EWPAListOfEAPs,               KWPAListOfEAPs ) );
  1646     iWLanParams.Append( EInputParams( EWPAEapMethod,                KWPAEapMethod ) );
  1646     iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey,        KWPAUseOfPresharedKey ) );
  1647     iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey,        KWPAUseOfPresharedKey ) );
  1647     iWLanParams.Append( EInputParams( EEapGtcUsername,              KEapGtcUsername ) );
  1648     iWLanParams.Append( EInputParams( EEapGtcUsername,              KEapGtcUsername ) );
  1648     iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime,   KEapGtcSessionValidityTime ) );
  1649     iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime,   KEapGtcSessionValidityTime ) );
  1649     iWLanParams.Append( EInputParams( EEapGtcEncapsulation,         KEapGtcEncapsulation ) );
  1650     iWLanParams.Append( EInputParams( EEapGtcEncapsulation,         KEapGtcEncapsulation ) );
  1650     iWLanParams.Append( EInputParams( EEapTlsUsername,              KEapTlsUsername ) );
  1651     iWLanParams.Append( EInputParams( EEapTlsUsername,              KEapTlsUsername ) );