VirtualBox

source: vbox/trunk/include/VBox/GuestHost/GuestControl.h@ 85429

Last change on this file since 85429 was 84816, checked in by vboxsync, 4 years ago

Guest Control: Also implemented a "force" flag for the reboot/shutdown command [build fix]. bugref:9320

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1/* $Id: GuestControl.h 84816 2020-06-12 12:53:12Z vboxsync $ */
2/** @file
3 * Guest Control - Common Guest and Host Code.
4 *
5 * @todo r=bird: Just merge this with GuestControlSvc.h!
6 */
7
8/*
9 * Copyright (C) 2016-2020 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 *
19 * The contents of this file may alternatively be used under the terms
20 * of the Common Development and Distribution License Version 1.0
21 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
22 * VirtualBox OSE distribution, in which case the provisions of the
23 * CDDL are applicable instead of those of the GPL.
24 *
25 * You may elect to license modified versions of this file under the
26 * terms and conditions of either the GPL or the CDDL or both.
27 */
28
29#ifndef VBOX_INCLUDED_GuestHost_GuestControl_h
30#define VBOX_INCLUDED_GuestHost_GuestControl_h
31#ifndef RT_WITHOUT_PRAGMA_ONCE
32# pragma once
33#endif
34
35#include <iprt/types.h>
36
37/* Everything defined in this file lives in this namespace. */
38namespace guestControl {
39
40/**
41 * Process status when executed in the guest.
42 */
43enum eProcessStatus
44{
45 /** Process is in an undefined state. */
46 PROC_STS_UNDEFINED = 0,
47 /** Process has been started. */
48 PROC_STS_STARTED = 1,
49 /** Process terminated normally. */
50 PROC_STS_TEN = 2,
51 /** Process terminated via signal. */
52 PROC_STS_TES = 3,
53 /** Process terminated abnormally. */
54 PROC_STS_TEA = 4,
55 /** Process timed out and was killed. */
56 PROC_STS_TOK = 5,
57 /** Process timed out and was not killed successfully. */
58 PROC_STS_TOA = 6,
59 /** Service/OS is stopping, process was killed. */
60 PROC_STS_DWN = 7,
61 /** Something went wrong (error code in flags). */
62 PROC_STS_ERROR = 8
63};
64
65/** @todo r=bird: Most defines in this file needs to be scoped a little
66 * better! For instance INPUT_FLAG_NONE is very generic. */
67
68/**
69 * Input flags, set by the host. This is needed for
70 * handling flags on the guest side.
71 * Note: Has to match Main's ProcessInputFlag_* flags!
72 */
73#define INPUT_FLAG_NONE 0x0
74#define INPUT_FLAG_EOF RT_BIT(0)
75
76/**
77 * Guest session creation flags.
78 * Only handled internally at the moment.
79 */
80#define SESSIONCREATIONFLAG_NONE 0x0
81
82/** @name DIRREMOVEREC_FLAG_XXX - Guest directory removement flags.
83 * Essentially using what IPRT's RTDIRRMREC_F_
84 * defines have to offer.
85 * @{
86 */
87/** No remove flags specified. */
88#define DIRREMOVEREC_FLAG_NONE UINT32_C(0x0)
89/** Recursively deletes the directory contents. */
90#define DIRREMOVEREC_FLAG_RECURSIVE RT_BIT(0)
91/** Delete the content of the directory and the directory itself. */
92#define DIRREMOVEREC_FLAG_CONTENT_AND_DIR RT_BIT(1)
93/** Only delete the content of the directory, omit the directory it self. */
94#define DIRREMOVEREC_FLAG_CONTENT_ONLY RT_BIT(2)
95/** Mask of valid flags. */
96#define DIRREMOVEREC_FLAG_VALID_MASK UINT32_C(0x00000007)
97/** @} */
98
99/** @name EXECUTEPROCESSFLAG_XXX - Guest process creation flags.
100 * @note Has to match Main's ProcessCreateFlag_* flags!
101 * @{
102 */
103#define EXECUTEPROCESSFLAG_NONE UINT32_C(0x0)
104#define EXECUTEPROCESSFLAG_WAIT_START RT_BIT(0)
105#define EXECUTEPROCESSFLAG_IGNORE_ORPHANED RT_BIT(1)
106#define EXECUTEPROCESSFLAG_HIDDEN RT_BIT(2)
107#define EXECUTEPROCESSFLAG_PROFILE RT_BIT(3)
108#define EXECUTEPROCESSFLAG_WAIT_STDOUT RT_BIT(4)
109#define EXECUTEPROCESSFLAG_WAIT_STDERR RT_BIT(5)
110#define EXECUTEPROCESSFLAG_EXPAND_ARGUMENTS RT_BIT(6)
111#define EXECUTEPROCESSFLAG_UNQUOTED_ARGS RT_BIT(7)
112/** @} */
113
114/** @name OUTPUT_HANDLE_ID_XXX - Pipe handle IDs used internally for referencing
115 * to a certain pipe buffer.
116 * @{
117 */
118#define OUTPUT_HANDLE_ID_STDOUT_DEPRECATED 0 /**< Needed for VBox hosts < 4.1.0. */
119#define OUTPUT_HANDLE_ID_STDOUT 1
120#define OUTPUT_HANDLE_ID_STDERR 2
121/** @} */
122
123/** @name PATHRENAME_FLAG_XXX - Guest path rename flags.
124 * Essentially using what IPRT's RTPATHRENAME_FLAGS_XXX have to offer.
125 * @{
126 */
127/** Do not replace anything. */
128#define PATHRENAME_FLAG_NO_REPLACE UINT32_C(0)
129/** This will replace attempt any target which isn't a directory. */
130#define PATHRENAME_FLAG_REPLACE RT_BIT(0)
131/** Don't allow symbolic links as part of the path. */
132#define PATHRENAME_FLAG_NO_SYMLINKS RT_BIT(1)
133/** Mask of valid flags. */
134#define PATHRENAME_FLAG_VALID_MASK UINT32_C(0x00000003)
135/** @} */
136
137/** @name SHUTDOWN_FLAG_XXX - Guest shutdown flags.
138 * Must match Main's GuestShutdownFlag_ definitions.
139 * @{
140 */
141#define SHUTDOWN_FLAG_NONE UINT32_C(0)
142#define SHUTDOWN_FLAG_POWER_OFF RT_BIT(0)
143#define SHUTDOWN_FLAG_REBOOT RT_BIT(1)
144#define SHUTDOWN_FLAG_FORCE RT_BIT(2)
145/** @} */
146
147/** @name Defines for default (initial) guest process buffer lengths.
148 * Note: These defaults were the maximum values before; so be careful when raising those in order to
149 * not break running with older Guest Additions.
150 * @{
151 */
152#define GUESTPROCESS_DEFAULT_CMD_LEN _1K
153#define GUESTPROCESS_DEFAULT_ARGS_LEN _1K
154#define GUESTPROCESS_DEFAULT_ENV_LEN _1K
155#define GUESTPROCESS_DEFAULT_USER_LEN 128
156#define GUESTPROCESS_DEFAULT_PASSWORD_LEN 128
157#define GUESTPROCESS_DEFAULT_DOMAIN_LEN 256
158/** @} */
159
160/** @name Defines for maximum guest process buffer lengths.
161 * @{
162 */
163#define GUESTPROCESS_MAX_CMD_LEN _1M
164#define GUESTPROCESS_MAX_ARGS_LEN _2M
165#define GUESTPROCESS_MAX_ENV_LEN _4M
166#define GUESTPROCESS_MAX_USER_LEN _64K
167#define GUESTPROCESS_MAX_PASSWORD_LEN _64K
168#define GUESTPROCESS_MAX_DOMAIN_LEN _64K
169/** @} */
170
171/** @name Internal tools built into VBoxService which are used in order
172 * to accomplish tasks host<->guest.
173 * @{
174 */
175#define VBOXSERVICE_TOOL_CAT "vbox_cat"
176#define VBOXSERVICE_TOOL_LS "vbox_ls"
177#define VBOXSERVICE_TOOL_RM "vbox_rm"
178#define VBOXSERVICE_TOOL_MKDIR "vbox_mkdir"
179#define VBOXSERVICE_TOOL_MKTEMP "vbox_mktemp"
180#define VBOXSERVICE_TOOL_STAT "vbox_stat"
181/** @} */
182
183/** Special process exit codes for "vbox_cat". */
184typedef enum VBOXSERVICETOOLBOX_CAT_EXITCODE
185{
186 VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
187 VBOXSERVICETOOLBOX_CAT_EXITCODE_FILE_NOT_FOUND,
188 VBOXSERVICETOOLBOX_CAT_EXITCODE_PATH_NOT_FOUND,
189 VBOXSERVICETOOLBOX_CAT_EXITCODE_SHARING_VIOLATION,
190 VBOXSERVICETOOLBOX_CAT_EXITCODE_IS_A_DIRECTORY,
191 /** The usual 32-bit type hack. */
192 VBOXSERVICETOOLBOX_CAT_32BIT_HACK = 0x7fffffff
193} VBOXSERVICETOOLBOX_CAT_EXITCODE;
194
195/** Special process exit codes for "vbox_stat". */
196typedef enum VBOXSERVICETOOLBOX_STAT_EXITCODE
197{
198 VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
199 VBOXSERVICETOOLBOX_STAT_EXITCODE_FILE_NOT_FOUND,
200 VBOXSERVICETOOLBOX_STAT_EXITCODE_PATH_NOT_FOUND,
201 VBOXSERVICETOOLBOX_STAT_EXITCODE_NET_PATH_NOT_FOUND,
202 VBOXSERVICETOOLBOX_STAT_EXITCODE_INVALID_NAME,
203 /** The usual 32-bit type hack. */
204 VBOXSERVICETOOLBOX_STAT_32BIT_HACK = 0x7fffffff
205} VBOXSERVICETOOLBOX_STAT_EXITCODE;
206
207/**
208 * Input status, reported by the client.
209 */
210enum eInputStatus
211{
212 /** Input is in an undefined state. */
213 INPUT_STS_UNDEFINED = 0,
214 /** Input was written (partially, see cbProcessed). */
215 INPUT_STS_WRITTEN = 1,
216 /** Input failed with an error (see flags for rc). */
217 INPUT_STS_ERROR = 20,
218 /** Process has abandoned / terminated input handling. */
219 INPUT_STS_TERMINATED = 21,
220 /** Too much input data. */
221 INPUT_STS_OVERFLOW = 30
222};
223
224
225
226} /* namespace guestControl */
227
228#endif /* !VBOX_INCLUDED_GuestHost_GuestControl_h */
229
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