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