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