VirtualBox

Changeset 46969 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Jul 4, 2013 6:35:01 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86977
Message:

backed out r86967,r86968,r86969,r86970,r86971,r86972,r86973,r86975,r86976.
will fix build locally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r46959 r46969  
    13021302            if (    (pelmServer->getAttributeValue("networkName", srv.strNetworkName))
    13031303                 && (pelmServer->getAttributeValue("IPAddress", srv.strIPAddress))
    1304                     && (pelmServer->getAttributeValue("networkMask", srv.GlobalDhcpOptions[DhcpOpt_SubnetMask]))
     1304                 && (pelmServer->getAttributeValue("networkMask", srv.strIPNetworkMask))
    13051305                 && (pelmServer->getAttributeValue("lowerIP", srv.strIPLower))
    13061306                 && (pelmServer->getAttributeValue("upperIP", srv.strIPUpper))
    13071307                 && (pelmServer->getAttributeValue("enabled", srv.fEnabled))
    13081308               )
    1309             {
    1310                 xml::NodesLoop nlOptions(*pelmServer, "Options");
    1311                 const xml::ElementNode *options;
    1312                 /* XXX: Options are in 1:1 relation to DHCPServer */
    1313 
    1314                 while ((options = nlOptions.forAllNodes()))
    1315                 {
    1316                     readDhcpOptions(srv.GlobalDhcpOptions, *options);
    1317                 } /* end of forall("Options") */
    1318                 xml::NodesLoop nlConfig(*pelmServer, "Config");
    1319                 const xml::ElementNode *cfg;
    1320                 while ((cfg = nlConfig.forAllNodes()))
    1321                 {
    1322                     com::Utf8Str strVmName;
    1323                     uint32_t u32Slot;
    1324                     cfg->getAttributeValue("vm-name", strVmName);
    1325                     cfg->getAttributeValue("slot", (uint32_t&)u32Slot);
    1326                     readDhcpOptions(srv.VmSlot2OptionsM[VmNameSlotKey(strVmName, u32Slot)],
    1327                                    *cfg);
    1328                 }
    13291309                llDhcpServers.push_back(srv);
    1330             }
    13311310            else
    13321311                throw ConfigFileError(this, pelmServer, N_("Required DHCPServer/@networkName, @IPAddress, @networkMask, @lowerIP, @upperIP or @enabled attribute is missing"));
    13331312        }
    13341313    }
    1335 }
    1336 
    1337 void MainConfigFile::readDhcpOptions(DhcpOptionMap& map,
    1338                                      const xml::ElementNode& options)
    1339 {
    1340     xml::NodesLoop nl2(options, "Option");
    1341     const xml::ElementNode *opt;
    1342     while((opt = nl2.forAllNodes()))
    1343     {
    1344         DhcpOpt_T OptName;
    1345         com::Utf8Str OptValue;
    1346         opt->getAttributeValue("name", (uint32_t&)OptName);
    1347 
    1348         if (OptName == DhcpOpt_SubnetMask)
    1349             continue;
    1350 
    1351         opt->getAttributeValue("value", OptValue);
    1352                    
    1353         map.insert(
    1354           std::map<DhcpOpt_T, Utf8Str>::value_type(OptName, OptValue));
    1355     } /* end of forall("Option") */
    1356 
    13571314}
    13581315
     
    14891446#endif
    14901447        srv.strIPAddress = "192.168.56.100";
    1491         srv.GlobalDhcpOptions[DhcpOpt_SubnetMask] = "255.255.255.0";
     1448        srv.strIPNetworkMask = "255.255.255.0";
    14921449        srv.strIPLower = "192.168.56.101";
    14931450        srv.strIPUpper = "192.168.56.254";
     
    15321489        const DHCPServer &d = *it;
    15331490        xml::ElementNode *pelmThis = pelmDHCPServers->createChild("DHCPServer");
    1534         DhcpOptConstIterator itOpt;
    1535         itOpt = d.GlobalDhcpOptions.find(DhcpOpt_SubnetMask);
    1536 
    15371491        pelmThis->setAttribute("networkName", d.strNetworkName);
    15381492        pelmThis->setAttribute("IPAddress", d.strIPAddress);
    1539         if (itOpt != d.GlobalDhcpOptions.end())
    1540             pelmThis->setAttribute("networkMask", itOpt->second);
     1493        pelmThis->setAttribute("networkMask", d.strIPNetworkMask);
    15411494        pelmThis->setAttribute("lowerIP", d.strIPLower);
    15421495        pelmThis->setAttribute("upperIP", d.strIPUpper);
    15431496        pelmThis->setAttribute("enabled", (d.fEnabled) ? 1 : 0);        // too bad we chose 1 vs. 0 here
    1544         /* We assume that if there're only 1 element it means that */
    1545         int cOpt = d.GlobalDhcpOptions.size();
    1546         /* We don't want duplicate validation check of networkMask here*/
    1547         if (   (   itOpt == d.GlobalDhcpOptions.end()
    1548                 && cOpt > 0)
    1549             || cOpt > 1)
    1550         {
    1551             xml::ElementNode *pelmOptions = pelmThis->createChild("Options");
    1552             for (itOpt = d.GlobalDhcpOptions.begin();
    1553                  itOpt != d.GlobalDhcpOptions.end();
    1554                  ++itOpt)
    1555             {
    1556                 if (itOpt->first == DhcpOpt_SubnetMask)
    1557                     continue;
    1558                
    1559                 xml::ElementNode *pelmOpt = pelmOptions->createChild("Option");
    1560                
    1561                 if (!pelmOpt)
    1562                     break;
    1563                
    1564                 pelmOpt->setAttribute("name", itOpt->first);
    1565                 pelmOpt->setAttribute("value", itOpt->second);
    1566             }
    1567         } /* end of if */
    1568        
    1569         if (d.VmSlot2OptionsM.size() > 0)
    1570         {
    1571             VmSlot2OptionsConstIterator itVmSlot;
    1572             DhcpOptConstIterator itOpt1;
    1573             for(itVmSlot = d.VmSlot2OptionsM.begin();
    1574                 itVmSlot != d.VmSlot2OptionsM.end();
    1575                 ++itVmSlot)
    1576             {
    1577                 xml::ElementNode *pelmCfg = pelmThis->createChild("Config");
    1578                 pelmCfg->setAttribute("vm-name", itVmSlot->first.VmName);
    1579                 pelmCfg->setAttribute("slot", itVmSlot->first.Slot);
    1580                
    1581                 for (itOpt1 = itVmSlot->second.begin();
    1582                      itOpt1 != itVmSlot->second.end();
    1583                      ++itOpt1)
    1584                 {
    1585                     xml::ElementNode *pelmOpt = pelmCfg->createChild("Option");
    1586                     pelmOpt->setAttribute("name", itOpt1->first);
    1587                     pelmOpt->setAttribute("value", itOpt1->second);
    1588                 }
    1589             }
    1590         } /* and of if */
    1591 
    1592      }
     1497    }
    15931498
    15941499    /* TODO: bump main version ? */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette