VirtualBox

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

Last change on this file since 93456 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 KB
Line 
1/* $Id: GuestControl.h 93115 2022-01-01 11:31:46Z 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-2022 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/**
66 * Input flags, set by the host. This is needed for
67 * handling flags on the guest side.
68 * Note: Has to match Main's ProcessInputFlag_* flags!
69 */
70#define GUEST_PROC_IN_FLAG_NONE 0x0
71#define GUEST_PROC_IN_FLAG_EOF RT_BIT(0)
72
73/**
74 * Guest session creation flags.
75 * Only handled internally at the moment.
76 */
77#define SESSIONCREATIONFLAG_NONE 0x0
78
79/** @name DIRREMOVEREC_FLAG_XXX - Guest directory removement flags.
80 * Essentially using what IPRT's RTDIRRMREC_F_
81 * defines have to offer.
82 * @{
83 */
84/** No remove flags specified. */
85#define DIRREMOVEREC_FLAG_NONE UINT32_C(0x0)
86/** Recursively deletes the directory contents. */
87#define DIRREMOVEREC_FLAG_RECURSIVE RT_BIT(0)
88/** Delete the content of the directory and the directory itself. */
89#define DIRREMOVEREC_FLAG_CONTENT_AND_DIR RT_BIT(1)
90/** Only delete the content of the directory, omit the directory it self. */
91#define DIRREMOVEREC_FLAG_CONTENT_ONLY RT_BIT(2)
92/** Mask of valid flags. */
93#define DIRREMOVEREC_FLAG_VALID_MASK UINT32_C(0x00000007)
94/** @} */
95
96/** @name GUEST_PROC_CREATE_FLAG_XXX - Guest process creation flags.
97 * @note Has to match Main's ProcessCreateFlag_* flags!
98 * @{
99 */
100#define GUEST_PROC_CREATE_FLAG_NONE UINT32_C(0x0)
101#define GUEST_PROC_CREATE_FLAG_WAIT_START RT_BIT(0)
102#define GUEST_PROC_CREATE_FLAG_IGNORE_ORPHANED RT_BIT(1)
103#define GUEST_PROC_CREATE_FLAG_HIDDEN RT_BIT(2)
104#define GUEST_PROC_CREATE_FLAG_PROFILE RT_BIT(3)
105#define GUEST_PROC_CREATE_FLAG_WAIT_STDOUT RT_BIT(4)
106#define GUEST_PROC_CREATE_FLAG_WAIT_STDERR RT_BIT(5)
107#define GUEST_PROC_CREATE_FLAG_EXPAND_ARGUMENTS RT_BIT(6)
108#define GUEST_PROC_CREATE_FLAG_UNQUOTED_ARGS RT_BIT(7)
109/** @} */
110
111/** @name GUEST_PROC_OUT_H_XXX - Pipe handle IDs used internally for referencing
112 * to a certain pipe buffer.
113 * @{
114 */
115#define GUEST_PROC_OUT_H_STDOUT_DEPRECATED 0 /**< Needed for VBox hosts < 4.1.0. */
116#define GUEST_PROC_OUT_H_STDOUT 1
117#define GUEST_PROC_OUT_H_STDERR 2
118/** @} */
119
120/** @name PATHRENAME_FLAG_XXX - Guest path rename flags.
121 * Essentially using what IPRT's RTPATHRENAME_FLAGS_XXX have to offer.
122 * @{
123 */
124/** Do not replace anything. */
125#define PATHRENAME_FLAG_NO_REPLACE UINT32_C(0)
126/** This will replace attempt any target which isn't a directory. */
127#define PATHRENAME_FLAG_REPLACE RT_BIT(0)
128/** Don't allow symbolic links as part of the path. */
129#define PATHRENAME_FLAG_NO_SYMLINKS RT_BIT(1)
130/** Mask of valid flags. */
131#define PATHRENAME_FLAG_VALID_MASK UINT32_C(0x00000003)
132/** @} */
133
134/** @name GUEST_SHUTDOWN_FLAG_XXX - Guest shutdown flags.
135 * Must match Main's GuestShutdownFlag_ definitions.
136 * @{
137 */
138#define GUEST_SHUTDOWN_FLAG_NONE UINT32_C(0)
139#define GUEST_SHUTDOWN_FLAG_POWER_OFF RT_BIT(0)
140#define GUEST_SHUTDOWN_FLAG_REBOOT RT_BIT(1)
141#define GUEST_SHUTDOWN_FLAG_FORCE RT_BIT(2)
142/** @} */
143
144/** @name Defines for default (initial) guest process buffer lengths.
145 * Note: These defaults were the maximum values before; so be careful when raising those in order to
146 * not break running with older Guest Additions.
147 * @{
148 */
149#define GUEST_PROC_DEF_CMD_LEN _1K
150#define GUEST_PROC_DEF_ARGS_LEN _1K
151#define GUEST_PROC_DEF_ENV_LEN _1K
152#define GUEST_PROC_DEF_USER_LEN 128
153#define GUEST_PROC_DEF_PASSWORD_LEN 128
154#define GUEST_PROC_DEF_DOMAIN_LEN 256
155/** @} */
156
157/** @name Defines for maximum guest process buffer lengths.
158 * @{
159 */
160#define GUEST_PROC_MAX_CMD_LEN _1M
161#define GUEST_PROC_MAX_ARGS_LEN _2M
162#define GUEST_PROC_MAX_ENV_LEN _4M
163#define GUEST_PROC_MAX_USER_LEN _64K
164#define GUEST_PROC_MAX_PASSWORD_LEN _64K
165#define GUEST_PROC_MAX_DOMAIN_LEN _64K
166/** @} */
167
168/** @name Internal tools built into VBoxService which are used in order
169 * to accomplish tasks host<->guest.
170 * @{
171 */
172#define VBOXSERVICE_TOOL_CAT "vbox_cat"
173#define VBOXSERVICE_TOOL_LS "vbox_ls"
174#define VBOXSERVICE_TOOL_RM "vbox_rm"
175#define VBOXSERVICE_TOOL_MKDIR "vbox_mkdir"
176#define VBOXSERVICE_TOOL_MKTEMP "vbox_mktemp"
177#define VBOXSERVICE_TOOL_STAT "vbox_stat"
178/** @} */
179
180/** Special process exit codes for "vbox_cat". */
181typedef enum VBOXSERVICETOOLBOX_CAT_EXITCODE
182{
183 VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
184 VBOXSERVICETOOLBOX_CAT_EXITCODE_FILE_NOT_FOUND,
185 VBOXSERVICETOOLBOX_CAT_EXITCODE_PATH_NOT_FOUND,
186 VBOXSERVICETOOLBOX_CAT_EXITCODE_SHARING_VIOLATION,
187 VBOXSERVICETOOLBOX_CAT_EXITCODE_IS_A_DIRECTORY,
188 /** The usual 32-bit type hack. */
189 VBOXSERVICETOOLBOX_CAT_32BIT_HACK = 0x7fffffff
190} VBOXSERVICETOOLBOX_CAT_EXITCODE;
191
192/** Special process exit codes for "vbox_stat". */
193typedef enum VBOXSERVICETOOLBOX_STAT_EXITCODE
194{
195 VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
196 VBOXSERVICETOOLBOX_STAT_EXITCODE_FILE_NOT_FOUND,
197 VBOXSERVICETOOLBOX_STAT_EXITCODE_PATH_NOT_FOUND,
198 VBOXSERVICETOOLBOX_STAT_EXITCODE_NET_PATH_NOT_FOUND,
199 VBOXSERVICETOOLBOX_STAT_EXITCODE_INVALID_NAME,
200 /** The usual 32-bit type hack. */
201 VBOXSERVICETOOLBOX_STAT_32BIT_HACK = 0x7fffffff
202} VBOXSERVICETOOLBOX_STAT_EXITCODE;
203
204/**
205 * Input status, reported by the client.
206 */
207enum eInputStatus
208{
209 /** Input is in an undefined state. */
210 INPUT_STS_UNDEFINED = 0,
211 /** Input was written (partially, see cbProcessed). */
212 INPUT_STS_WRITTEN = 1,
213 /** Input failed with an error (see flags for rc). */
214 INPUT_STS_ERROR = 20,
215 /** Process has abandoned / terminated input handling. */
216 INPUT_STS_TERMINATED = 21,
217 /** Too much input data. */
218 INPUT_STS_OVERFLOW = 30
219};
220
221
222
223} /* namespace guestControl */
224
225#endif /* !VBOX_INCLUDED_GuestHost_GuestControl_h */
226
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