Changeset 42160 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Jul 16, 2012 11:41:10 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79137
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r40575 r42160 1 1 /** @file 2 2 * 3 * VirtualBox Guest Control - Private data definitions / classes.3 * Internal helpers/structures for guest control functionality. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2011 Oracle Corporation7 * Copyright (C) 2011-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_GUESTIMPLPRIVATE 20 20 21 #include <iprt/semaphore.h> 22 21 23 #include <VBox/com/com.h> 24 #include <VBox/com/ErrorInfo.h> 22 25 #include <VBox/com/string.h> 23 26 #include <VBox/com/VirtualBox.h> … … 33 36 #endif 34 37 35 class Guest; 36 class Progress; 37 38 /** Structure representing the "value" side of a "key=value" pair. */ 38 39 /* Builds a context ID out of the session ID, process ID and an 40 * increasing count. */ 41 #define VBOX_GUESTCTRL_CONTEXTID_MAKE(uSession, uProcess, uCount) \ 42 ( (uint32_t)((uSession) & 0xff) << 24 \ 43 | (uint32_t)((uProcess) & 0xff) << 16 \ 44 | (uint32_t)((uCount) & 0xffff) \ 45 ) 46 47 48 typedef std::vector <LONG> ProcessAffinity; 49 typedef std::vector <Utf8Str> ProcessArguments; 50 typedef std::map <Utf8Str, Utf8Str> ProcessEnvironmentMap; 51 52 53 /** 54 * Generic class for a all guest control callbacks. 55 */ 56 class GuestCtrlCallback 57 { 58 public: 59 60 GuestCtrlCallback(void); 61 62 GuestCtrlCallback(eVBoxGuestCtrlCallbackType enmType); 63 64 virtual ~GuestCtrlCallback(void); 65 66 /** @todo Copy/comparison operator? */ 67 68 public: 69 70 int Init(eVBoxGuestCtrlCallbackType enmType); 71 72 void Destroy(void); 73 74 eVBoxGuestCtrlCallbackType Type(void); 75 76 int Wait(RTMSINTERVAL timeoutMS); 77 78 protected: 79 80 /** The callback type. */ 81 eVBoxGuestCtrlCallbackType mType; 82 /** Callback flags. */ 83 uint32_t mFlags; 84 /** Pointer to user-supplied data. */ 85 void *pvData; 86 /** Size of user-supplied data. */ 87 size_t cbData; 88 /** The event semaphore triggering the*/ 89 RTSEMEVENT mEventSem; 90 /** Extended error information, if any. */ 91 ErrorInfo mErrorInfo; 92 }; 93 typedef std::map <uint32_t, GuestCtrlCallback> GuestCtrlCallbacks; 94 95 /** 96 * Simple structure mantaining guest credentials. 97 */ 98 class GuestCredentials 99 { 100 public: 101 102 103 public: 104 105 Utf8Str mUser; 106 Utf8Str mPassword; 107 Utf8Str mDomain; 108 }; 109 110 /** 111 * Structure for keeping all the relevant process 112 * starting parameters around. 113 */ 114 struct GuestProcessInfo 115 { 116 Utf8Str mCommand; 117 ProcessArguments mArguments; 118 ProcessEnvironmentMap mEnvironment; 119 uint32_t mFlags; 120 ULONG mTimeoutMS; 121 ProcessPriority_T mPriority; 122 ProcessAffinity mAffinity; 123 }; 124 125 /** 126 * Class representing the "value" side of a "key=value" pair. 127 */ 39 128 class GuestProcessStreamValue 40 129 { … … 144 233 BYTE *m_pbBuffer; 145 234 }; 235 236 class Guest; 237 class Progress; 146 238 147 239 class GuestTask -
trunk/src/VBox/Main/include/GuestImpl.h
r42105 r42160 4 4 5 5 /* 6 * Copyright (C) 2006-201 1Oracle Corporation6 * Copyright (C) 2006-2012 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 205 205 /** @name Public internal methods. 206 206 * @{ */ 207 int sessionClose(ComObjPtr<GuestSession> pSession); 207 Console *getConsole(void) { return mParent; } 208 int sessionClose(ComObjPtr<GuestSession> pSession); 209 int sessionCreate(const Utf8Str &strUser, const Utf8Str &aPassword, const Utf8Str &aDomain, 210 const Utf8Str &aSessionName, IGuestSession **aGuestSession); 211 inline bool sessionExists(uint32_t uSessionID); 208 212 /** @} */ 209 213 … … 303 307 typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> >::const_iterator FacilityMapIterConst; 304 308 305 typedef std::list <ComObjPtr<GuestSession> > GuestSessions; 309 /** Map for keeping the guest sessions. The primary key marks the guest session ID. */ 310 typedef std::map <uint32_t, ComObjPtr<GuestSession> > GuestSessions; 306 311 307 312 struct Data … … 320 325 Bstr mInterfaceVersion; 321 326 GuestSessions mGuestSessions; 327 uint32_t mNextSessionID; 322 328 }; 323 329 -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42117 r42160 21 21 22 22 #include "VirtualBoxBase.h" 23 #include "GuestCtrlImplPrivate.h" 23 24 24 #include <vector> 25 26 typedef std::vector<Utf8Str> StringsArray; 27 25 class Console; 28 26 class GuestSession; 29 27 … … 47 45 DECLARE_EMPTY_CTOR_DTOR(GuestProcess) 48 46 49 int init(GuestSession *pSession, 50 const Utf8Str &aCommand, const StringsArray &aArguments, const StringsArray &aEnvironment, 51 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, 52 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity)); 47 int init(Console *aConsole, GuestSession *aSession, uint32_t aProcessID, const GuestProcessInfo &aProcInfo); 53 48 void uninit(void); 54 49 HRESULT FinalConstruct(void); … … 74 69 /** @name Public internal methods. 75 70 * @{ */ 71 int callbackAdd(const GuestCtrlCallback& theCallback, uint32_t *puContextID); 72 bool callbackExists(uint32_t uContextID); 73 bool isReady(void); 74 int prepareExecuteEnv(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnvVars); 75 int readData(ULONG aHandle, ULONG aSize, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData)); 76 int startProcess(void); 77 static DECLCALLBACK(int) GuestProcess::startProcessThread(RTTHREAD Thread, void *pvUser); 78 int terminateProcess(void); 79 int waitFor(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitReason_T *aReason); 80 int writeData(ULONG aHandle, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten); 76 81 /** @} */ 77 82 78 83 private: 79 84 80 typedef std::map <Utf8Str, Utf8Str> MyStringMap;81 82 85 struct Data 83 86 { 84 GuestSession *mParent; 85 Bstr mName; 87 /** Pointer to parent session. */ 88 GuestSession *mParent; 89 /** Pointer to the console object. Needed 90 * for HGCM (VMMDev) communication. */ 91 Console *mConsole; 92 /** All related callbacks to this process. */ 93 GuestCtrlCallbacks mCallbacks; 94 /** The process start information. */ 95 GuestProcessInfo mProcess; 96 /** Exit code if process has been terminated. */ 97 LONG mExitCode; 98 /** PID reported from the guest. */ 99 ULONG mPID; 100 /** Internal, host-side process ID. */ 101 uint32_t mProcessID; 102 /** The current process status. */ 103 ProcessStatus_T mStatus; 104 /** Flag indicating whether the process has been started. */ 105 bool mStarted; 106 /** The next upcoming context ID. */ 107 uint32_t mNextContextID; 86 108 } mData; 87 109 }; -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r42117 r42160 22 22 #include "VirtualBoxBase.h" 23 23 24 #include "GuestCtrlImplPrivate.h" 24 25 #include "GuestProcessImpl.h" 25 26 #include "GuestDirectoryImpl.h" 26 27 #include "GuestFileImpl.h" 27 28 #include "GuestFsObjInfoImpl.h" 28 29 #include <map>30 #include <vector>31 32 typedef std::vector<Utf8Str> StringsArray;33 29 34 30 class Guest; … … 52 48 DECLARE_EMPTY_CTOR_DTOR(GuestSession) 53 49 54 int init(Guest *aGuest, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);50 int init(Guest *aGuest, uint32_t aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName); 55 51 void uninit(void); 56 52 HRESULT FinalConstruct(void); … … 115 111 /** @name Public internal methods. 116 112 * @{ */ 117 int directoryClose(ComObjPtr<GuestDirectory> pDirectory); 118 int fileClose(ComObjPtr<GuestFile> pFile); 119 int processClose(ComObjPtr<GuestProcess> pProcess); 120 int processCreateExInteral(const Utf8Str &aCommand, const StringsArray &aArguments, const StringsArray &aEnvironment, 121 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, 122 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity), 123 IGuestProcess **aProcess); 113 int directoryClose(ComObjPtr<GuestDirectory> pDirectory); 114 int fileClose(ComObjPtr<GuestFile> pFile); 115 const GuestCredentials &getCredentials(void); 116 int processClose(ComObjPtr<GuestProcess> pProcess); 117 int processCreateExInteral(GuestProcessInfo &aProcInfo, IGuestProcess **aProcess); 118 inline bool processExists(uint32_t uProcessID); 124 119 /** @} */ 125 120 … … 128 123 typedef std::map <Utf8Str, Utf8Str> SessionEnvironment; 129 124 130 typedef std:: list<ComObjPtr<GuestDirectory> > SessionDirectories;131 typedef std:: list<ComObjPtr<GuestFile> > SessionFiles;132 typedef std:: list <ComObjPtr<GuestProcess> > SessionProcesses;125 typedef std::vector <ComObjPtr<GuestDirectory> > SessionDirectories; 126 typedef std::vector <ComObjPtr<GuestFile> > SessionFiles; 127 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses; 133 128 134 129 struct Data … … 137 132 * or not. Internal session are not accessible by clients. */ 138 133 bool fInternal; 139 /** Pointer to the parent ( IGuest). */134 /** Pointer to the parent (Guest). */ 140 135 Guest *mParent; 141 136 /** The session credentials. */ 142 Utf8Str mUser; 143 Utf8Str mPassword; 144 Utf8Str mDomain; 137 GuestCredentials mCredentials; 145 138 /** The (optional) session name. */ 146 139 Utf8Str mName;
Note:
See TracChangeset
for help on using the changeset viewer.