Changeset 87596 in vbox for trunk/src/VBox/NetworkServices/NAT
- Timestamp:
- Feb 3, 2021 11:28:21 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r87549 r87596 162 162 virtual ~VBoxNetLwipNAT(); 163 163 164 static int logInit(int argc, char **argv);165 166 164 virtual void usage() { /** @todo should be implemented */ }; 167 165 virtual int parseOpt(int c, const RTGETOPTUNION &Value); … … 173 171 174 172 private: 173 int logInit(); 174 175 175 static void reportError(const char *a_pcszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 176 176 … … 327 327 return rc; 328 328 329 /* 330 * We get the network name on the command line. Get hold of our 331 * API object. 332 */ 329 333 const std::string &networkName = getNetworkName(); 330 334 hrc = virtualbox->FindNATNetworkByName(com::Bstr(networkName.c_str()).raw(), … … 335 339 return VERR_NOT_FOUND; 336 340 } 341 342 /* 343 * Now that we know the network name we can create the release log file. 344 */ 345 logInit(); 337 346 338 347 … … 1455 1464 */ 1456 1465 /* static */ 1457 int VBoxNetLwipNAT::logInit( int argc, char **argv)1466 int VBoxNetLwipNAT::logInit() 1458 1467 { 1459 1468 size_t cch; … … 1471 1480 return rc; 1472 1481 1473 const char *pcszNetwork = NULL; 1474 1475 // XXX: This duplicates information from VBoxNetBaseService.cpp. 1476 // Perhaps option definitions should be exported as public static 1477 // member of VBoxNetBaseService? 1478 static const RTGETOPTDEF s_aOptions[] = { 1479 { "--network", 'n', RTGETOPT_REQ_STRING } 1480 }; 1481 1482 RTGETOPTSTATE GetState; 1483 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 1484 RTGETOPTINIT_FLAGS_NO_STD_OPTS); 1485 1486 RTGETOPTUNION ValueUnion; 1487 int ch; 1488 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 1489 { 1490 if (ch == 'n') 1491 { 1492 pcszNetwork = ValueUnion.psz; 1493 break; 1494 } 1495 } 1496 1497 if (pcszNetwork == NULL) 1482 const std::string &strNetworkName = getNetworkName(); 1483 if (strNetworkName.empty()) 1498 1484 return VERR_MISSING; 1499 1485 1500 1486 char szNetwork[RTPATH_MAX]; 1501 rc = RTStrCopy(szNetwork, sizeof(szNetwork), pcszNetwork);1487 rc = RTStrCopy(szNetwork, sizeof(szNetwork), strNetworkName.c_str()); 1502 1488 if (RT_FAILURE(rc)) 1503 1489 return rc; … … 1596 1582 #endif 1597 1583 1598 VBoxNetLwipNAT::logInit(argc, argv);1599 1600 1584 hrc = com::Initialize(); 1601 1585 if (FAILED(hrc))
Note:
See TracChangeset
for help on using the changeset viewer.