Changeset 17961 in vbox for trunk/src/VBox/Main/ConsoleImpl2.cpp
- Timestamp:
- Mar 16, 2009 5:47:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r17946 r17961 1809 1809 } 1810 1810 1811 // ComPtr<IDhcpServer> dhcpServer; 1812 // hrc = virtualBox->FindDhcpServerByName(networkName.mutableRaw(), dhcpServer.asOutParam()); 1813 // if(FAILED(hrc)) 1814 // { 1815 // LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Id) failed, hrc (0x%x)", hrc)); 1816 // H(); 1817 // } 1811 if(!networkName.isNull()) 1812 { 1813 ComPtr<IDhcpServer> dhcpServer; 1814 hrc = virtualBox->FindDhcpServerByName(networkName.mutableRaw(), dhcpServer.asOutParam()); 1815 if(SUCCEEDED(hrc)) 1816 { 1817 /* there is a DHCP server available for this network */ 1818 BOOL bEnabled; 1819 hrc = dhcpServer->COMGETTER(Enabled)(&bEnabled); 1820 if(FAILED(hrc)) 1821 { 1822 LogRel(("DHCP svr: COMGETTER(Enabled) failed, hrc (0x%x)", hrc)); 1823 H(); 1824 } 1825 1826 if(bEnabled) 1827 { 1828 Bstr ip, mask, lowerIp, upperIp; 1829 1830 hrc = dhcpServer->COMGETTER(IPAddress)(ip.asOutParam()); 1831 if(FAILED(hrc)) 1832 { 1833 LogRel(("DHCP svr: COMGETTER(IPAddress) failed, hrc (0x%x)", hrc)); 1834 H(); 1835 } 1836 1837 hrc = dhcpServer->COMGETTER(NetworkMask)(mask.asOutParam()); 1838 if(FAILED(hrc)) 1839 { 1840 LogRel(("DHCP svr: COMGETTER(NetworkMask) failed, hrc (0x%x)", hrc)); 1841 H(); 1842 } 1843 1844 hrc = dhcpServer->COMGETTER(LowerIP)(lowerIp.asOutParam()); 1845 if(FAILED(hrc)) 1846 { 1847 LogRel(("DHCP svr: COMGETTER(LowerIP) failed, hrc (0x%x)", hrc)); 1848 H(); 1849 } 1850 1851 hrc = dhcpServer->COMGETTER(UpperIP)(upperIp.asOutParam()); 1852 if(FAILED(hrc)) 1853 { 1854 LogRel(("DHCP svr: COMGETTER(UpperIP) failed, hrc (0x%x)", hrc)); 1855 H(); 1856 } 1857 1858 char strMAC[13]; 1859 Guid guid; 1860 guid.create(); 1861 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 1862 guid.ptr()->au8[0], guid.ptr()->au8[1], guid.ptr()->au8[2]); 1863 1864 rc = CFGMR3InsertString(pCfg, "DhcpIPAddress", Utf8Str(ip).raw()); RC_CHECK(); 1865 rc = CFGMR3InsertString(pCfg, "DhcpNetworkMask", Utf8Str(mask).raw()); RC_CHECK(); 1866 rc = CFGMR3InsertString(pCfg, "DhcpLowerIP", Utf8Str(lowerIp).raw()); RC_CHECK(); 1867 rc = CFGMR3InsertString(pCfg, "DhcpUpperIP", Utf8Str(upperIp).raw()); RC_CHECK(); 1868 rc = CFGMR3InsertString(pCfg, "DhcpMacAddress", strMAC); RC_CHECK(); 1869 } 1870 } 1871 else 1872 { 1873 hrc = S_OK; 1874 } 1875 } 1818 1876 1819 1877 }
Note:
See TracChangeset
for help on using the changeset viewer.