Changeset 79617 in vbox
- Timestamp:
- Jul 9, 2019 12:38:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDHCPServer.cpp
r79616 r79617 39 39 #include "VBoxManage.h" 40 40 41 #include <string>42 41 #include <vector> 43 42 #include <map> … … 75 74 * Structures and Typedefs * 76 75 *********************************************************************************************************************************/ 76 /** Pointer to a dhcpserver command context. */ 77 typedef struct DHCPDCMDCTX *PDHCPDCMDCTX; 78 77 79 /** 78 80 * Definition of a dhcpserver command, with handler and various flags. … … 88 90 * @param pCtx Pointer to command context to use. 89 91 */ 90 DECLR3CALLBACKMEMBER(RTEXITCODE, pfnHandler, ( struct DHCPDCMDCTX *pCtx, int argc, char **argv));92 DECLR3CALLBACKMEMBER(RTEXITCODE, pfnHandler, (PDHCPDCMDCTX pCtx, int argc, char **argv)); 91 93 92 94 /** The sub-command scope flags. */ … … 110 112 const char *pszInterface; 111 113 } DHCPDCMDCTX; 112 /** Pointer to a dhcpserver command context. */ 113 typedef DHCPDCMDCTX *PDHCPDCMDCTX; 114 115 typedef std::pair<DhcpOpt_T, std::string> DhcpOptSpec; 114 115 typedef std::pair<DhcpOpt_T, Utf8Str> DhcpOptSpec; 116 116 typedef std::vector<DhcpOptSpec> DhcpOpts; 117 117 typedef DhcpOpts::iterator DhcpOptIterator; … … 122 122 struct VmNameSlotKey 123 123 { 124 const std::stringVmName;124 const Utf8Str VmName; 125 125 uint8_t u8Slot; 126 126 127 VmNameSlotKey(const std::string&aVmName, uint8_t aSlot)127 VmNameSlotKey(const Utf8Str &aVmName, uint8_t aSlot) 128 128 : VmName(aVmName) 129 129 , u8Slot(aSlot) … … 319 319 if (RT_FAILURE(vrc)) 320 320 return errorFetchValue(1, "--add-opt", vrc, &ValueUnion); 321 pScopeOptions->push_back(DhcpOptSpec((DhcpOpt_T)idAddOpt, std::string(ValueUnion.psz)));321 pScopeOptions->push_back(DhcpOptSpec((DhcpOpt_T)idAddOpt, Utf8Str(ValueUnion.psz))); 322 322 break; 323 323 } … … 346 346 if (!fNeedValueOrRemove) 347 347 return errorSyntax("--value without --id=dhcp-opt-no"); 348 pScopeOptions->push_back(DhcpOptSpec((DhcpOpt_T)u8OptId, std::string(ValueUnion.psz)));348 pScopeOptions->push_back(DhcpOptSpec((DhcpOpt_T)u8OptId, Utf8Str(ValueUnion.psz))); 349 349 fNeedValueOrRemove = false; 350 350 break; … … 438 438 439 439 if (!pszDhcpdIp) 440 { 440 441 CHECK_ERROR2_RET(hrc, svr, COMGETTER(IPAddress)(bstrDhcpdIp.asOutParam()), RTEXITCODE_FAILURE); 442 } 441 443 if (!pszNetmask) 444 { 442 445 CHECK_ERROR2_RET(hrc, svr, COMGETTER(NetworkMask)(bstrNetmask.asOutParam()), RTEXITCODE_FAILURE); 446 } 443 447 if (!pszLowerIp) 448 { 444 449 CHECK_ERROR2_RET(hrc, svr, COMGETTER(LowerIP)(bstrNetmask.asOutParam()), RTEXITCODE_FAILURE); 450 } 445 451 if (!pszUpperIp) 452 { 446 453 CHECK_ERROR2_RET(hrc, svr, COMGETTER(UpperIP)(bstrNetmask.asOutParam()), RTEXITCODE_FAILURE); 454 } 447 455 448 456 CHECK_ERROR2_STMT(hrc, svr, SetConfiguration(bstrDhcpdIp.raw(), bstrNetmask.raw(), bstrLowerIp.raw(), bstrUpperIp.raw()), … … 451 459 452 460 if (fEnabled >= 0) 461 { 453 462 CHECK_ERROR2_STMT(hrc, svr, COMSETTER(Enabled)((BOOL)fEnabled), rcExit = RTEXITCODE_FAILURE); 463 } 454 464 455 465 /* Remove options: */ 456 466 for (DhcpOptIdIterator itOptId = GlobalDhcpOptions2Delete.begin(); itOptId != GlobalDhcpOptions2Delete.end(); ++itOptId) 467 { 457 468 CHECK_ERROR2_STMT(hrc, svr, RemoveGlobalOption(*itOptId), rcExit = RTEXITCODE_FAILURE); 469 } 458 470 459 471 for (VmSlot2OptionIdsIterator itIdVector = VmSlot2Options2Delete.begin(); 460 472 itIdVector != VmSlot2Options2Delete.end(); ++itIdVector) 473 { 461 474 for (DhcpOptIdIterator itOptId = itIdVector->second.begin(); itOptId != itIdVector->second.end(); ++itOptId) 475 { 462 476 CHECK_ERROR2_STMT(hrc, svr, RemoveVmSlotOption(Bstr(itIdVector->first.VmName.c_str()).raw(), 463 477 itIdVector->first.u8Slot, *itOptId), 464 478 rcExit = RTEXITCODE_FAILURE); 479 } 480 } 465 481 466 482 /* Global Options */ 467 483 for (DhcpOptIterator itOpt = GlobalDhcpOptions.begin(); itOpt != GlobalDhcpOptions.end(); ++itOpt) 484 { 468 485 CHECK_ERROR2_STMT(hrc, svr, AddGlobalOption(itOpt->first, com::Bstr(itOpt->second.c_str()).raw()), 469 486 rcExit = RTEXITCODE_FAILURE); 487 } 470 488 471 489 /* VM slot options. */ 472 490 for (VmSlot2OptionsIterator it = VmSlot2Options.begin(); it != VmSlot2Options.end(); ++it) 491 { 473 492 for (DhcpOptIterator itOpt = it->second.begin(); itOpt != it->second.end(); ++itOpt) 493 { 474 494 CHECK_ERROR2_STMT(hrc, svr, AddVmSlotOption(Bstr(it->first.VmName.c_str()).raw(), it->first.u8Slot, itOpt->first, 475 495 com::Bstr(itOpt->second.c_str()).raw()), 476 496 rcExit = RTEXITCODE_FAILURE); 497 } 498 } 477 499 478 500 return rcExit;
Note:
See TracChangeset
for help on using the changeset viewer.

