VBoxManageList.cpp revision 65d9eb0b2a96389c8512d1234c02aada7c131531
/* $Id$ */
/** @file
* VBoxManage - The 'list' command.
*/
/*
* Copyright (C) 2006-2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef VBOX_ONLY_DOCS
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBoxManage.h"
using namespace com;
#ifdef VBOX_WITH_HOSTNETIF_API
{
switch (enmType)
{
case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
case HostNetworkInterfaceMediumType_PPP: return "PPP";
case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
}
return "Unknown";
}
{
switch (enmStatus)
{
case HostNetworkInterfaceStatus_Up: return "Up";
case HostNetworkInterfaceStatus_Down: return "Down";
}
return "Unknown";
}
#endif
enum enOptionCodes
{
LISTVMS = 1000,
#if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
#endif
};
static const RTGETOPTDEF g_aListOptions[]
= {
#if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
#endif
};
int handleList(HandlerArg *a)
{
bool fOptLong = false;
int command = 0;
int c;
RTGetOptInit(&GetState, a->argc, a->argv, g_aListOptions, RT_ELEMENTS(g_aListOptions), 0, 0 /* fFlags */);
{
switch (c)
{
case 'l': // --long
fOptLong = true;
break;
case LISTVMS:
case LISTRUNNINGVMS:
case LISTOSTYPES:
case LISTHOSTDVDS:
case LISTHOSTFLOPPIES:
case LISTBRIDGEDIFS:
#if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
case LISTHOSTONLYIFS:
#endif
case LISTHOSTINFO:
case LISTHDDBACKENDS:
case LISTHDDS:
case LISTDVDS:
case LISTFLOPPIES:
case LISTUSBHOST:
case LISTUSBFILTERS:
case LISTSYSTEMPROPERTIES:
if (command)
command = c;
break;
case VINF_GETOPT_NOT_OPTION:
break;
default:
if (c > 0)
else if (ValueUnion.pDef)
else
}
}
if (!command)
/* which object? */
switch (command)
{
case LISTVMS:
{
/*
* Get the list of all registered VMs
*/
{
/*
* Iterate through the collection
*/
{
if (machines [i])
machines[i],
}
}
}
break;
case LISTRUNNINGVMS:
{
/*
* Get the list of all _running_ VMs
*/
{
/*
* Iterate through the collection
*/
{
if (machines [i])
{
{
switch (machineState)
{
case MachineState_Running:
case MachineState_Paused:
machines[i],
}
}
}
}
}
}
break;
case LISTOSTYPES:
{
{
/*
* Iterate through the collection.
*/
{
}
}
}
break;
case LISTHOSTDVDS:
{
{
{
}
}
}
break;
case LISTHOSTFLOPPIES:
{
{
{
}
}
}
break;
case LISTBRIDGEDIFS:
#if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
case LISTHOSTONLYIFS:
#endif
{
#if (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
#else
#endif
{
#ifndef VBOX_WITH_HOSTNETIF_API
#else /* VBOX_WITH_HOSTNETIF_API */
RTPrintf("IPAddress: %d.%d.%d.%d\n",
RTPrintf("NetworkMask: %d.%d.%d.%d\n",
((uint8_t*)&NetworkMask)[0],
#endif
}
}
break;
case LISTHOSTINFO:
{
RTPrintf("Host Information:\n\n");
char pszTime[30] = {0};
ULONG processorCount = 0;
ULONG processorSpeed = 0;
for (ULONG i = 0; i < processorCount; i++)
{
if (processorSpeed)
else
#if 0 /* not yet implemented in Main */
#endif
}
#if 0 /* not yet implemented in Main */
ULONG memorySize = 0;
ULONG memoryAvailable = 0;
#endif
}
break;
case LISTHDDBACKENDS:
{
RTPrintf("Supported hard disk backends:\n\n");
{
/* General information */
RTPrintf("Backend %u: id='%ls' description='%ls' capabilities=%#06x extensions='",
/* File extensions */
{
RTPrintf (",");
}
RTPrintf ("'");
/* Configuration keys */
RTPrintf (" properties=(");
if (propertyNames.size() > 0)
{
{
RTPrintf ("\n name='%ls' desc='%ls' type=",
switch (propertyTypes [a])
{
}
RTPrintf (", ");
}
}
RTPrintf (")\n");
}
}
break;
case LISTHDDS:
{
{
/// @todo NEWMEDIA check accessibility of all parents
/// @todo NEWMEDIA print the full state value
{
RTPrintf("%s%lS (UUID: %RTuuid)\n",
j == 0 ? "Usage: " : " ",
}
/// @todo NEWMEDIA check usage in snapshots too
/// @todo NEWMEDIA also list children and say 'differencing' for
/// hard disks with the parent or 'base' otherwise.
RTPrintf("\n");
}
}
break;
case LISTDVDS:
{
{
/** @todo usage */
RTPrintf("\n");
}
}
break;
case LISTFLOPPIES:
{
{
/** @todo usage */
RTPrintf("\n");
}
}
break;
case LISTUSBHOST:
{
RTPrintf("Host USB Devices:\n\n");
return rc;
if (!fMore)
{
RTPrintf("<none>\n\n");
}
else
while (fMore)
{
return rc;
/* Query info. */
RTPrintf("UUID: %S\n"
"VendorId: 0x%04x (%04X)\n"
"ProductId: 0x%04x (%04X)\n"
"Revision: %u.%u (%02u%02u)\n",
/* optional stuff. */
/* current state */
const char *pszState = "?";
switch (state)
{
pszState = "Not supported"; break;
pszState = "Unavailable"; break;
case USBDeviceState_Busy:
pszState = "Busy"; break;
case USBDeviceState_Available:
pszState = "Available"; break;
case USBDeviceState_Held:
pszState = "Held"; break;
case USBDeviceState_Captured:
pszState = "Captured"; break;
default:
ASSERT (false);
break;
}
return rc;
}
}
break;
case LISTUSBFILTERS:
{
RTPrintf("Global USB Device Filters:\n\n");
{
RTPrintf("<none>\n\n");
}
else
{
{
/* Query info. */
const char *pszAction = "<invalid>";
switch (action)
{
pszAction = "Ignore";
break;
pszAction = "Hold";
break;
default:
break;
}
}
}
}
break;
case LISTSYSTEMPROPERTIES:
{
}
break;
} // end switch
}
#endif /* !VBOX_ONLY_DOCS */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */