GuestCtrlImplPrivate.h revision 7b9f0c34e9ea328981c99e97054bdf8684d9d620
/** @file
*
* Internal helpers/structures for guest control functionality.
*/
/*
* Copyright (C) 2011-2012 Oracle Corporation
*
* 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.
*/
#ifndef ____H_GUESTIMPLPRIVATE
#define ____H_GUESTIMPLPRIVATE
#include <iprt/semaphore.h>
#include <map>
#include <vector>
#ifdef VBOX_WITH_GUEST_CONTROL
#endif
#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
/** Maximum number of guest sessions a VM can have. */
#define VBOX_GUESTCTRL_MAX_SESSIONS 255
/** Maximum of guest processes a guest session can have. */
#define VBOX_GUESTCTRL_MAX_PROCESSES 255
/** Maximum of callback contexts a guest process can have. */
/** Builds a context ID out of the session ID, process ID and an
* increasing count. */
)
/** Gets the session ID out of a context ID. */
#define VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID) \
((uContextID) >> 24)
/** Gets the process ID out of a context ID. */
#define VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID) \
/** Gets the conext count of a process out of a context ID. */
#define VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(uContextID) \
((uContextID) & 0xffff)
/** Vector holding a process' CPU affinity. */
/** Vector holding process startup arguments. */
/**
*/
{
GuestCtrlEvent(void);
virtual ~GuestCtrlEvent(void);
/** @todo Copy/comparison operator? */
int Cancel(void);
bool Canceled(void);
int Init(void);
int GetResultCode(void) { return mRC; }
/** Was the callback canceled? */
bool fCanceled;
/** Did the callback complete? */
bool fCompleted;
/** The event semaphore for triggering
* the actual event. */
/** The waiting mutex. */
/** Overall result code. */
int mRC;
};
/*
* Class representing a guest control callback.
*/
{
GuestCtrlCallback(void);
virtual ~GuestCtrlCallback(void);
void Destroy(void);
const void* GetPayloadRaw(void) const { return pvPayload; }
/** Pointer to actual callback data. */
void *pvData;
/** Size of user-supplied data. */
/** The callback type. */
/** Callback flags. */
/** Payload which will be available on successful
* waiting (optional). */
void *pvPayload;
/** Size of the payload. */
};
struct GuestProcessWaitResult
{
/** The wait result when returning from the wait call. */
int mRC;
};
/*
* Class representing a guest control process event.
*/
{
GuestProcessEvent(void);
virtual ~GuestProcessEvent(void);
void Destroy(void);
/** The waiting flag(s). The specifies what to
* wait for. */
/** Structure containing the overall result. */
};
/**
* Simple structure mantaining guest credentials.
*/
struct GuestCredentials
{
};
{
void Clear(void);
static void FreeEnvironmentBlock(void *pvEnv);
};
/**
* Structure for keeping all the relevant process
* starting parameters around.
*/
struct GuestProcessInfo
{
};
/**
* Class representing the "value" side of a "key=value" pair.
*/
{
GuestProcessStreamValue() { }
GuestProcessStreamValue(const char *pszValue)
};
/** Map containing "key=value" pairs of a guest process stream. */
typedef std::map < Utf8Str, GuestProcessStreamValue >::const_iterator GuestCtrlStreamPairMapIterConst;
/**
* Class representing a block of stream pairs (key=value). Each block in a raw guest
* output stream is separated by "\0\0", each pair is separated by "\0". The overall
* end of a guest stream is marked by "\0\0\0\0".
*/
{
//GuestProcessStreamBlock(GuestProcessStreamBlock &);
void Clear();
#ifdef DEBUG
void Dump();
#endif
};
/** Vector containing multiple allocated stream pair objects. */
/**
* Class for parsing machine-readable guest process output by VBoxService'
* toolbox commands ("vbox_ls", "vbox_stat" etc), aka "guest stream".
*/
{
void Destroy();
#ifdef DEBUG
#endif
/** Currently allocated size of internal stream buffer. */
/** Currently used size of allocated internal stream buffer. */
/** Current offset within the internal stream buffer. */
/** Internal stream buffer. */
};
{
enum TaskType
{
/** Copies a file from host to the guest. */
TaskType_CopyFileToGuest = 50,
/** Copies a file from guest to the host. */
/** Update Guest Additions by directly copying the required installer
* off the .ISO file, transfer it to the guest and execute the installer
* with system privileges. */
};
int startThread();
/* Task data. */
};
#endif // ____H_GUESTIMPLPRIVATE