VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.h@ 86186

Last change on this file since 86186 was 84519, checked in by vboxsync, 5 years ago

Guest Control/VBoxManage: Implemented dedicated "waitrunlevel" command to wait for specific GA run levels and also added more options like waiting for GA being ready to be upgraded by Guest Control.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1/* $Id: VBoxManageGuestCtrl.h 84519 2020-05-25 17:29:52Z vboxsync $ */
2/** @file
3 * VBoxManageGuestCtrl.h - Definitions for guest control.
4 */
5
6/*
7 * Copyright (C) 2013-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_VBoxManage_VBoxManageGuestCtrl_h
19#define VBOX_INCLUDED_SRC_VBoxManage_VBoxManageGuestCtrl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#ifndef VBOX_ONLY_DOCS
25
26#include <VBox/com/com.h>
27#include <VBox/com/listeners.h>
28#include <VBox/com/VirtualBox.h>
29
30#include <iprt/semaphore.h>
31#include <iprt/time.h>
32
33#include <map>
34
35const char *gctlFileStatusToText(FileStatus_T enmStatus);
36const char *gctlProcessStatusToText(ProcessStatus_T enmStatus);
37const char *gctlGuestSessionStatusToText(GuestSessionStatus_T enmStatus);
38
39using namespace com;
40
41class GuestFileEventListener;
42typedef ListenerImpl<GuestFileEventListener> GuestFileEventListenerImpl;
43
44class GuestProcessEventListener;
45typedef ListenerImpl<GuestProcessEventListener> GuestProcessEventListenerImpl;
46
47class GuestSessionEventListener;
48typedef ListenerImpl<GuestSessionEventListener> GuestSessionEventListenerImpl;
49
50class GuestEventListener;
51typedef ListenerImpl<GuestEventListener> GuestEventListenerImpl;
52
53class GuestAdditionsRunlevelListener;
54typedef ListenerImpl<GuestAdditionsRunlevelListener> GuestAdditionsRunlevelListenerImpl;
55
56/** Simple statistics class for binding locally
57 * held data to a specific guest object. */
58class GuestEventStats
59{
60
61public:
62
63 GuestEventStats(void)
64 : uLastUpdatedMS(RTTimeMilliTS())
65 {
66 }
67
68 /** @todo Make this more a class than a structure. */
69public:
70
71 uint64_t uLastUpdatedMS;
72};
73
74class GuestFileStats : public GuestEventStats
75{
76
77public:
78
79 GuestFileStats(void) { }
80
81 GuestFileStats(ComObjPtr<GuestFileEventListenerImpl> pListenerImpl)
82 : mListener(pListenerImpl)
83 {
84 }
85
86public: /** @todo */
87
88 ComObjPtr<GuestFileEventListenerImpl> mListener;
89};
90
91class GuestProcStats : public GuestEventStats
92{
93
94public:
95
96 GuestProcStats(void) { }
97
98 GuestProcStats(ComObjPtr<GuestProcessEventListenerImpl> pListenerImpl)
99 : mListener(pListenerImpl)
100 {
101 }
102
103public: /** @todo */
104
105 ComObjPtr<GuestProcessEventListenerImpl> mListener;
106};
107
108class GuestSessionStats : public GuestEventStats
109{
110
111public:
112
113 GuestSessionStats(void) { }
114
115 GuestSessionStats(ComObjPtr<GuestSessionEventListenerImpl> pListenerImpl)
116 : mListener(pListenerImpl)
117 {
118 }
119
120public: /** @todo */
121
122 ComObjPtr<GuestSessionEventListenerImpl> mListener;
123};
124
125/** Map containing all watched guest files. */
126typedef std::map< ComPtr<IGuestFile>, GuestFileStats > GuestEventFiles;
127/** Map containing all watched guest processes. */
128typedef std::map< ComPtr<IGuestProcess>, GuestProcStats > GuestEventProcs;
129/** Map containing all watched guest sessions. */
130typedef std::map< ComPtr<IGuestSession>, GuestSessionStats > GuestEventSessions;
131
132class GuestListenerBase
133{
134public:
135
136 GuestListenerBase(void);
137
138 virtual ~GuestListenerBase(void);
139
140public:
141
142 HRESULT init(bool fVerbose = false);
143
144protected:
145
146 /** Verbose flag. */
147 bool mfVerbose;
148};
149
150/**
151 * Handler for guest process events.
152 */
153class GuestFileEventListener : public GuestListenerBase
154{
155public:
156
157 GuestFileEventListener(void);
158
159 virtual ~GuestFileEventListener(void);
160
161public:
162
163 void uninit(void);
164
165 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent);
166
167protected:
168
169};
170
171/**
172 * Handler for guest process events.
173 */
174class GuestProcessEventListener : public GuestListenerBase
175{
176public:
177
178 GuestProcessEventListener(void);
179
180 virtual ~GuestProcessEventListener(void);
181
182public:
183
184 void uninit(void);
185
186 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent);
187
188protected:
189
190};
191
192/**
193 * Handler for guest session events.
194 */
195class GuestSessionEventListener : public GuestListenerBase
196{
197public:
198
199 GuestSessionEventListener(void);
200
201 virtual ~GuestSessionEventListener(void);
202
203public:
204
205 void uninit(void);
206
207 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent);
208
209protected:
210
211 GuestEventFiles mFiles;
212 GuestEventProcs mProcs;
213};
214
215/**
216 * Handler for guest events.
217 */
218class GuestEventListener : public GuestListenerBase
219{
220
221public:
222
223 GuestEventListener(void);
224
225 virtual ~GuestEventListener(void);
226
227public:
228
229 void uninit(void);
230
231 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent);
232
233protected:
234
235 GuestEventSessions mSessions;
236};
237
238/**
239 * Handler for Guest Additions runlevel change events.
240 */
241class GuestAdditionsRunlevelListener : public GuestListenerBase
242{
243
244public:
245
246 GuestAdditionsRunlevelListener(AdditionsRunLevelType_T enmRunLevel);
247
248 virtual ~GuestAdditionsRunlevelListener(void);
249
250public:
251
252 void uninit(void);
253
254 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent);
255
256protected:
257
258 /** The run level target we're waiting for. */
259 AdditionsRunLevelType_T mRunLevelTarget;
260};
261#endif /* !VBOX_ONLY_DOCS */
262
263#endif /* !VBOX_INCLUDED_SRC_VBoxManage_VBoxManageGuestCtrl_h */
264
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette