VBoxManageList.cpp revision de6f12007a5c09564d4b4407bd3e9df0129a9cb1
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VBoxManage - The 'list' command.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * Copyright (C) 2006-2013 Oracle Corporation
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * available from http://www.virtualbox.org. This file is free software;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * you can redistribute it and/or modify it under the terms of the GNU
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * General Public License (GPL) as published by the Free Software
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/*******************************************************************************
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync* Header Files *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync*******************************************************************************/
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncusing namespace com;
040eebbbf0272a4d453d065b43f48d42ef65e85dvboxsyncstatic const char *getHostIfMediumTypeText(HostNetworkInterfaceMediumType_T enmType)
8de87f7db22211252c825b454da596a978fc5b05vboxsync case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsync case HostNetworkInterfaceMediumType_PPP: return "PPP";
a75c803e0b9f358a664e831c5deced4152847d66vboxsync case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsync return "Unknown";
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsyncstatic const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus)
e41f0459369a6d814aa36bf4def225482fc56026vboxsync case HostNetworkInterfaceStatus_Down: return "Down";
e41f0459369a6d814aa36bf4def225482fc56026vboxsync return "Unknown";
e41f0459369a6d814aa36bf4def225482fc56026vboxsync#endif /* VBOX_WITH_HOSTNETIF_API */
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncstatic const char*getDeviceTypeText(DeviceType_T enmType)
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync return "Unknown";
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * List network interfaces information (bridged/host only).
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @returns See produceList.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @param pVirtualBox Reference to the IVirtualBox smart pointer.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncstatic HRESULT listNetworkInterfaces(const ComPtr<IVirtualBox> pVirtualBox,
bool fIsBridged)
#if defined(VBOX_WITH_NETFLT)
if (fIsBridged)
#ifndef VBOX_WITH_HOSTNETIF_API
return rc;
RTPrintf("Host time: %s\n", RTTimeSpecToString(RTTimeSpecSetMilli(&timeSpec, u64UtcTime), szTime, sizeof(szTime)));
if (processorSpeed)
return rc;
const char *pszParentUUIDStr,
bool fOptLong)
return rc;
DescribeFileExtensions(ComSafeArrayAsOutParam(fileExtensions), ComSafeArrayAsOutParam(deviceTypes)));
switch (propertyTypes[j])
return rc;
switch (state)
case USBDeviceState_Busy:
case USBDeviceState_Available:
case USBDeviceState_Held:
case USBDeviceState_Captured:
ASSERT(false);
return rc;
switch (action)
return rc;
return S_OK;
CHECK_ERROR2_RET(pVirtualBox, COMGETTER(ExtensionPackManager)(ptrExtPackMgr.asOutParam()), hrcCheck);
CHECK_ERROR2_RET(ptrExtPackMgr, COMGETTER(InstalledExtPacks)(ComSafeArrayAsOutParam(extPacks)), hrcCheck);
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Name)(bstrName.asOutParam()), hrc = hrcCheck; bstrName.setNull());
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Description)(bstrDesc.asOutParam()), hrc = hrcCheck; bstrDesc.setNull());
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Version)(bstrVersion.asOutParam()), hrc = hrcCheck; bstrVersion.setNull());
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(Edition)(bstrEdition.asOutParam()), hrc = hrcCheck; bstrEdition.setNull());
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(VRDEModule)(bstrVrdeModule.asOutParam()),hrc=hrcCheck; bstrVrdeModule.setNull());
CHECK_ERROR2_STMT(extPacks[i], COMGETTER(WhyUnusable)(bstrWhy.asOutParam()), hrc = hrcCheck; bstrWhy.setNull());
return hrc;
return S_OK;
enum enmListType
#if defined(VBOX_WITH_NETFLT)
static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, const ComPtr<IVirtualBox> &pVirtualBox)
switch (enmCommand)
case kListNotSpecified:
AssertFailed();
return E_FAIL;
case kListVMs:
if (machines[i])
case kListRunningVMs:
rc = pVirtualBox->GetMachineStates(ComSafeArrayAsInParam(machines), ComSafeArrayAsOutParam(states));
if (machines[i])
switch (machineState)
case MachineState_Running:
case MachineState_Teleporting:
case MachineState_Paused:
case kListOsTypes:
case kListHostDvds:
case kListHostFloppies:
case kListBridgedInterfaces:
#if defined(VBOX_WITH_NETFLT)
case kListHostOnlyInterfaces:
case kListHostInfo:
case kListHostCpuIDs:
CHECK_ERROR(Host, GetProcessorCPUIDLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
cLeafs++;
case kListHddBackends:
case kListHdds:
case kListDvds:
case kListFloppies:
case kListUsbHost:
case kListUsbFilters:
case kListSystemProperties:
case kListDhcpServers:
case kListExtPacks:
case kListGroups:
return rc;
bool fOptLong = false;
bool fOptMultiple = false;
#if defined(VBOX_WITH_NETFLT)
int ch;
switch (ch)
fOptLong = true;
fOptMultiple = true;
case kListVMs:
case kListRunningVMs:
case kListOsTypes:
case kListHostDvds:
case kListHostFloppies:
case kListBridgedInterfaces:
#if defined(VBOX_WITH_NETFLT)
case kListHostOnlyInterfaces:
case kListHostInfo:
case kListHostCpuIDs:
case kListHddBackends:
case kListHdds:
case kListDvds:
case kListFloppies:
case kListUsbHost:
case kListUsbFilters:
case kListSystemProperties:
case kListDhcpServers:
case kListExtPacks:
case kListGroups:
if (fOptMultiple)
case VINF_GETOPT_NOT_OPTION:
if (!fOptMultiple)