VirtualBox

source: vbox/trunk/include/VBox/HostServices/GuestControlSvc.h@ 28434

最後變更 在這個檔案從28434是 28434,由 vboxsync 提交於 15 年 前

*: whitespace cleanups by scm and two manually picked nits.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 6.6 KB
 
1/** @file
2 * Guest control service:
3 * Common header for host service and guest clients.
4 */
5
6/*
7 * Copyright (C) 2010 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 *
26 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___VBox_HostService_GuestControlService_h
32#define ___VBox_HostService_GuestControlService_h
33
34#include <VBox/types.h>
35#include <VBox/VMMDev.h>
36#include <VBox/VBoxGuest2.h>
37#include <VBox/hgcmsvc.h>
38#include <VBox/log.h>
39#include <iprt/assert.h>
40#include <iprt/string.h>
41
42/** Everything defined in this file lives in this namespace. */
43namespace guestControl {
44
45/******************************************************************************
46* Typedefs, constants and inlines *
47******************************************************************************/
48
49/**
50 * Process status when executed in the guest.
51 */
52enum eProcessStatus
53{
54 /** Process is in an undefined state. */
55 PROC_STS_UNDEFINED = 0,
56 /** Process has been started. */
57 PROC_STS_STARTED = 1,
58 /** Process terminated normally. */
59 PROC_STS_TEN = 2,
60 /** Process terminated via signal. */
61 PROC_STS_TES = 3,
62 /** Process terminated abnormally. */
63 PROC_STS_TEA = 4,
64 /** Process timed out and was killed. */
65 PROC_STS_TOK = 5,
66 /** Process timed out and was not killed successfully. */
67 PROC_STS_TOA = 6,
68 /** Service is stopping, process was killed. */
69 PROC_STS_DWN = 7,
70 /** Something went wrong (error code in flags). */
71 PROC_STS_ERROR = 8
72};
73
74typedef struct _VBoxGuestCtrlCallbackHeader
75{
76 /** Magic number to identify the structure. */
77 uint32_t u32Magic;
78 /** Context ID to identify callback data. */
79 uint32_t u32ContextID;
80} HOSTCCALLBACKHEADER, *PHOSTCCALLBACKHEADER;
81
82/**
83 * Data structure to pass to the service extension callback. We use this to
84 * notify the host of changes to properties.
85 */
86typedef struct _VBoxGuestCtrlExecCallbackData
87{
88 /** Callback data header. */
89 HOSTCCALLBACKHEADER hdr;
90 /** The process ID (PID). */
91 uint32_t u32PID;
92 /* The process status. */
93 uint32_t u32Status;
94 /** Optional flags (not used atm). */
95 uint32_t u32Flags;
96 /** Optional data buffer (not used atm). */
97 void *pvData;
98 /** Size of optional data buffer (not used atm). */
99 uint32_t cbData;
100
101} HOSTEXECCALLBACKDATA, *PHOSTEXECCALLBACKDATA;
102
103enum
104{
105 /** Magic number for sanity checking the HOSTEXECCALLBACKDATA structure */
106 HOSTEXECCALLBACKDATAMAGIC = 0x26011982
107};
108
109/**
110 * The service functions which are callable by host.
111 */
112enum eHostFn
113{
114 /**
115 * The host wants to execute something in the guest. This can be a command line
116 * or starting a program.
117 */
118 HOST_EXEC_CMD = 1,
119 /**
120 * Sends input data for stdin to a running process executed by HOST_EXEC_CMD.
121 */
122 HOST_EXEC_SEND_STDIN = 2,
123 /**
124 * Gets the current status of a running process, e.g.
125 * new data on stdout/stderr, process terminated etc.
126 */
127 HOST_EXEC_GET_STATUS = 3
128};
129
130/**
131 * The service functions which are called by guest. The numbers may not change,
132 * so we hardcode them.
133 */
134enum eGuestFn
135{
136 /**
137 * TODO
138 */
139 GUEST_GET_HOST_MSG = 1,
140 /**
141 * TODO
142 */
143 GUEST_EXEC_SEND_STDOUT = 3,
144 /**
145 * TODO
146 */
147 GUEST_EXEC_SEND_STDERR = 4,
148 /**
149 * TODO
150 */
151 GUEST_EXEC_SEND_STATUS = 5
152};
153
154/**
155 * Sub host commands. These commands are stored as first (=0) parameter in a GUEST_GET_HOST_MSG
156 * so that the guest can react dynamically to requests from the host.
157 */
158enum eGetHostMsgFn
159{
160 /**
161 * The host wants to execute something in the guest. This can be a command line
162 * or starting a program.
163 */
164 GETHOSTMSG_EXEC_CMD = 1,
165 /**
166 * Sends input data for stdin to a running process executed by HOST_EXEC_CMD.
167 */
168 GETHOSTMSG_EXEC_STDIN = 2
169};
170
171/*
172 * HGCM parameter structures.
173 */
174#pragma pack (1)
175typedef struct _VBoxGuestCtrlHGCMMsgType
176{
177 VBoxGuestHGCMCallInfoTimed hdr;
178
179 /**
180 * The returned command the host wants to
181 * execute on the guest.
182 */
183 HGCMFunctionParameter msg; /* OUT uint32_t */
184
185 HGCMFunctionParameter num_parms; /* OUT uint32_t */
186
187} VBoxGuestCtrlHGCMMsgType;
188
189typedef struct _VBoxGuestCtrlHGCMMsgExecCmd
190{
191 VBoxGuestHGCMCallInfo hdr;
192
193 HGCMFunctionParameter context;
194
195 HGCMFunctionParameter cmd;
196
197 HGCMFunctionParameter flags;
198
199 HGCMFunctionParameter num_args;
200
201 HGCMFunctionParameter args;
202
203 HGCMFunctionParameter num_env;
204 /** Size (in bytes) of environment block, including terminating zeros. */
205 HGCMFunctionParameter cb_env;
206
207 HGCMFunctionParameter env;
208
209 HGCMFunctionParameter std_in;
210
211 HGCMFunctionParameter std_out;
212
213 HGCMFunctionParameter std_err;
214
215 HGCMFunctionParameter username;
216
217 HGCMFunctionParameter password;
218
219 HGCMFunctionParameter timeout;
220
221} VBoxGuestCtrlHGCMMsgExecCmd;
222
223typedef struct _VBoxGuestCtrlHGCMMsgExecStatus
224{
225 VBoxGuestHGCMCallInfo hdr;
226 /** Context ID. */
227 HGCMFunctionParameter context;
228 /** The process ID (PID). */
229 HGCMFunctionParameter pid;
230 /** The process status. */
231 HGCMFunctionParameter status;
232 /** Optional flags (based on status). */
233 HGCMFunctionParameter flags;
234 /** Optional data buffer (not used atm). */
235 HGCMFunctionParameter data;
236
237} VBoxGuestCtrlHGCMMsgExecStatus;
238#pragma pack ()
239
240/* Structure for buffering execution requests in the host service. */
241typedef struct _VBoxGuestCtrlParamBuffer
242{
243 uint32_t uParmCount;
244 VBOXHGCMSVCPARM *pParms;
245} VBOXGUESTCTRPARAMBUFFER, *PVBOXGUESTCTRPARAMBUFFER;
246
247} /* namespace guestControl */
248
249#endif /* ___VBox_HostService_GuestControlService_h defined */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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