VirtualBox

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

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

Copyright year updates by scm.

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