Changeset 42354 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Jul 24, 2012 12:13:00 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79433
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r42272 r42354 19 19 #define ____H_GUESTIMPLPRIVATE 20 20 21 #include <iprt/asm.h> 21 22 #include <iprt/semaphore.h> 22 23 … … 67 68 68 69 /** 69 * Generic class for a all guest control callbacks. 70 */ 71 class GuestCtrlCallback 72 { 73 public: 74 70 * Generic class for a all guest control callbacks/events. 71 */ 72 class GuestCtrlEvent 73 { 74 public: 75 76 GuestCtrlEvent(void); 77 78 virtual ~GuestCtrlEvent(void); 79 80 /** @todo Copy/comparison operator? */ 81 82 public: 83 84 int Cancel(void); 85 86 bool Canceled(void); 87 88 virtual void Destroy(void); 89 90 int Init(void); 91 92 virtual int Signal(int rc = VINF_SUCCESS); 93 94 int GetResultCode(void) { return mRC; } 95 96 int Wait(ULONG uTimeoutMS); 97 98 protected: 99 100 /** Was the callback canceled? */ 101 bool fCanceled; 102 /** Did the callback complete? */ 103 bool fCompleted; 104 /** The event semaphore for triggering 105 * the actual event. */ 106 RTSEMEVENT hEventSem; 107 /** The waiting mutex. */ 108 RTSEMMUTEX hEventMutex; 109 /** Overall result code. */ 110 int mRC; 111 }; 112 113 /* 114 * Class representing a guest control callback. 115 */ 116 class GuestCtrlCallback : public GuestCtrlEvent 117 { 118 public: 75 119 GuestCtrlCallback(void); 76 120 … … 79 123 virtual ~GuestCtrlCallback(void); 80 124 81 /** @todo Copy/comparison operator? */ 82 83 public: 84 85 int Cancel(void); 86 87 bool Canceled(void); 125 public: 126 127 void Destroy(void); 88 128 89 129 int Init(eVBoxGuestCtrlCallbackType enmType); 90 130 91 void Destroy(void); 92 93 int Signal(int rc = VINF_SUCCESS, const Utf8Str &strMsg = ""); 94 95 Utf8Str GetMessage(void) { return mMessage; } 96 97 int GetResultCode(void) { return mRC; } 98 99 eVBoxGuestCtrlCallbackType GetType(void) { return mType; } 100 101 int Wait(ULONG uTimeoutMS); 102 103 protected: 104 131 eVBoxGuestCtrlCallbackType GetCallbackType(void) { return mType; } 132 133 protected: 134 135 /** Pointer to user-supplied data. */ 136 void *pvData; 137 /** Size of user-supplied data. */ 138 size_t cbData; 105 139 /** The callback type. */ 106 140 eVBoxGuestCtrlCallbackType mType; 107 141 /** Callback flags. */ 108 142 uint32_t uFlags; 109 /** Was the callback canceled? */ 110 bool fCanceled; 111 /** Did the callback complete? */ 112 bool fCompleted; 113 /** Pointer to user-supplied data. */ 114 void *pvData; 115 /** Size of user-supplied data. */ 116 size_t cbData; 117 /** The event semaphore triggering the*/ 118 RTSEMEVENT hEventSem; 119 /** Overall result code. */ 143 }; 144 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 145 146 struct GuestProcessWaitResult 147 { 148 /** The wait result when returning from the wait call. */ 149 ProcessWaitResult_T mResult; 120 150 int mRC; 121 /** Error / information message to the 122 * result code. */ 123 Utf8Str mMessage; 124 }; 125 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 151 }; 152 153 /* 154 * Class representing a guest control process event. 155 */ 156 class GuestProcessEvent : public GuestCtrlEvent 157 { 158 public: 159 GuestProcessEvent(void); 160 161 GuestProcessEvent(uint32_t uWaitFlags); 162 163 virtual ~GuestProcessEvent(void); 164 165 public: 166 167 void Destroy(void); 168 169 int Init(uint32_t uWaitFlags); 170 171 uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mWaitFlags); } 172 173 GuestProcessWaitResult GetResult(void) { return mWaitResult; } 174 175 int Signal(ProcessWaitResult enmResult, int rc = VINF_SUCCESS); 176 177 protected: 178 179 /** The waiting flag(s). The specifies what to 180 * wait for. */ 181 uint32_t mWaitFlags; 182 /** Structure containing the overall result. */ 183 GuestProcessWaitResult mWaitResult; 184 }; 126 185 127 186 /** -
trunk/src/VBox/Main/include/GuestImpl.h
r42214 r42354 209 209 int sessionClose(ComObjPtr<GuestSession> pSession); 210 210 int sessionCreate(const Utf8Str &strUser, const Utf8Str &aPassword, const Utf8Str &aDomain, 211 const Utf8Str &aSessionName, IGuestSession **aGuestSession);211 const Utf8Str &aSessionName, ComObjPtr<GuestSession> &pGuestSession); 212 212 inline bool sessionExists(uint32_t uSessionID); 213 213 /** @} */ -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42272 r42354 62 62 STDMETHOD(Read)(ULONG aHandle, ULONG aSize, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData)); 63 63 STDMETHOD(Terminate)(void); 64 STDMETHOD(WaitFor)(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitRe ason_T *aReason);64 STDMETHOD(WaitFor)(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitResult_T *aReason); 65 65 STDMETHOD(Write)(ULONG aHandle, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten); 66 66 /** @} */ … … 69 69 /** @name Public internal methods. 70 70 * @{ */ 71 int callbackAdd(GuestCtrlCallback *pCallback, ULONG *puContextID);72 71 int callbackDispatcher(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData); 73 72 inline bool callbackExists(ULONG uContextID); 73 void close(void); 74 74 bool isReady(void); 75 75 ULONG getPID(void) { return mData.mPID; } 76 int readData(ULONG uHandle, ULONG uSize, ULONG uTimeoutMS, BYTE *pbData, size_t cbData); 77 int startProcess(void); 78 int startProcessAsync(void); 79 int terminateProcess(void); 80 int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestProcessWaitResult &guestResult); 81 HRESULT waitResultToErrorEx(const GuestProcessWaitResult &waitResult, bool fLog); 82 int writeData(ULONG uHandle, BYTE const *pbData, size_t cbData, ULONG uTimeoutMS, ULONG *puWritten); 83 /** @} */ 84 85 protected: 86 /** @name Protected internal methods. 87 * @{ */ 88 inline int callbackAdd(GuestCtrlCallback *pCallback, ULONG *puContextID); 89 inline int callbackRemove(ULONG uContextID); 76 90 int onGuestDisconnected(GuestCtrlCallback *pCallback, PCALLBACKDATACLIENTDISCONNECTED pData); 77 91 int onProcessInputStatus(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECINSTATUS pData); … … 79 93 int onProcessOutput(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECOUT pData); 80 94 int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 81 int readData(ULONG uHandle, ULONG uSize, ULONG uTimeoutMS, BYTE *pbData, size_t cbData);82 95 int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms); 83 int signalWaiters(int rc, const Utf8Str strMessage = ""); 84 int startProcess(int *pRC = NULL, Utf8Str *pstrMessage = NULL); 96 int signalWaiters(ProcessWaitResult enmWaitResult, int rc = VINF_SUCCESS); 85 97 static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser); 86 int terminateProcess(void);87 int waitFor(uint32_t fFlags, ULONG uTimeoutMS, ProcessWaitReason_T *penmReason);88 int writeData(ULONG uHandle, BYTE const *pbData, size_t cbData, ULONG uTimeoutMS, ULONG *puWritten);89 98 /** @} */ 90 99 … … 110 119 /** The current process status. */ 111 120 ProcessStatus_T mStatus; 112 /** Flag indicating whether the process has been started. */ 121 /** Flag indicating whether the process has been started 122 * so that it can't be started a second time. */ 113 123 bool mStarted; 114 124 /** The next upcoming context ID. */ 115 125 ULONG mNextContextID; 116 /** Flag indicating someone is waiting for an event. */ 117 bool mWaiting; 118 /** The waiting mutex. */ 119 RTSEMMUTEX mWaitMutex; 120 /** The waiting flag(s). */ 121 uint32_t mWaitFlags; 122 /** The waiting event. */ 123 RTSEMEVENT mWaitEvent; 126 /** How many waiters? At the moment there can only 127 * be one. */ 128 uint32_t mWaitCount; 129 /** The actual process event for doing the waits. 130 * At the moment we only support one wait a time. */ 131 GuestProcessEvent *mWaitEvent; 124 132 } mData; 125 133 }; -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r42272 r42354 126 126 const GuestEnvironment &getEnvironment(void); 127 127 int processClose(ComObjPtr<GuestProcess> pProcess); 128 int processCreateExInteral( const GuestProcessInfo &aProcInfo, IGuestProcess **aProcess);128 int processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProgress); 129 129 inline bool processExists(ULONG uProcessID, ComObjPtr<GuestProcess> *pProcess); 130 130 inline int processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
Note:
See TracChangeset
for help on using the changeset viewer.