Changeset 54314 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 19, 2015 9:32:18 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 98389
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DHCPServerImpl.h
r50174 r54314 21 21 #define ____H_H_DHCPSERVERIMPL 22 22 23 #include <VBox/settings.h> 23 24 #include "DHCPServerWrap.h" 24 25 … … 27 28 #endif 28 29 29 namespace settings30 {31 struct DHCPServer;32 struct VmNameSlotKey;33 }34 30 #ifdef RT_OS_WINDOWS 35 31 # define DHCP_EXECUTABLE_NAME "VBoxNetDHCP.exe" … … 62 58 */ 63 59 64 typedef std::map<DhcpOpt_T, com::Utf8Str> DhcpOptionMap; 65 typedef DhcpOptionMap::value_type DhcpOptValuePair; 66 typedef DhcpOptionMap::const_iterator DhcpOptConstIterator; 67 typedef DhcpOptionMap::iterator DhcpOptIterator; 60 using settings::DhcpOptValue; 61 using settings::DhcpOptionMap; 62 using settings::DhcpOptValuePair; 63 using settings::DhcpOptConstIterator; 64 using settings::DhcpOptIterator; 68 65 69 typedef std::map<settings::VmNameSlotKey, DhcpOptionMap>VmSlot2OptionsMap;70 typedef VmSlot2OptionsMap::value_typeVmSlot2OptionsPair;71 typedef VmSlot2OptionsMap::iteratorVmSlot2OptionsIterator;66 using settings::VmSlot2OptionsMap; 67 using settings::VmSlot2OptionsPair; 68 using settings::VmSlot2OptionsIterator; 72 69 73 70 -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r54284 r54314 108 108 unconst(mName) = aName; 109 109 m->IPAddress = "0.0.0.0"; 110 m->GlobalDhcpOptions .insert(DhcpOptValuePair(DhcpOpt_SubnetMask, Bstr("0.0.0.0")));110 m->GlobalDhcpOptions[DhcpOpt_SubnetMask] = DhcpOptValue("0.0.0.0"); 111 111 m->enabled = FALSE; 112 112 … … 222 222 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 223 223 224 aNetworkMask = m->GlobalDhcpOptions[DhcpOpt_SubnetMask] ;224 aNetworkMask = m->GlobalDhcpOptions[DhcpOpt_SubnetMask].text; 225 225 return S_OK; 226 226 } … … 294 294 for (it = m->GlobalDhcpOptions.begin(); it != m->GlobalDhcpOptions.end(); ++it, ++i) 295 295 { 296 aValue[i] = Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str()); 296 uint32_t OptCode = (*it).first; 297 const DhcpOptValue &OptValue = (*it).second; 298 299 // XXX: TODO: factor out and share with getVmSlotOptions() 300 if (OptValue.encoding == DhcpOptValue::LEGACY) 301 aValue[i] = Utf8StrFmt("%d:%s", OptCode, OptValue.text.c_str()); 297 302 } 298 303 … … 356 361 for (it = map.begin(); it != map.end(); ++it, ++i) 357 362 { 358 aValues[i] = com::Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str()); 363 uint32_t OptCode = (*it).first; 364 const DhcpOptValue &OptValue = (*it).second; 365 366 // XXX: TODO: factor out and share with getGlobalOptions() 367 if (OptValue.encoding == DhcpOptValue::LEGACY) 368 aValues[i] = com::Utf8StrFmt("%d:%s", OptCode, OptValue.text.c_str()); 359 369 } 360 370 … … 436 446 m->dhcp.setOption(NetworkServiceRunner::kNsrMacAddress, strMAC); 437 447 m->dhcp.setOption(NetworkServiceRunner::kNsrIpAddress, Utf8Str(m->IPAddress).c_str()); 438 m->dhcp.setOption(NetworkServiceRunner::kNsrIpNetmask, Utf8Str(m->GlobalDhcpOptions[DhcpOpt_SubnetMask] ).c_str());448 m->dhcp.setOption(NetworkServiceRunner::kNsrIpNetmask, Utf8Str(m->GlobalDhcpOptions[DhcpOpt_SubnetMask].text).c_str()); 439 449 m->dhcp.setOption(DHCPServerRunner::kDsrKeyLowerIp, Utf8Str(m->lowerIP).c_str()); 440 450 m->dhcp.setOption(DHCPServerRunner::kDsrKeyUpperIp, Utf8Str(m->upperIP).c_str()); -
trunk/src/VBox/Main/xml/Settings.cpp
r52959 r54314 1346 1346 if ( pelmServer->getAttributeValue("networkName", srv.strNetworkName) 1347 1347 && pelmServer->getAttributeValue("IPAddress", srv.strIPAddress) 1348 && pelmServer->getAttributeValue("networkMask", srv.GlobalDhcpOptions[DhcpOpt_SubnetMask] )1348 && pelmServer->getAttributeValue("networkMask", srv.GlobalDhcpOptions[DhcpOpt_SubnetMask].text) 1349 1349 && pelmServer->getAttributeValue("lowerIP", srv.strIPLower) 1350 1350 && pelmServer->getAttributeValue("upperIP", srv.strIPUpper) … … 1385 1385 { 1386 1386 DhcpOpt_T OptName; 1387 com::Utf8Str OptValue; 1387 com::Utf8Str OptText; 1388 int32_t OptEnc = DhcpOptValue::LEGACY; 1389 1388 1390 opt->getAttributeValue("name", (uint32_t&)OptName); 1389 1391 … … 1391 1393 continue; 1392 1394 1393 opt->getAttributeValue("value", OptValue); 1394 1395 map.insert(std::map<DhcpOpt_T, Utf8Str>::value_type(OptName, OptValue)); 1395 opt->getAttributeValue("value", OptText); 1396 opt->getAttributeValue("encoding", OptEnc); 1397 1398 map[OptName] = DhcpOptValue(OptText, (DhcpOptValue::Encoding)OptEnc); 1396 1399 } /* end of forall("Option") */ 1397 1400 … … 1535 1538 #endif 1536 1539 srv.strIPAddress = "192.168.56.100"; 1537 srv.GlobalDhcpOptions[DhcpOpt_SubnetMask] = "255.255.255.0";1540 srv.GlobalDhcpOptions[DhcpOpt_SubnetMask] = DhcpOptValue("255.255.255.0"); 1538 1541 srv.strIPLower = "192.168.56.101"; 1539 1542 srv.strIPUpper = "192.168.56.254"; … … 1597 1600 pelmThis->setAttribute("IPAddress", d.strIPAddress); 1598 1601 if (itOpt != d.GlobalDhcpOptions.end()) 1599 pelmThis->setAttribute("networkMask", itOpt->second );1602 pelmThis->setAttribute("networkMask", itOpt->second.text); 1600 1603 pelmThis->setAttribute("lowerIP", d.strIPLower); 1601 1604 pelmThis->setAttribute("upperIP", d.strIPUpper); … … 1622 1625 1623 1626 pelmOpt->setAttribute("name", itOpt->first); 1624 pelmOpt->setAttribute("value", itOpt->second); 1627 pelmOpt->setAttribute("value", itOpt->second.text); 1628 if (itOpt->second.encoding != DhcpOptValue::LEGACY) 1629 pelmOpt->setAttribute("encoding", (int)itOpt->second.encoding); 1625 1630 } 1626 1631 } /* end of if */ … … 1644 1649 xml::ElementNode *pelmOpt = pelmCfg->createChild("Option"); 1645 1650 pelmOpt->setAttribute("name", itOpt1->first); 1646 pelmOpt->setAttribute("value", itOpt1->second); 1651 pelmOpt->setAttribute("value", itOpt1->second.text); 1652 if (itOpt1->second.encoding != DhcpOptValue::LEGACY) 1653 pelmOpt->setAttribute("encoding", (int)itOpt1->second.encoding); 1647 1654 } 1648 1655 }
Note:
See TracChangeset
for help on using the changeset viewer.