GuestCtrlImplPrivate.h revision cd5df721f068659172f3bf95de8fedeb465f057d
/** @file
*
* Internal helpers/structures for guest control functionality.
*/
/*
* Copyright (C) 2011-2013 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 "ConsoleImpl.h"
#include <iprt/semaphore.h>
#include <map>
#include <vector>
#ifdef VBOX_WITH_GUEST_CONTROL
#endif
/** Vector holding a process' CPU affinity. */
/** Vector holding process startup arguments. */
/**
* Simple structure mantaining guest credentials.
*/
struct GuestCredentials
{
};
{
void Clear(void);
static void FreeEnvironmentBlock(void *pvEnv);
};
/**
* Structure for keeping all the relevant guest file
* information around.
*/
struct GuestFileOpenInfo
{
/** The filename. */
/** Then file's opening mode. */
/** The file's disposition mode. */
/** Octal creation mode. */
/** The initial offset on open. */
};
/**
* Structure representing information of a
* file system object.
*/
struct GuestFsObjData
{
/** Helper function to extract the data from
* a certin VBoxService tool's guest stream block. */
};
/**
* Structure for keeping all the relevant guest session
* startup parameters around.
*/
{
GuestSessionStartupInfo(void)
: mIsInternal(false /* Non-internal session */),
mOpenFlags(0 /* No opening flags set */) { }
/** The session's friendly name. Optional. */
/** The session's unique ID. Used to encode
* a context ID. */
/** Flag indicating if this is an internal session
* or not. Internal session are not accessible by
* public API clients. */
bool mIsInternal;
/** Timeout (in ms) used for opening the session. */
/** Session opening flags. */
};
/**
* Structure for keeping all the relevant guest process
* startup parameters around.
*/
{
GuestProcessStartupInfo(void)
/** The process' friendly name. */
/** The actual command to execute. */
/** Process creation flags. */
/** Process priority. */
/** Process affinity. At the moment we
* only support 64 VCPUs. API and
* guest can do more already! */
};
/**
* Class representing the "value" side of a "key=value" pair.
*/
{
GuestProcessStreamValue(void) { }
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(void);
virtual ~GuestProcessStreamBlock(void);
void Clear(void);
#ifdef DEBUG
void DumpToLog(void) const;
#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. */
};
{
virtual ~GuestWaitEvent(void);
/* Shutdown indicator. */
bool fAborted;
/* Associated context ID (CID). */
/** List of event types this event should
* be signalled on. */
/** The event semaphore for triggering
* the actual event. */
/** Pointer to the actual event. */
};
{
GuestBase(void);
/** For external event listeners. */
int baseInit(void);
void baseUninit(void);
int cancelWaitEvents(void);
int registerWaitEvent(uint32_t uSessionID, uint32_t uObjectID, const std::list<VBoxEventType_T> &lstEvents, GuestWaitEvent **ppEvent);
int waitForEvent(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, VBoxEventType_T *pType, IEvent **ppEvent);
/** Pointer to the console object. Needed
* for HGCM (VMMDev) communication. */
/** The next upcoming context ID for this object. */
/** Local listener for handling the waiting events
* internally. */
/** Critical section for wait events access. */
/** Map of internal events to wait for. */
};
/**
* Virtual class (interface) for guest objects (processes, files, ...) --
* contains all per-object callback management.
*/
{
GuestObject(void);
virtual ~GuestObject(void);
/** Callback dispatcher -- must be implemented by the actual object. */
virtual int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb) = 0;
/**
* Commom parameters for all derived objects, when then have
* an own mData structure to keep their specific data around.
*/
/** Pointer to parent session. Per definition
* this objects *always* lives shorter than the
* parent. */
/** The object ID -- must be unique for each guest
* object and is encoded into the context ID. Must
* be set manually when initializing the object.
*
* For guest processes this is the internal PID,
* for guest files this is the internal file ID. */
};
#endif // ____H_GUESTIMPLPRIVATE