cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp
changeset 23 7ec726f93df1
parent 20 9c97ad6591ae
child 27 489cf6208544
equal deleted inserted replaced
20:9c97ad6591ae 23:7ec726f93df1
  1259     {
  1259     {
  1260     OstTraceFunctionEntry0( DUP1_CCMPLUGINWLAN_CANHANDLEIAPIDL_ENTRY );
  1260     OstTraceFunctionEntry0( DUP1_CCMPLUGINWLAN_CANHANDLEIAPIDL_ENTRY );
  1261 
  1261 
  1262     TBool retVal( EFalse );
  1262     TBool retVal( EFalse );
  1263 
  1263 
  1264     if ( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) &&
  1264     if ( ( TPtrC( aIapRecord->iServiceType ) == TPtrC( KCDTypeNameLANService ) ) &&
  1265             TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) )
  1265             TPtrC( aIapRecord->iBearerType ) == TPtrC( KCDTypeNameLANBearer ) )
  1266         {
  1266         {
  1267         // Check if there is a WLAN record with an iServiceId == iIapRecord->iService.
  1267         // Check if there is a WLAN record with an iServiceId == iIapRecord->iService.
  1268         CCDWlanServiceRecord* tmprec = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  1268         CCDWlanServiceRecord* tmprec = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  1269         CleanupStack::PushL( tmprec );
  1269         CleanupStack::PushL( tmprec );
  1270 
  1270 
  1271         TInt service = aIapRecord->iService;
  1271         tmprec->iWlanServiceId.SetL( ( TUint32 )( aIapRecord->iService ) );
  1272 
       
  1273         tmprec->iWlanServiceId.SetL( (TUint32)service );
       
  1274         if ( tmprec->FindL( iSession ) )
  1272         if ( tmprec->FindL( iSession ) )
  1275             {
  1273             {
  1276             // we found at least one WLAN using this IAP,
  1274             // we found at least one WLAN using this IAP,
  1277             retVal = ETrue;
  1275             retVal = ETrue;
  1278             }
  1276             }
  1290 //
  1288 //
  1291 void CCmPluginWlan::DeleteBearerRecordsL()
  1289 void CCmPluginWlan::DeleteBearerRecordsL()
  1292     {
  1290     {
  1293     OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY );
  1291     OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY );
  1294 
  1292 
  1295     // as base class deletes service record, in this case LAN,
  1293     // As base class deletes service record, in this case LAN, only WLAN
  1296     // only WLAN related stuff needs to be deleted
  1294     // related stuff needs to be deleted.
  1297     iWlanServiceRecord->DeleteL( iSession );
  1295     iWlanServiceRecord->DeleteL( iSession );
  1298     iWlanServiceRecord = NULL;
       
  1299 
  1296 
  1300     OstTraceFunctionExit0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_EXIT );
  1297     OstTraceFunctionExit0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_EXIT );
  1301     }
  1298     }
  1302 
  1299 
  1303 // --------------------------------------------------------------------------
  1300 // --------------------------------------------------------------------------
  1461     CCDIAPRecord* iapRecord =
  1458     CCDIAPRecord* iapRecord =
  1462             static_cast<CCDIAPRecord*>(
  1459             static_cast<CCDIAPRecord*>(
  1463                     aGenRecordArray[KIapRecordIndex] );
  1460                     aGenRecordArray[KIapRecordIndex] );
  1464 
  1461 
  1465     CheckIfNameModifiedL( iapRecord, wlanServiceRecord );
  1462     CheckIfNameModifiedL( iapRecord, wlanServiceRecord );
  1466     wlanServiceRecord->iWlanServiceId.SetL( iapRecord->iService );
  1463     wlanServiceRecord->iWlanServiceId.SetL( ( TUint32 )( iapRecord->iService ) );
  1467 
  1464 
  1468     CCDLANServiceRecord* serviceRecord =
  1465     CCDLANServiceRecord* serviceRecord =
  1469             static_cast<CCDLANServiceRecord*>(
  1466             static_cast<CCDLANServiceRecord*>(
  1470                     aGenRecordArray[KServiceRecordIndex] );
  1467                     aGenRecordArray[KServiceRecordIndex] );
  1471 
  1468 
  1489 // ----------------------------------------------------------------------------
  1486 // ----------------------------------------------------------------------------
  1490 // CCmPluginWlan::UpdateServiceRecordL()
  1487 // CCmPluginWlan::UpdateServiceRecordL()
  1491 // ----------------------------------------------------------------------------
  1488 // ----------------------------------------------------------------------------
  1492 //
  1489 //
  1493 void CCmPluginWlan::UpdateServiceRecordL(
  1490 void CCmPluginWlan::UpdateServiceRecordL(
  1494     RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
  1491         RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
  1495     RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
  1492         RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
  1496     {
  1493     {
  1497     OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATESERVICERECORDL_ENTRY );
  1494     OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATESERVICERECORDL_ENTRY );
  1498 
  1495 
  1499     // Delete the original record and create a copy from the parameter
  1496     // Delete the original record and create a copy from the client's copy.
  1500     delete iServiceRecord;
  1497     delete iServiceRecord;
  1501     iServiceRecord = NULL;
  1498     iServiceRecord = NULL;
  1502 
  1499 
  1503     iServiceRecord = static_cast<CCDLANServiceRecord*>
  1500     iServiceRecord = static_cast<CCDLANServiceRecord *>(
  1504                     (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
  1501             CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
  1505 
  1502 
  1506     // LAN Service copy does not work so we have to copy it manually
  1503     // LAN Service copy does not work so we have to copy it manually.
  1507 
  1504 
  1508     CCDLANServiceRecord* lanServiceRecordTo =
  1505     // Plugin's commsdat copy.
  1509             static_cast<CCDLANServiceRecord *>(
  1506     CCDLANServiceRecord* origServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
  1510                     iServiceRecord );
  1507 
  1511 
  1508     // Client's copy of lan service record.
  1512     CCDLANServiceRecord* lanServiceRecordFrom =
  1509     CCDLANServiceRecord* clientServiceRecordCopy =
  1513             static_cast<CCDLANServiceRecord *>(
  1510             static_cast<CCDLANServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
  1514                     aGenRecordArray[KServiceRecordIndex] );
  1511 
  1515 
  1512     if ( !clientServiceRecordCopy->iRecordTag.IsNull() )
  1516     if ( !lanServiceRecordFrom->iRecordName.IsNull() )
  1513         {
  1517         {
  1514         origServiceRecord->iRecordTag.SetL( clientServiceRecordCopy->iRecordTag );
  1518         lanServiceRecordTo->iRecordName.SetL( lanServiceRecordFrom->iRecordName );
  1515         }
  1519         }
  1516     if ( !clientServiceRecordCopy->iRecordName.IsNull() )
  1520     if ( !lanServiceRecordFrom->iIfNetworks.IsNull() )
  1517         {
  1521         {
  1518         origServiceRecord->iRecordName.SetL( clientServiceRecordCopy->iRecordName );
  1522         lanServiceRecordTo->iIfNetworks.SetL( lanServiceRecordFrom->iIfNetworks );
  1519         }
  1523         }
  1520     if ( !clientServiceRecordCopy->iServiceEnableLlmnr.IsNull() )
  1524     if ( !lanServiceRecordFrom->iIpGateway.IsNull() )
  1521         {
  1525         {
  1522         origServiceRecord->iServiceEnableLlmnr.SetL( clientServiceRecordCopy->iServiceEnableLlmnr );
  1526         lanServiceRecordTo->iIpGateway.SetL( lanServiceRecordFrom->iIpGateway );
  1523         }
  1527         }
  1524     if ( !clientServiceRecordCopy->iIfNetworks.IsNull() )
  1528     if ( !lanServiceRecordFrom->iIpAddrFromServer.IsNull() )
  1525         {
  1529         {
  1526         origServiceRecord->iIfNetworks.SetL( clientServiceRecordCopy->iIfNetworks );
  1530         lanServiceRecordTo->iIpAddrFromServer.SetL( lanServiceRecordFrom->iIpAddrFromServer );
  1527         }
  1531         }
  1528     if ( !clientServiceRecordCopy->iIpNetmask.IsNull() )
  1532     if ( !lanServiceRecordFrom->iIpAddr.IsNull() )
  1529         {
  1533         {
  1530         origServiceRecord->iIpNetmask.SetL( clientServiceRecordCopy->iIpNetmask );
  1534         lanServiceRecordTo->iIpAddr.SetL( lanServiceRecordFrom->iIpAddr );
  1531         }
  1535         }
  1532     if ( !clientServiceRecordCopy->iIpGateway.IsNull() )
  1536     if ( !lanServiceRecordFrom->iIpDnsAddrFromServer.IsNull() )
  1533         {
  1537         {
  1534         origServiceRecord->iIpGateway.SetL( clientServiceRecordCopy->iIpGateway );
  1538         lanServiceRecordTo->iIpDnsAddrFromServer.SetL( lanServiceRecordFrom->iIpDnsAddrFromServer );
  1535         }
  1539         }
  1536     if ( !clientServiceRecordCopy->iIpAddrFromServer.IsNull() )
  1540     if ( !lanServiceRecordFrom->iIpNameServer1.IsNull() )
  1537         {
  1541         {
  1538         origServiceRecord->iIpAddrFromServer.SetL( clientServiceRecordCopy->iIpAddrFromServer );
  1542         lanServiceRecordTo->iIpNameServer1.SetL( lanServiceRecordFrom->iIpNameServer1 );
  1539         }
  1543         }
  1540     if ( !clientServiceRecordCopy->iIpAddr.IsNull() )
  1544     if ( !lanServiceRecordFrom->iIpNameServer2.IsNull() )
  1541         {
  1545         {
  1542         origServiceRecord->iIpAddr.SetL( clientServiceRecordCopy->iIpAddr );
  1546         lanServiceRecordTo->iIpNameServer2.SetL( lanServiceRecordFrom->iIpNameServer2 );
  1543         }
  1547         }
  1544     if ( !clientServiceRecordCopy->iIpDnsAddrFromServer.IsNull() )
  1548     if ( !lanServiceRecordFrom->iIp6DnsAddrFromServer.IsNull() )
  1545         {
  1549         {
  1546         origServiceRecord->iIpDnsAddrFromServer.SetL( clientServiceRecordCopy->iIpDnsAddrFromServer );
  1550         lanServiceRecordTo->iIp6DnsAddrFromServer.SetL( lanServiceRecordFrom->iIp6DnsAddrFromServer );
  1547         }
  1551         }
  1548     if ( !clientServiceRecordCopy->iIpNameServer1.IsNull() )
  1552     if ( !lanServiceRecordFrom->iIp6NameServer1.IsNull() )
  1549         {
  1553         {
  1550         origServiceRecord->iIpNameServer1.SetL( clientServiceRecordCopy->iIpNameServer1 );
  1554         lanServiceRecordTo->iIp6NameServer1.SetL( lanServiceRecordFrom->iIp6NameServer1 );
  1551         }
  1555         }
  1552     if ( !clientServiceRecordCopy->iIpNameServer2.IsNull() )
  1556     if ( !lanServiceRecordFrom->iIp6NameServer2.IsNull() )
  1553         {
  1557         {
  1554         origServiceRecord->iIpNameServer2.SetL( clientServiceRecordCopy->iIpNameServer2 );
  1558         lanServiceRecordTo->iIp6NameServer2.SetL( lanServiceRecordFrom->iIp6NameServer2 );
  1555         }
  1559         }
  1556     if ( !clientServiceRecordCopy->iIp6DnsAddrFromServer.IsNull() )
  1560     if ( !lanServiceRecordFrom->iConfigDaemonManagerName.IsNull() )
  1557         {
  1561         {
  1558         origServiceRecord->iIp6DnsAddrFromServer.SetL( clientServiceRecordCopy->iIp6DnsAddrFromServer );
  1562         lanServiceRecordTo->iConfigDaemonManagerName.SetL( lanServiceRecordFrom->iConfigDaemonManagerName );
  1559         }
  1563         }
  1560     if ( !clientServiceRecordCopy->iIp6NameServer1.IsNull() )
  1564     if ( !lanServiceRecordFrom->iConfigDaemonName.IsNull() )
  1561         {
  1565         {
  1562         origServiceRecord->iIp6NameServer1.SetL( clientServiceRecordCopy->iIp6NameServer1 );
  1566         lanServiceRecordTo->iConfigDaemonName.SetL( lanServiceRecordFrom->iConfigDaemonName );
  1563         }
  1567         }
  1564     if ( !clientServiceRecordCopy->iIp6NameServer2.IsNull() )
  1568 
  1565         {
  1569     lanServiceRecordTo->SetElementId( lanServiceRecordFrom->ElementId() );
  1566         origServiceRecord->iIp6NameServer2.SetL( clientServiceRecordCopy->iIp6NameServer2 );
  1570     // this is shared between wlan iaps so it cannot be hidden or protected
  1567         }
  1571     lanServiceRecordTo->ClearAttributes( ECDHidden );
  1568     if ( !clientServiceRecordCopy->iIpAddrLeaseValidFrom.IsNull() )
  1572     lanServiceRecordTo->ClearAttributes( ECDProtectedWrite );
  1569         {
  1573 
  1570         origServiceRecord->iIpAddrLeaseValidFrom.SetL( clientServiceRecordCopy->iIpAddrLeaseValidFrom );
  1574     if ( !ServiceRecord().RecordId() )
  1571         }
  1575         {
  1572     if ( !clientServiceRecordCopy->iIpAddrLeaseValidTo.IsNull() )
  1576         ServiceRecord().SetRecordId( KCDNewRecordRequest );
  1573         {
  1577         ServiceRecord().StoreL( iSession );
  1574         origServiceRecord->iIpAddrLeaseValidTo.SetL( clientServiceRecordCopy->iIpAddrLeaseValidTo );
  1578 
  1575         }
  1579         // Update needed values to record tables too( lanservice and wlanservice )
  1576     if ( !clientServiceRecordCopy->iConfigDaemonManagerName.IsNull() )
  1580         lanServiceRecordFrom->SetElementId( ServiceRecord().ElementId() );
  1577         {
  1581         CCDWlanServiceRecord* wlanServiceRecord =
  1578         origServiceRecord->iConfigDaemonManagerName.SetL( clientServiceRecordCopy->iConfigDaemonManagerName );
  1582                 static_cast<CCDWlanServiceRecord *>(
  1579         }
  1583                         aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1580     if ( !clientServiceRecordCopy->iConfigDaemonName.IsNull() )
  1584         wlanServiceRecord->iWlanServiceId.SetL( ServiceRecord().RecordId() );
  1581         {
       
  1582         origServiceRecord->iConfigDaemonName.SetL( clientServiceRecordCopy->iConfigDaemonName );
       
  1583         }
       
  1584     if ( !clientServiceRecordCopy->iServiceExtensionTableName.IsNull() )
       
  1585         {
       
  1586         origServiceRecord->iServiceExtensionTableName.SetL( clientServiceRecordCopy->iServiceExtensionTableName );
       
  1587         }
       
  1588     if ( !clientServiceRecordCopy->iServiceExtensionTableRecordId.IsNull() )
       
  1589         {
       
  1590         origServiceRecord->iServiceExtensionTableRecordId.SetL( clientServiceRecordCopy->iServiceExtensionTableRecordId ); //TODO, check this works ok.
       
  1591         }
       
  1592 
       
  1593     origServiceRecord->SetElementId( clientServiceRecordCopy->ElementId() );
       
  1594 
       
  1595     if ( !origServiceRecord->RecordId() )
       
  1596         {
       
  1597         origServiceRecord->SetRecordId( KCDNewRecordRequest );
       
  1598         origServiceRecord->StoreL( iSession );
       
  1599 
       
  1600         // Update received element ID to client's copy too.
       
  1601         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
       
  1602         // Update needed values to other table records too (wlanservice).
       
  1603         CCDWlanServiceRecord* wlanServiceRecord = static_cast<CCDWlanServiceRecord *>(
       
  1604                 aBearerSpecRecordArray[KWlanServiceRecordIndex] );
       
  1605         wlanServiceRecord->iWlanServiceId.SetL( origServiceRecord->RecordId() );
  1585         }
  1606         }
  1586     else
  1607     else
  1587         {
  1608         {
  1588         ServiceRecord().ModifyL( iSession );
  1609         origServiceRecord->ModifyL( iSession );
  1589         }
  1610         }
  1590 
  1611 
  1591     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT );
  1612     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT );
  1592     }
  1613     }
  1593 
  1614 
  1599         RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
  1620         RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
  1600         RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
  1621         RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
  1601     {
  1622     {
  1602     OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_ENTRY );
  1623     OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_ENTRY );
  1603 
  1624 
       
  1625     // Delete the original record and create a copy from the client's copy.
  1604     delete iWlanServiceRecord;
  1626     delete iWlanServiceRecord;
  1605     iWlanServiceRecord = NULL;
  1627     iWlanServiceRecord = NULL;
  1606 
  1628 
  1607     CCDWlanServiceRecord* wlanServiceRecord =
  1629     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord( iWlanTableId );
  1608             static_cast<CCDWlanServiceRecord*>(
  1630 
  1609                     aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1631     // Client's copy of wlan service record.
  1610 
  1632     CCDWlanServiceRecord* clientWlanServiceRecord = static_cast<CCDWlanServiceRecord*>(
  1611     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  1633             aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1612 
  1634 
  1613     iWlanServiceRecord->SetElementId( wlanServiceRecord->ElementId() );
  1635     if ( !clientWlanServiceRecord->iRecordTag.IsNull() )
  1614     iWlanServiceRecord->iRecordName.SetL( wlanServiceRecord->iRecordName );
  1636         {
  1615 
  1637         iWlanServiceRecord->iRecordTag.SetL(
  1616     iWlanServiceRecord->iWlanServiceId.SetL( wlanServiceRecord->iWlanServiceId );
  1638                 clientWlanServiceRecord->iRecordTag );
  1617     iWlanServiceRecord->iWlanConnMode.SetL( wlanServiceRecord->iWlanConnMode );
  1639         }
  1618     if ( !wlanServiceRecord->iWLanSSID.IsNull() )
  1640     if ( !clientWlanServiceRecord->iRecordName.IsNull() )
  1619         {
  1641         {
  1620         iWlanServiceRecord->iWLanSSID.SetL( wlanServiceRecord->iWLanSSID );
  1642         iWlanServiceRecord->iRecordName.SetL(
  1621         }
  1643                 clientWlanServiceRecord->iRecordName );
  1622     if ( !wlanServiceRecord->iWLanUsedSSID.IsNull() )
  1644         }
  1623         {
  1645     if ( !clientWlanServiceRecord->iWlanServiceId.IsNull() )
  1624         iWlanServiceRecord->iWLanUsedSSID.SetL( wlanServiceRecord->iWLanUsedSSID );
  1646         {
  1625         }
  1647         iWlanServiceRecord->iWlanServiceId.SetL(
  1626     if ( !wlanServiceRecord->iWLanWepKey1.IsNull() )
  1648                 clientWlanServiceRecord->iWlanServiceId );
  1627         {
  1649         }
  1628         iWlanServiceRecord->iWLanWepKey1.SetL( wlanServiceRecord->iWLanWepKey1 );
  1650     if ( !clientWlanServiceRecord->iWlanConnMode.IsNull() )
  1629         }
  1651         {
  1630     if ( !wlanServiceRecord->iWLanWepKey2.IsNull() )
  1652         iWlanServiceRecord->iWlanConnMode.SetL(
  1631         {
  1653                 clientWlanServiceRecord->iWlanConnMode );
  1632         iWlanServiceRecord->iWLanWepKey2.SetL( wlanServiceRecord->iWLanWepKey2 );
  1654         }
  1633         }
  1655     if ( !clientWlanServiceRecord->iWLanSSID.IsNull() )
  1634     if ( !wlanServiceRecord->iWLanWepKey3.IsNull() )
  1656         {
  1635         {
  1657         iWlanServiceRecord->iWLanSSID.SetL(
  1636         iWlanServiceRecord->iWLanWepKey3.SetL( wlanServiceRecord->iWLanWepKey3 );
  1658                 clientWlanServiceRecord->iWLanSSID );
  1637         }
  1659         }
  1638     if ( !wlanServiceRecord->iWLanWepKey4.IsNull() )
  1660     if ( !clientWlanServiceRecord->iWLanUsedSSID.IsNull() )
  1639         {
  1661         {
  1640         iWlanServiceRecord->iWLanWepKey4.SetL( wlanServiceRecord->iWLanWepKey4 );
  1662         iWlanServiceRecord->iWLanUsedSSID.SetL(
  1641         }
  1663                 clientWlanServiceRecord->iWLanUsedSSID );
  1642     if ( !wlanServiceRecord->iWlanWepIndex.IsNull() )
  1664         }
  1643         {
  1665     if ( !clientWlanServiceRecord->iWLanWepKey1.IsNull() )
  1644         iWlanServiceRecord->iWlanWepIndex.SetL( wlanServiceRecord->iWlanWepIndex );
  1666         {
  1645         }
  1667         iWlanServiceRecord->iWLanWepKey1.SetL(
  1646     if ( !wlanServiceRecord->iWlanSecMode.IsNull() )
  1668                 clientWlanServiceRecord->iWLanWepKey1 );
  1647         {
  1669         }
  1648         iWlanServiceRecord->iWlanSecMode.SetL( wlanServiceRecord->iWlanSecMode );
  1670     if ( !clientWlanServiceRecord->iWLanWepKey2.IsNull() )
  1649         }
  1671         {
  1650     if ( !wlanServiceRecord->iWlanAuthMode.IsNull() )
  1672         iWlanServiceRecord->iWLanWepKey2.SetL(
  1651         {
  1673                 clientWlanServiceRecord->iWLanWepKey2 );
  1652         iWlanServiceRecord->iWlanAuthMode.SetL( wlanServiceRecord->iWlanAuthMode );
  1674         }
  1653         }
  1675     if ( !clientWlanServiceRecord->iWLanWepKey3.IsNull() )
  1654     if ( !wlanServiceRecord->iWlanEnableWpaPsk.IsNull() )
  1676         {
  1655         {
  1677         iWlanServiceRecord->iWLanWepKey3.SetL(
  1656         iWlanServiceRecord->iWlanEnableWpaPsk.SetL( wlanServiceRecord->iWlanEnableWpaPsk );
  1678                 clientWlanServiceRecord->iWLanWepKey3 );
  1657         }
  1679         }
  1658     if ( !wlanServiceRecord->iWLanWpaPreSharedKey.IsNull() )
  1680     if ( !clientWlanServiceRecord->iWLanWepKey4.IsNull() )
  1659         {
  1681         {
  1660         iWlanServiceRecord->iWLanWpaPreSharedKey.SetL( wlanServiceRecord->iWLanWpaPreSharedKey );
  1682         iWlanServiceRecord->iWLanWepKey4.SetL(
  1661         }
  1683                 clientWlanServiceRecord->iWLanWepKey4 );
  1662     if ( !wlanServiceRecord->iWlanWpaKeyLength.IsNull() )
  1684         }
  1663         {
  1685     if ( !clientWlanServiceRecord->iWlanWepIndex.IsNull() )
  1664         iWlanServiceRecord->iWlanWpaKeyLength.SetL( wlanServiceRecord->iWlanWpaKeyLength );
  1686         {
  1665         }
  1687         iWlanServiceRecord->iWlanWepIndex.SetL(
  1666     if ( !wlanServiceRecord->iWLanEaps.IsNull() )
  1688                 clientWlanServiceRecord->iWlanWepIndex );
  1667         {
  1689         }
  1668         iWlanServiceRecord->iWLanEaps.SetL( wlanServiceRecord->iWLanEaps );
  1690     if ( !clientWlanServiceRecord->iWlanSecMode.IsNull() )
  1669         }
  1691         {
  1670     if ( !wlanServiceRecord->iWlanScanSSID.IsNull() )
  1692         iWlanServiceRecord->iWlanSecMode.SetL(
  1671         {
  1693                 clientWlanServiceRecord->iWlanSecMode );
  1672         iWlanServiceRecord->iWlanScanSSID.SetL( wlanServiceRecord->iWlanScanSSID );
  1694         }
  1673         }
  1695     if ( !clientWlanServiceRecord->iWlanAuthMode.IsNull() )
  1674     if ( !wlanServiceRecord->iWlanChannelID.IsNull() )
  1696         {
  1675         {
  1697         iWlanServiceRecord->iWlanAuthMode.SetL(
  1676         iWlanServiceRecord->iWlanChannelID.SetL( wlanServiceRecord->iWlanChannelID );
  1698                 clientWlanServiceRecord->iWlanAuthMode );
  1677         }
  1699         }
  1678     if ( !wlanServiceRecord->iWlanFormatKey1.IsNull() )
  1700     if ( !clientWlanServiceRecord->iWlanEnableWpaPsk.IsNull() )
  1679         {
  1701         {
  1680         iWlanServiceRecord->iWlanFormatKey1.SetL( wlanServiceRecord->iWlanFormatKey1 );
  1702         iWlanServiceRecord->iWlanEnableWpaPsk.SetL(
  1681         }
  1703                 clientWlanServiceRecord->iWlanEnableWpaPsk );
  1682     if ( !wlanServiceRecord->iWlanFormatKey2.IsNull() )
  1704         }
  1683         {
  1705     if ( !clientWlanServiceRecord->iWLanWpaPreSharedKey.IsNull() )
  1684         iWlanServiceRecord->iWlanFormatKey2.SetL( wlanServiceRecord->iWlanFormatKey2 );
  1706         {
  1685         }
  1707         iWlanServiceRecord->iWLanWpaPreSharedKey.SetL(
  1686     if ( !wlanServiceRecord->iWlanFormatKey3.IsNull() )
  1708                 clientWlanServiceRecord->iWLanWpaPreSharedKey );
  1687         {
  1709         }
  1688         iWlanServiceRecord->iWlanFormatKey3.SetL( wlanServiceRecord->iWlanFormatKey3 );
  1710     if ( !clientWlanServiceRecord->iWlanWpaKeyLength.IsNull() )
  1689         }
  1711         {
  1690     if ( !wlanServiceRecord->iWlanFormatKey4.IsNull() )
  1712         iWlanServiceRecord->iWlanWpaKeyLength.SetL(
  1691         {
  1713                 clientWlanServiceRecord->iWlanWpaKeyLength );
  1692         iWlanServiceRecord->iWlanFormatKey4.SetL( wlanServiceRecord->iWlanFormatKey4 );
  1714         }
  1693         }
  1715     if ( !clientWlanServiceRecord->iWLanEaps.IsNull() )
  1694     if ( !wlanServiceRecord->iWlanAllowSSIDRoaming.IsNull() )
  1716         {
  1695         {
  1717         iWlanServiceRecord->iWLanEaps.SetL(
  1696         iWlanServiceRecord->iWlanAllowSSIDRoaming.SetL( wlanServiceRecord->iWlanAllowSSIDRoaming );
  1718                 clientWlanServiceRecord->iWLanEaps );
  1697         }
  1719         }
  1698     if ( !wlanServiceRecord->iWLanEnabledEaps.IsNull() )
  1720     if ( !clientWlanServiceRecord->iWlanScanSSID.IsNull() )
  1699         {
  1721         {
  1700         iWlanServiceRecord->iWLanEnabledEaps.SetL( wlanServiceRecord->iWLanEnabledEaps );
  1722         iWlanServiceRecord->iWlanScanSSID.SetL(
  1701         }
  1723                 clientWlanServiceRecord->iWlanScanSSID );
  1702     if ( !wlanServiceRecord->iWLanDisabledEaps.IsNull() )
  1724         }
  1703         {
  1725     if ( !clientWlanServiceRecord->iWlanChannelID.IsNull() )
  1704         iWlanServiceRecord->iWLanDisabledEaps.SetL( wlanServiceRecord->iWLanDisabledEaps );
  1726         {
  1705         }
  1727         iWlanServiceRecord->iWlanChannelID.SetL(
       
  1728                 clientWlanServiceRecord->iWlanChannelID );
       
  1729         }
       
  1730     if ( !clientWlanServiceRecord->iWlanFormatKey1.IsNull() )
       
  1731         {
       
  1732         iWlanServiceRecord->iWlanFormatKey1.SetL(
       
  1733                 clientWlanServiceRecord->iWlanFormatKey1 );
       
  1734         }
       
  1735     if ( !clientWlanServiceRecord->iWlanFormatKey2.IsNull() )
       
  1736         {
       
  1737         iWlanServiceRecord->iWlanFormatKey2.SetL(
       
  1738                 clientWlanServiceRecord->iWlanFormatKey2 );
       
  1739         }
       
  1740     if ( !clientWlanServiceRecord->iWlanFormatKey3.IsNull() )
       
  1741         {
       
  1742         iWlanServiceRecord->iWlanFormatKey3.SetL(
       
  1743                 clientWlanServiceRecord->iWlanFormatKey3 );
       
  1744         }
       
  1745     if ( !clientWlanServiceRecord->iWlanFormatKey4.IsNull() )
       
  1746         {
       
  1747         iWlanServiceRecord->iWlanFormatKey4.SetL(
       
  1748                 clientWlanServiceRecord->iWlanFormatKey4 );
       
  1749         }
       
  1750     if ( !clientWlanServiceRecord->iWlanAllowSSIDRoaming.IsNull() )
       
  1751         {
       
  1752         iWlanServiceRecord->iWlanAllowSSIDRoaming.SetL(
       
  1753                 clientWlanServiceRecord->iWlanAllowSSIDRoaming );
       
  1754         }
       
  1755     if ( !clientWlanServiceRecord->iWLanEnabledEaps.IsNull() )
       
  1756         {
       
  1757         iWlanServiceRecord->iWLanEnabledEaps.SetL(
       
  1758                 clientWlanServiceRecord->iWLanEnabledEaps );
       
  1759         }
       
  1760     if ( !clientWlanServiceRecord->iWLanDisabledEaps.IsNull() )
       
  1761         {
       
  1762         iWlanServiceRecord->iWLanDisabledEaps.SetL(
       
  1763                 clientWlanServiceRecord->iWLanDisabledEaps );
       
  1764         }
       
  1765 
       
  1766     iWlanServiceRecord->SetElementId( clientWlanServiceRecord->ElementId() );
  1706 
  1767 
  1707     if ( !iWlanServiceRecord->RecordId() )
  1768     if ( !iWlanServiceRecord->RecordId() )
  1708         {
  1769         {
  1709         iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
  1770         iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
  1710         iWlanServiceRecord->StoreL( iSession );
  1771         iWlanServiceRecord->StoreL( iSession );
  1711         wlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1772 
       
  1773         // Update received element ID to client's copy too.
       
  1774         clientWlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1712         }
  1775         }
  1713     else
  1776     else
  1714         {
  1777         {
  1715         iWlanServiceRecord->ModifyL( iSession );
  1778         iWlanServiceRecord->ModifyL( iSession );
  1716         }
  1779         }
  1727     {
  1790     {
  1728     OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_ENTRY );
  1791     OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_ENTRY );
  1729 
  1792 
  1730     if ( !iWlanServiceRecord )
  1793     if ( !iWlanServiceRecord )
  1731         {
  1794         {
  1732         // IAP not yet in CommDat
  1795         // IAP not yet in CommsDat.
  1733         GetDefaultWlanServiceRecordL( aRecordArray );
  1796         GetDefaultWlanServiceRecordL( aRecordArray );
  1734         }
  1797         }
  1735     else
  1798     else
  1736         {
  1799         {
  1737         CCDWlanServiceRecord* wlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  1800         CCDWlanServiceRecord* wlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  1738         CleanupStack::PushL( wlanServiceRecord );
  1801         CleanupStack::PushL( wlanServiceRecord );
  1739         CopyWlanServiceRecordL( iWlanServiceRecord, wlanServiceRecord );
  1802         CopyWlanServiceRecordL( iWlanServiceRecord, wlanServiceRecord );
  1740         wlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1803         wlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1741         wlanServiceRecord->iWlanServiceId.SetL( iWlanServiceRecord->iWlanServiceId );
       
  1742         aRecordArray.AppendL( wlanServiceRecord );
  1804         aRecordArray.AppendL( wlanServiceRecord );
  1743         CleanupStack::Pop( wlanServiceRecord );
  1805         CleanupStack::Pop( wlanServiceRecord );
  1744         }
  1806         }
  1745 
  1807 
  1746     OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_EXIT );
  1808     OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_EXIT );
  1752 //
  1814 //
  1753 CommsDat::CCDRecordBase* CCmPluginWlan::CopyServiceRecordL()
  1815 CommsDat::CCDRecordBase* CCmPluginWlan::CopyServiceRecordL()
  1754     {
  1816     {
  1755     OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYSERVICERECORDL_ENTRY );
  1817     OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYSERVICERECORDL_ENTRY );
  1756 
  1818 
  1757     __ASSERT_DEBUG( iServiceRecord != NULL, User::Leave( KErrNotFound ));
  1819     // New service record to be returned.
  1758 
  1820     CCDRecordBase* serviceRecord = static_cast<CCDLANServiceRecord*>(
  1759     CCDRecordBase* serviceRecord =
  1821             CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
  1760             static_cast<CCDLANServiceRecord*>(
  1822     CleanupStack::PushL( serviceRecord );
  1761                     CCDRecordBase::CreateCopyRecordL( *iServiceRecord ) );
  1823 
       
  1824     CCDLANServiceRecord* tempServiceRecordPtrToNew =
       
  1825             static_cast<CCDLANServiceRecord*>( serviceRecord );
       
  1826 
       
  1827     // CommsDat version of service record.
       
  1828     CCDLANServiceRecord* origServiceRecord =
       
  1829             static_cast<CCDLANServiceRecord*>( iServiceRecord );
       
  1830 
       
  1831     if ( !origServiceRecord->iRecordTag.IsNull() )
       
  1832         {
       
  1833         tempServiceRecordPtrToNew->iRecordTag.SetL(
       
  1834                 origServiceRecord->iRecordTag );
       
  1835         }
       
  1836     if ( !origServiceRecord->iRecordName.IsNull() )
       
  1837         {
       
  1838         tempServiceRecordPtrToNew->iRecordName.SetL(
       
  1839                 origServiceRecord->iRecordName );
       
  1840         }
       
  1841     if ( !origServiceRecord->iServiceEnableLlmnr.IsNull() )
       
  1842         {
       
  1843         tempServiceRecordPtrToNew->iServiceEnableLlmnr.SetL(
       
  1844                 origServiceRecord->iServiceEnableLlmnr );
       
  1845         }
       
  1846     if ( !origServiceRecord->iIfNetworks.IsNull() )
       
  1847         {
       
  1848         tempServiceRecordPtrToNew->iIfNetworks.SetL(
       
  1849                 origServiceRecord->iIfNetworks );
       
  1850         }
       
  1851     if ( !origServiceRecord->iIpNetmask.IsNull() )
       
  1852         {
       
  1853         tempServiceRecordPtrToNew->iIpNetmask.SetL(
       
  1854                 origServiceRecord->iIpNetmask );
       
  1855         }
       
  1856     if ( !origServiceRecord->iIpGateway.IsNull() )
       
  1857         {
       
  1858         tempServiceRecordPtrToNew->iIpGateway.SetL(
       
  1859                 origServiceRecord->iIpGateway );
       
  1860         }
       
  1861     if ( !origServiceRecord->iIpAddrFromServer.IsNull() )
       
  1862         {
       
  1863         tempServiceRecordPtrToNew->iIpAddrFromServer.SetL(
       
  1864                 origServiceRecord->iIpAddrFromServer );
       
  1865         }
       
  1866     if ( !origServiceRecord->iIpAddr.IsNull() )
       
  1867         {
       
  1868         tempServiceRecordPtrToNew->iIpAddr.SetL(
       
  1869                 origServiceRecord->iIpAddr );
       
  1870         }
       
  1871     if ( !origServiceRecord->iIpDnsAddrFromServer.IsNull() )
       
  1872         {
       
  1873         tempServiceRecordPtrToNew->iIpDnsAddrFromServer.SetL(
       
  1874                 origServiceRecord->iIpDnsAddrFromServer );
       
  1875         }
       
  1876     if ( !origServiceRecord->iIpNameServer1.IsNull() )
       
  1877         {
       
  1878         tempServiceRecordPtrToNew->iIpNameServer1.SetL(
       
  1879                 origServiceRecord->iIpNameServer1 );
       
  1880         }
       
  1881     if ( !origServiceRecord->iIpNameServer2.IsNull() )
       
  1882         {
       
  1883         tempServiceRecordPtrToNew->iIpNameServer2.SetL(
       
  1884                 origServiceRecord->iIpNameServer2 );
       
  1885         }
       
  1886     if ( !origServiceRecord->iIp6DnsAddrFromServer.IsNull() )
       
  1887         {
       
  1888         tempServiceRecordPtrToNew->iIp6DnsAddrFromServer.SetL(
       
  1889                 origServiceRecord->iIp6DnsAddrFromServer );
       
  1890         }
       
  1891     if ( !origServiceRecord->iIp6NameServer1.IsNull() )
       
  1892         {
       
  1893         tempServiceRecordPtrToNew->iIp6NameServer1.SetL(
       
  1894                 origServiceRecord->iIp6NameServer1 );
       
  1895         }
       
  1896     if ( !origServiceRecord->iIp6NameServer2.IsNull() )
       
  1897         {
       
  1898         tempServiceRecordPtrToNew->iIp6NameServer2.SetL(
       
  1899                 origServiceRecord->iIp6NameServer2 );
       
  1900         }
       
  1901     if ( !origServiceRecord->iIpAddrLeaseValidFrom.IsNull() )
       
  1902         {
       
  1903         tempServiceRecordPtrToNew->iIpAddrLeaseValidFrom.SetL(
       
  1904                 origServiceRecord->iIpAddrLeaseValidFrom );
       
  1905         }
       
  1906     if ( !origServiceRecord->iIpAddrLeaseValidTo.IsNull() )
       
  1907         {
       
  1908         tempServiceRecordPtrToNew->iIpAddrLeaseValidTo.SetL(
       
  1909                 origServiceRecord->iIpAddrLeaseValidTo );
       
  1910         }
       
  1911     if ( !origServiceRecord->iConfigDaemonManagerName.IsNull() )
       
  1912         {
       
  1913         tempServiceRecordPtrToNew->iConfigDaemonManagerName.SetL(
       
  1914                 origServiceRecord->iConfigDaemonManagerName );
       
  1915         }
       
  1916     if ( !origServiceRecord->iConfigDaemonName.IsNull() )
       
  1917         {
       
  1918         tempServiceRecordPtrToNew->iConfigDaemonName.SetL(
       
  1919                 origServiceRecord->iConfigDaemonName );
       
  1920         }
       
  1921     if ( !origServiceRecord->iServiceExtensionTableName.IsNull() )
       
  1922         {
       
  1923         tempServiceRecordPtrToNew->iServiceExtensionTableName.SetL(
       
  1924                 origServiceRecord->iServiceExtensionTableName );
       
  1925         }
       
  1926     if ( !origServiceRecord->iServiceExtensionTableRecordId.IsNull() )
       
  1927         {
       
  1928         tempServiceRecordPtrToNew->iServiceExtensionTableRecordId.SetL(
       
  1929                 origServiceRecord->iServiceExtensionTableRecordId );
       
  1930         }
       
  1931 
       
  1932     CleanupStack::Pop( serviceRecord );
  1762 
  1933 
  1763     OstTraceFunctionExit0( CCMPLUGINWLAN_COPYSERVICERECORDL_EXIT );
  1934     OstTraceFunctionExit0( CCMPLUGINWLAN_COPYSERVICERECORDL_EXIT );
  1764     return serviceRecord;
  1935     return serviceRecord;
  1765     }
  1936     }
  1766 
  1937 
  1895     if ( !( aSourceRecord && aDestRecord ) )
  2066     if ( !( aSourceRecord && aDestRecord ) )
  1896         {
  2067         {
  1897         User::Leave( KErrArgument );
  2068         User::Leave( KErrArgument );
  1898         }
  2069         }
  1899 
  2070 
  1900     aDestRecord->iRecordName.SetL( aSourceRecord->iRecordName );
  2071     if ( !aSourceRecord->iRecordTag.IsNull() )
  1901     aDestRecord->iRecordTag.SetL( aSourceRecord->iRecordTag );
  2072         {
  1902     aDestRecord->iWlanConnMode.SetL( aSourceRecord->iWlanConnMode );
  2073         aDestRecord->iRecordTag.SetL( aSourceRecord->iRecordTag );
  1903 
  2074         }
       
  2075     if ( !aSourceRecord->iRecordName.IsNull() )
       
  2076         {
       
  2077         aDestRecord->iRecordName.SetL( aSourceRecord->iRecordName );
       
  2078         }
       
  2079 
       
  2080     if ( !aSourceRecord->iWlanServiceId.IsNull() )
       
  2081         {
       
  2082         aDestRecord->iWlanServiceId.SetL( aSourceRecord->iWlanServiceId );
       
  2083         }
       
  2084     if ( !aSourceRecord->iWlanConnMode.IsNull() )
       
  2085         {
       
  2086         aDestRecord->iWlanConnMode.SetL( aSourceRecord->iWlanConnMode );
       
  2087         }
  1904     if ( !aSourceRecord->iWLanSSID.IsNull() )
  2088     if ( !aSourceRecord->iWLanSSID.IsNull() )
  1905         {
  2089         {
  1906         aDestRecord->iWLanSSID.SetL( aSourceRecord->iWLanSSID );
  2090         aDestRecord->iWLanSSID.SetL( aSourceRecord->iWLanSSID );
  1907         }
  2091         }
  1908     if ( !aSourceRecord->iWLanUsedSSID.IsNull() )
  2092     if ( !aSourceRecord->iWLanUsedSSID.IsNull() )
  2288 void CCmPluginWlan::CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance )
  2472 void CCmPluginWlan::CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance )
  2289     {
  2473     {
  2290     OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYBEARERRECORDSL_ENTRY );
  2474     OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYBEARERRECORDSL_ENTRY );
  2291 
  2475 
  2292     CCmPluginWlan* plugin = static_cast<CCmPluginWlan*>( aCopyInstance );
  2476     CCmPluginWlan* plugin = static_cast<CCmPluginWlan*>( aCopyInstance );
  2293     plugin->iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
  2477     plugin->iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord( iWlanTableId );
  2294 
  2478 
  2295     CopyWlanServiceRecordL( iWlanServiceRecord, plugin->iWlanServiceRecord );
  2479     CopyWlanServiceRecordL( iWlanServiceRecord, plugin->iWlanServiceRecord );
       
  2480     plugin->iWlanServiceRecord->iWlanServiceId.SetL( 0 );
  2296     plugin->iWAPISupported = iWAPISupported;
  2481     plugin->iWAPISupported = iWAPISupported;
  2297 
  2482 
  2298     OstTraceFunctionExit0( CCMPLUGINWLAN_COPYBEARERRECORDSL_EXIT );
  2483     OstTraceFunctionExit0( CCMPLUGINWLAN_COPYBEARERRECORDSL_EXIT );
  2299     }
  2484     }
  2300 
  2485