VBoxManageGuestCtrl.cpp revision 468c2bcb36eb9a032f5dd0fcb34db10bd58e9996
/* $Id$ */
/** @file
* VBoxManage - The 'guestcontrol' command.
*/
/*
* Copyright (C) 2010 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBoxManage.h"
#ifdef USE_XPCOM_QUEUE
# include <errno.h>
#endif
#ifdef RT_OS_DARWIN
# include <CoreFoundation/CFRunLoop.h>
#endif
using namespace com;
/**
* IVirtualBoxCallback implementation for handling the GuestControlCallback in
* relation to the "guestcontrol * wait" command.
*/
/** @todo */
void usageGuestControl(void)
{
RTPrintf("VBoxManage guestcontrol execute <vmname>|<uuid>\n"
" <path to program> [--arguments \"<arguments>\"] [--environment \"NAME=VALUE NAME=VALUE\"]\n"
" [--flags <flags>] [--username <name> [--password <password>]]\n"
" [--timeout <msec>]\n"
"\n");
}
static int handleExecProgram(HandlerArg *a)
{
/*
* Check the syntax. We can deduce the correct syntax from the number of
* arguments.
*/
bool usageOK = true;
uint32_t uTimeoutMS = 0;
/* Iterate through all possible commands (if available). */
{
{
if (i + 1 >= a->argc)
usageOK = false;
else
{
++i;
}
}
{
if (i + 1 >= a->argc)
usageOK = false;
else
{
char **papszArg;
int cArgs;
if (RT_SUCCESS(rc))
{
for (int a = 0; a < cArgs; a++)
}
++i;
}
}
{
if ( i + 1 >= a->argc
usageOK = false;
else
++i;
}
{
if (i + 1 >= a->argc)
usageOK = false;
else
{
++i;
}
}
{
if (i + 1 >= a->argc)
usageOK = false;
else
{
++i;
}
}
{
if ( i + 1 >= a->argc
usageOK = false;
else
++i;
}
/** @todo Add fancy piping stuff here. */
else
{
return errorSyntax(USAGE_GUESTCONTROL,
}
}
if (!usageOK)
/* If a password was specified, check if we also got a user name. */
if ( !Utf8Password.isEmpty()
&& Utf8UserName.isEmpty())
{
return errorSyntax(USAGE_GUESTCONTROL,
"No user name for password specified!");
}
/* lookup VM. */
/* assume it's an UUID */
{
/* must be a name */
}
if (machine)
{
do
{
/* open an existing session for VM - so the VM has to be running */
/* get the mutable session machine */
/* get the associated console */
/** @todo Show some progress here? */
} while (0);
}
}
/**
* Access the guest control store.
*
* @returns 0 on success, 1 on failure
* @note see the command line API description for parameters
*/
int handleGuestControl(HandlerArg *a)
{
HandlerArg arg = *a;
if (a->argc == 0)
/* switch (cmd) */
return handleExecProgram(&arg);
/* default: */
}