Changeset 48461 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- Sep 12, 2013 6:14:50 PM (11 years ago)
- Location:
- trunk/src/VBox/NetworkServices/DHCP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/DHCP/Config.cpp
r48420 r48461 432 432 } 433 433 434 int ConfigurationManager::setString(uint8_t u8OptId, const std::string& str) 435 { 436 switch (u8OptId) 437 { 438 case RTNET_DHCP_OPT_DOMAIN_NAME: 439 m_domainName = str; 440 break; 441 default: 442 break; 443 } 444 445 return VINF_SUCCESS; 446 } 447 448 const std::string& ConfigurationManager::getString(uint8_t u8OptId) 449 { 450 switch (u8OptId) 451 { 452 case RTNET_DHCP_OPT_DOMAIN_NAME: 453 if (m_domainName.length()) 454 return m_domainName; 455 else 456 return m_noString; 457 default: 458 break; 459 } 460 461 return m_noString; 462 } 463 434 464 /** 435 465 * Network manager … … 726 756 break; 727 757 case RTNET_DHCP_OPT_DOMAIN_NAME: 758 { 759 std::string domainName = g_ConfigurationManager->getString(pReqList[idxParam]); 760 if (domainName == g_ConfigurationManager->m_noString) 761 break; 762 763 char *pszDomainName = (char *)&opt.au8RawOpt[0]; 764 765 strcpy(pszDomainName, domainName.c_str()); 766 opt.cbRawOpt = domainName.length(); 767 client->rawOptions.push_back(opt); 768 } 728 769 break; 729 770 default: -
trunk/src/VBox/NetworkServices/DHCP/Config.h
r48432 r48461 398 398 int addToAddressList(uint8_t u8OptId, RTNETADDRIPV4& address); 399 399 int flushAddressList(uint8_t u8OptId); 400 int setString(uint8_t u8OptId, const std::string& str); 401 const std::string& getString(uint8_t u8OptId); 400 402 const Ipv4AddressContainer& getAddressList(uint8_t u8OptId); 401 403 402 404 private: 403 405 ConfigurationManager(){} 404 406 virtual ~ConfigurationManager(){} 405 406 407 bool isAddressTaken(const RTNETADDRIPV4& addr, Lease** ppLease = NULL); 408 409 public: 410 /* nulls */ 411 const Ipv4AddressContainer m_empty; 412 const std::string m_noString; 413 414 private: 407 415 MapLease2Ip4Address m_allocations; 408 416 /** 409 417 * Here we can store expired Leases to do not re-allocate them latter. 410 418 */ 419 411 420 /* XXX: MapLease2Ip4Address m_freed; */ 412 /* 413 * 414 */ 421 /* XXX: more universal storages are required. */ 415 422 Ipv4AddressContainer m_nameservers; 416 423 Ipv4AddressContainer m_routers; 417 Ipv4AddressContainer m_empty; 424 425 426 std::string m_domainName; 418 427 VecClient m_clients; 419 428 -
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r48430 r48461 463 463 } 464 464 strs.setNull(); 465 466 Bstr domain;467 if (SUCCEEDED(host->COMGETTER(DomainName)(domain.asOutPutParam())))468 {469 /* XXX: todo. */470 }471 465 #endif 466 com::Bstr domain; 467 if (SUCCEEDED(host->COMGETTER(DomainName)(domain.asOutParam()))) 468 confManager->setString(RTNET_DHCP_OPT_DOMAIN_NAME, std::string(com::Utf8Str(domain).c_str())); 469 470 472 471 } 473 472 }
Note:
See TracChangeset
for help on using the changeset viewer.