GuestSessionImpl.h revision b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93c
/* $Id$ */
/** @file
* VirtualBox Main - Guest session handling.
*/
/*
* Copyright (C) 2012-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_GUESTSESSIONIMPL
#define ____H_GUESTSESSIONIMPL
#include "GuestSessionWrap.h"
#include "EventImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "GuestProcessImpl.h"
#include "GuestDirectoryImpl.h"
#include "GuestFileImpl.h"
#include "GuestFsObjInfoImpl.h"
/**
* Abstract base class for a lenghtly per-session operation which
* runs in a Main worker thread.
*/
{
virtual ~GuestSessionTask(void);
int setProgressSuccess(void);
/** Progress object for getting updated when running
* asynchronously. Optional. */
};
/**
* Task for opening a guest session.
*/
{
virtual ~SessionTaskOpen(void);
/** Session creation flags. */
/** Session creation timeout (in ms). */
};
/**
* Task for copying files from host to the guest.
*/
{
virtual ~SessionTaskCopyTo(void);
int Run(void);
};
/**
* Task for copying files from guest to the host.
*/
{
virtual ~SessionTaskCopyFrom(void);
int Run(void);
};
/**
* Task for automatically updating the Guest Additions on the guest.
*/
{
virtual ~SessionTaskUpdateAdditions(void);
int Run(void);
/**
* Suported OS types for automatic updating.
*/
enum eOSType
{
eOSType_Unknown = 0,
eOSType_Windows = 1,
eOSType_Linux = 2,
eOSType_Solaris = 3
};
/**
* Structure representing a file to
* get off the .ISO, copied to the guest.
*/
struct InstallerFile
{
{
}
/** Source file on .ISO. */
/** Destination file on the guest. */
/** File flags. */
/** Optional arguments if this file needs to be
* executed. */
};
const ProcessArguments &aArgumentsSource);
/** Files to handle. */
/** The (optionally) specified Guest Additions .ISO on the host
* which will be used for the updating process. */
/** (Optional) installer command line arguments. */
/** Update flags. */
};
/**
* Guest session implementation.
*/
{
* @{ */
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
/** @} */
// Wrapped GuestSession Properties
// Wrapped GuestSession Methods
/** Map of guest directories. The key specifies the internal directory ID. */
/** Map of guest files. The key specifies the internal file ID. */
/** Map of guest processes. The key specifies the internal process number.
* To retrieve the process' guest PID use the Id() method of the IProcess interface. */
/** @name Public internal methods.
* @{ */
int i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
int i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
const GuestCredentials &i_getCredentials(void);
const GuestEnvironment &i_getEnvironment(void);
HRESULT i_isReadyExternal(void);
int i_onRemove(void);
int i_startSessionInternal(int *pGuestRc);
int i_startSessionAsync(void);
static DECLCALLBACK(int)
int *pGuestRc);
int i_processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
int i_queryInfo(void);
int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
/** @} */
/** Pointer to the parent (Guest). */
/**
* The session's event source. This source is used for
* serving the internal listener as well as all other
* external listeners that may register to it.
*
* Note: This can safely be used without holding any locks.
* An AutoCaller suffices to prevent it being destroy while in use and
* internally there is a lock providing the necessary serialization.
*/
struct Data
{
/** The session credentials. */
/** The session's startup info. */
/** The session's current status. */
/** The session's environment block. Can be
* overwritten/extended by ProcessCreate(Ex). */
/** Directory objects bound to this session. */
/** File objects bound to this session. */
/** Process objects bound to this session. */
/** Guest control protocol version to be used.
* Guest Additions < VBox 4.3 have version 1,
* any newer version will have version 2. */
/** Session timeout (in ms). */
/** Total number of session objects (processes,
* files, ...). */
/** The last returned session status
* returned from the guest side. */
int mRC;
} mData;
};
#endif /* !____H_GUESTSESSIONIMPL */