GuestSessionImpl.h revision e378dfdadd62aadc0a012c9953322d979d7606e6
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox Main - XXX.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Copyright (C) 2012 Oracle Corporation
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * available from http://www.virtualbox.org. This file is free software;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * General Public License (GPL) as published by the Free Software
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name COM and internal init/term/mapping cruft.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestSession, IGuestSession)
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync int init(Guest *aGuest, ULONG aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name IGuestSession properties.
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name IGuestSession methods.
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ComSafeArrayIn(DirectoryCreateFlag_T, aFlags), IGuestDirectory **aDirectory);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(DirectoryQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(DirectorySetACL)(IN_BSTR aPath, IN_BSTR aACL);
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync STDMETHOD(EnvironmentGet)(IN_BSTR aName, BSTR *aValue);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(EnvironmentSet)(IN_BSTR aName, IN_BSTR aValue);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(EnvironmentSetArray)(ComSafeArrayIn(IN_BSTR, aValues));
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(FileSetACL)(IN_BSTR aPath, IN_BSTR aACL);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync STDMETHOD(ProcessGet)(ULONG aPID, IGuestProcess **aProcess);
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(SymlinkCreate)(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync STDMETHOD(SymlinkExists)(IN_BSTR aSymlink, BOOL *aExists);
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync typedef std::vector <ComObjPtr<GuestDirectory> > SessionDirectories;
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync typedef std::vector <ComObjPtr<GuestFile> > SessionFiles;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync /** Map of guest processes. The key specifies the internal process number.
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name Public internal methods.
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync int directoryClose(ComObjPtr<GuestDirectory> pDirectory);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync int directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync int dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync int fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync int fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize);
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync uint32_t getProtocolVersion(void) { return mData.mProtocolVersion; }
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync int processClose(ComObjPtr<GuestProcess> pProcess);
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync int processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
24ef2ade0f53030e73f5b4e43f52892b03f7915dvboxsync inline bool processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync inline int processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** Guest control protocol version to be used.
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync * Guest Additions < VBox 4.2 have version 1,
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync * any newer version will have version 2. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** Flag indicating if this is an internal session
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync * or not. Internal session are not accessible by clients. */
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync /** Pointer to the parent (Guest). */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** The session credentials. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** The (optional) session name. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** The session ID. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** The session timeout. Default is 30s. */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** The next process ID for assignment. */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** The session's environment block. Can be
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync * overwritten/extended by ProcessCreate(Ex). */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** Directory objects bound to this session. */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** File objects bound to this session. */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** Process objects bound to this session. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* !____H_GUESTSESSIONIMPL */