VirtualBox

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

Last change on this file since 78294 was 76582, checked in by vboxsync, 6 years ago

Frontends: scm header guard alignment.

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