VirtualBox

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

Last change on this file since 94234 was 94234, checked in by vboxsync, 2 years ago

FE/VBoxManage: Remove the now unused VBoxManageHelp build target and the VBOX_ONLY_DOCS #ifdef's in the code, ​bugref:9186

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

© 2023 Oracle
ContactPrivacy policyTerms of Use