VirtualBox

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

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

Guest Control: Update.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 6.2 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 /** @todo */
69 PROC_STS_DWN = 7
70};
71
72/**
73 * Data structure to pass to the service extension callback. We use this to
74 * notify the host of changes to properties.
75 */
76typedef struct _VBoxGuestCtrlExecCallbackData
77{
78 /** Magic number to identify the structure. */
79 uint32_t u32Magic;
80 /** The process ID (PID). */
81 uint32_t pid;
82 /* The process status. */
83 uint32_t status;
84 /** Optional flags (not used atm). */
85 uint32_t flags;
86 /** Optional data buffer (not used atm). */
87 void *pvData;
88 /** Size of optional data buffer (not used atm). */
89 uint32_t cbData;
90
91} HOSTEXECCALLBACKDATA, *PHOSTEXECCALLBACKDATA;
92
93enum
94{
95 /** Magic number for sanity checking the HOSTCALLBACKDATA structure */
96 HOSTCALLBACKMAGIC = 0x26011982
97};
98
99/**
100 * The service functions which are callable by host.
101 */
102enum eHostFn
103{
104 /**
105 * The host wants to execute something in the guest. This can be a command line
106 * or starting a program.
107 */
108 HOST_EXEC_CMD = 1,
109 /**
110 * Sends input data for stdin to a running process executed by HOST_EXEC_CMD.
111 */
112 HOST_EXEC_SEND_STDIN = 2,
113 /**
114 * Gets the current status of a running process, e.g.
115 * new data on stdout/stderr, process terminated etc.
116 */
117 HOST_EXEC_GET_STATUS = 3
118};
119
120/**
121 * The service functions which are called by guest. The numbers may not change,
122 * so we hardcode them.
123 */
124enum eGuestFn
125{
126 /**
127 * TODO
128 */
129 GUEST_GET_HOST_MSG = 1,
130 /**
131 * TODO
132 */
133 GUEST_EXEC_SEND_STDOUT = 3,
134 /**
135 * TODO
136 */
137 GUEST_EXEC_SEND_STDERR = 4,
138 /**
139 * TODO
140 */
141 GUEST_EXEC_SEND_STATUS = 5
142};
143
144/**
145 * Sub host commands. These commands are stored as first (=0) parameter in a GUEST_GET_HOST_MSG
146 * so that the guest can react dynamically to requests from the host.
147 */
148enum eGetHostMsgFn
149{
150 /**
151 * The host wants to execute something in the guest. This can be a command line
152 * or starting a program.
153 */
154 GETHOSTMSG_EXEC_CMD = 1,
155 /**
156 * Sends input data for stdin to a running process executed by HOST_EXEC_CMD.
157 */
158 GETHOSTMSG_EXEC_STDIN = 2
159};
160
161/*
162 * HGCM parameter structures.
163 */
164#pragma pack (1)
165typedef struct _VBoxGuestCtrlHGCMMsgType
166{
167 VBoxGuestHGCMCallInfo hdr;
168
169 /**
170 * The returned command the host wants to
171 * execute on the guest.
172 */
173 HGCMFunctionParameter msg; /* OUT uint32_t */
174
175 HGCMFunctionParameter num_parms; /* OUT uint32_t */
176
177} VBoxGuestCtrlHGCMMsgType;
178
179typedef struct _VBoxGuestCtrlHGCMMsgExecCmd
180{
181 VBoxGuestHGCMCallInfo hdr;
182
183 HGCMFunctionParameter cmd;
184
185 HGCMFunctionParameter flags;
186
187 HGCMFunctionParameter num_args;
188
189 HGCMFunctionParameter args;
190
191 HGCMFunctionParameter num_env;
192 /** Size (in bytes) of environment block, including terminating zeros. */
193 HGCMFunctionParameter cb_env;
194
195 HGCMFunctionParameter env;
196
197 HGCMFunctionParameter std_in;
198
199 HGCMFunctionParameter std_out;
200
201 HGCMFunctionParameter std_err;
202
203 HGCMFunctionParameter username;
204
205 HGCMFunctionParameter password;
206
207 HGCMFunctionParameter timeout;
208
209} VBoxGuestCtrlHGCMMsgExecCmd;
210
211typedef struct _VBoxGuestCtrlHGCMMsgExecStatus
212{
213 VBoxGuestHGCMCallInfo hdr;
214 /** The process ID (PID). */
215 HGCMFunctionParameter pid;
216 /** The process status. */
217 HGCMFunctionParameter status;
218 /** Optional flags (based on status). */
219 HGCMFunctionParameter flags;
220 /** Optional data buffer (not used atm). */
221 HGCMFunctionParameter data;
222
223} VBoxGuestCtrlHGCMMsgExecStatus;
224#pragma pack ()
225
226/* Structure for buffering execution requests in the host service. */
227typedef struct _VBoxGuestCtrlParamBuffer
228{
229 uint32_t uParmCount;
230 VBOXHGCMSVCPARM *pParms;
231} VBOXGUESTCTRPARAMBUFFER, *PVBOXGUESTCTRPARAMBUFFER;
232
233} /* namespace guestControl */
234
235#endif /* ___VBox_HostService_GuestControlService_h defined */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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