GuestSessionImpl.h revision 5050fc8de0b121eab1b738d7c1007cde4903284d
/* $Id$ */
/** @file
* VirtualBox Main - XXX.
*/
/*
* Copyright (C) 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_GUESTSESSIONIMPL
#define ____H_GUESTSESSIONIMPL
#include "VirtualBoxBase.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 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. */
};
/** Files to handle. */
/** The (optionally) specified Guest Additions .ISO on the host
* which will be used for the updating process. */
/** Update flags. */
};
/**
* Guest session implementation.
*/
{
* @{ */
int init(Guest *aGuest, ULONG aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
/** @} */
/** @name IGuestSession properties.
* @{ */
/** @} */
/** @name IGuestSession methods.
* @{ */
STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress);
STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress);
STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ComSafeArrayIn(DirectoryCreateFlag_T, aFlags));
STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, BSTR *aDirectory);
STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, ComSafeArrayIn(DirectoryOpenFlag_T, aFlags), IGuestDirectory **aDirectory);
STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
STDMETHOD(EnvironmentClear)(void);
STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, IGuestFile **aFile);
STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
/** @} */
/** 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 directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
int objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, const Utf8Str &strName, int *pGuestRc);
int directoryOpenInternal(const Utf8Str &strPath, const Utf8Str &strFilter, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory);
int fileOpenInternal(const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition,
const GuestCredentials &getCredentials(void);
const GuestEnvironment &getEnvironment(void);
int startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress);
int queryInfo(void);
/** @} */
struct Data
{
/** Guest control protocol version to be used.
* Guest Additions < VBox 4.2 have version 1,
* any newer version will have version 2. */
/** Flag indicating if this is an internal session
* or not. Internal session are not accessible by clients. */
bool fInternal;
/** Pointer to the parent (Guest). */
/** The session credentials. */
/** The (optional) session name. */
/** The session ID. */
/** The session timeout. Default is 30s. */
/** 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. */
/** Total number of session objects (processes,
* files, ...). */
} mData;
};
#endif /* !____H_GUESTSESSIONIMPL */