1 | /* $Id: GuestControl.h 77069 2019-01-31 11:59:33Z 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-2019 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. */
|
---|
38 | namespace guestControl {
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Process status when executed in the guest.
|
---|
42 | */
|
---|
43 | enum 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 directorie's 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(0x00000003)
|
---|
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 Defines for guest process array lengths.
|
---|
138 | * @{
|
---|
139 | */
|
---|
140 | #define GUESTPROCESS_MAX_CMD_LEN _1K
|
---|
141 | #define GUESTPROCESS_MAX_ARGS_LEN _1K
|
---|
142 | #define GUESTPROCESS_MAX_ENV_LEN _64K
|
---|
143 | #define GUESTPROCESS_MAX_USER_LEN 128
|
---|
144 | #define GUESTPROCESS_MAX_PASSWORD_LEN 128
|
---|
145 | #define GUESTPROCESS_MAX_DOMAIN_LEN 256
|
---|
146 | /** @} */
|
---|
147 |
|
---|
148 | /** @name Internal tools built into VBoxService which are used in order
|
---|
149 | * to accomplish tasks host<->guest.
|
---|
150 | * @{
|
---|
151 | */
|
---|
152 | #define VBOXSERVICE_TOOL_CAT "vbox_cat"
|
---|
153 | #define VBOXSERVICE_TOOL_LS "vbox_ls"
|
---|
154 | #define VBOXSERVICE_TOOL_RM "vbox_rm"
|
---|
155 | #define VBOXSERVICE_TOOL_MKDIR "vbox_mkdir"
|
---|
156 | #define VBOXSERVICE_TOOL_MKTEMP "vbox_mktemp"
|
---|
157 | #define VBOXSERVICE_TOOL_STAT "vbox_stat"
|
---|
158 | /** @} */
|
---|
159 |
|
---|
160 | /** Special process exit codes for "vbox_cat". */
|
---|
161 | typedef enum VBOXSERVICETOOLBOX_CAT_EXITCODE
|
---|
162 | {
|
---|
163 | VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
|
---|
164 | VBOXSERVICETOOLBOX_CAT_EXITCODE_FILE_NOT_FOUND,
|
---|
165 | VBOXSERVICETOOLBOX_CAT_EXITCODE_PATH_NOT_FOUND,
|
---|
166 | VBOXSERVICETOOLBOX_CAT_EXITCODE_SHARING_VIOLATION,
|
---|
167 | VBOXSERVICETOOLBOX_CAT_EXITCODE_IS_A_DIRECTORY,
|
---|
168 | /** The usual 32-bit type hack. */
|
---|
169 | VBOXSERVICETOOLBOX_CAT_32BIT_HACK = 0x7fffffff
|
---|
170 | } VBOXSERVICETOOLBOX_CAT_EXITCODE;
|
---|
171 |
|
---|
172 | /** Special process exit codes for "vbox_stat". */
|
---|
173 | typedef enum VBOXSERVICETOOLBOX_STAT_EXITCODE
|
---|
174 | {
|
---|
175 | VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
|
---|
176 | VBOXSERVICETOOLBOX_STAT_EXITCODE_FILE_NOT_FOUND,
|
---|
177 | VBOXSERVICETOOLBOX_STAT_EXITCODE_PATH_NOT_FOUND,
|
---|
178 | VBOXSERVICETOOLBOX_STAT_EXITCODE_NET_PATH_NOT_FOUND,
|
---|
179 | /** The usual 32-bit type hack. */
|
---|
180 | VBOXSERVICETOOLBOX_STAT_32BIT_HACK = 0x7fffffff
|
---|
181 | } VBOXSERVICETOOLBOX_STAT_EXITCODE;
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * Input status, reported by the client.
|
---|
185 | */
|
---|
186 | enum eInputStatus
|
---|
187 | {
|
---|
188 | /** Input is in an undefined state. */
|
---|
189 | INPUT_STS_UNDEFINED = 0,
|
---|
190 | /** Input was written (partially, see cbProcessed). */
|
---|
191 | INPUT_STS_WRITTEN = 1,
|
---|
192 | /** Input failed with an error (see flags for rc). */
|
---|
193 | INPUT_STS_ERROR = 20,
|
---|
194 | /** Process has abandoned / terminated input handling. */
|
---|
195 | INPUT_STS_TERMINATED = 21,
|
---|
196 | /** Too much input data. */
|
---|
197 | INPUT_STS_OVERFLOW = 30
|
---|
198 | };
|
---|
199 |
|
---|
200 |
|
---|
201 |
|
---|
202 | } /* namespace guestControl */
|
---|
203 |
|
---|
204 | #endif /* !VBOX_INCLUDED_GuestHost_GuestControl_h */
|
---|
205 |
|
---|