Changeset 60501 in vbox
- Timestamp:
- Apr 14, 2016 4:17:45 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106611
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r60315 r60501 5 5 6 6 /* 7 * Copyright (C) 2006-201 5Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1339 1339 "%s natnetwork %s start --netname <name>\n\n" 1340 1340 "%s natnetwork %s stop --netname <name>\n" 1341 "\n", SEP, SEP, SEP, SEP, SEP); 1341 "%s natnetwork %s list [<pattern>]\n" 1342 "\n", SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP, SEP); 1342 1343 1343 1344 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageNATNetwork.cpp
r57358 r60501 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 83 83 typedef std::vector<std::string> LOOPBACK2DELETEADD; 84 84 typedef LOOPBACK2DELETEADD::iterator LOOPBACK2DELETEADDITERATOR; 85 86 static HRESULT printNATNetwork(const ComPtr<INATNetwork> &pNATNet) 87 { 88 HRESULT rc; 89 90 do 91 { 92 Bstr strVal; 93 CHECK_ERROR_BREAK(pNATNet, COMGETTER(NetworkName)(strVal.asOutParam())); 94 RTPrintf("Name: %ls\n", strVal.raw()); 95 CHECK_ERROR_BREAK(pNATNet, COMGETTER(Network)(strVal.asOutParam())); 96 RTPrintf("Network: %ls\n", strVal.raw()); 97 CHECK_ERROR_BREAK(pNATNet, COMGETTER(Gateway)(strVal.asOutParam())); 98 RTPrintf("Gateway: %ls\n", strVal.raw()); 99 BOOL fVal; 100 CHECK_ERROR_BREAK(pNATNet, COMGETTER(IPv6Enabled)(&fVal)); 101 RTPrintf("IPv6: %s\n", fVal ? "Yes" : "No"); 102 if (fVal) 103 { 104 CHECK_ERROR_BREAK(pNATNet, COMGETTER(IPv6Prefix)(strVal.asOutParam())); 105 RTPrintf("IPv6 Prefix: %s\n", strVal.raw()); 106 } 107 CHECK_ERROR_BREAK(pNATNet, COMGETTER(Enabled)(&fVal)); 108 RTPrintf("Enabled: %s\n", fVal ? "Yes" : "No"); 109 /** @todo Add more information here. */ 110 RTPrintf("\n"); 111 112 } while (0); 113 114 return rc; 115 } 116 117 static RTEXITCODE handleList(HandlerArg *a) 118 { 119 HRESULT rc; 120 121 RTPrintf("NAT Networks:\n\n"); 122 123 const char *pszFilter = NULL; 124 if (a->argc > 1) 125 pszFilter = a->argv[1]; 126 127 size_t cFound = 0; 128 129 com::SafeIfaceArray<INATNetwork> arrNetNets; 130 CHECK_ERROR(a->virtualBox, COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(arrNetNets))); 131 for (size_t i = 0; i < arrNetNets.size(); ++i) 132 { 133 ComPtr<INATNetwork> pNATNet = arrNetNets[i]; 134 135 if (pszFilter) 136 { 137 Bstr strVal; 138 CHECK_ERROR_BREAK(pNATNet, COMGETTER(NetworkName)(strVal.asOutParam())); 139 140 Utf8Str strValUTF8 = Utf8Str(strVal); 141 if (!RTStrSimplePatternMatch(pszFilter, strValUTF8.c_str())) 142 continue; 143 } 144 145 if (i > 0) 146 RTPrintf("\n"); 147 rc = printNATNetwork(pNATNet); 148 if (FAILED(rc)) 149 break; 150 151 cFound++; 152 } 153 154 if (SUCCEEDED(rc)) 155 RTPrintf("%zu %s found\n", cFound, cFound == 1 ? "network" : "networks"); 156 157 return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; 158 } 85 159 86 160 static RTEXITCODE handleOp(HandlerArg *a, OPCODE enmCode) … … 440 514 else if (strcmp(a->argv[0], "stop") == 0) 441 515 rcExit = handleOp(a, OP_STOP); 516 else if (strcmp(a->argv[0], "list") == 0) 517 rcExit = handleList(a); 442 518 else 443 519 rcExit = errorSyntax(USAGE_NATNETWORK, "Invalid parameter '%s'", Utf8Str(a->argv[0]).c_str());
Note:
See TracChangeset
for help on using the changeset viewer.