VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h@ 85683

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

Main,FE,doc/VBoxManage+Host+SystemProperties+manual: bugref:7983: Move update check from GUI to API, add more data

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.2 KB
Line 
1/* $Id: VBoxManage.h 85683 2020-08-11 11:03:42Z vboxsync $ */
2/** @file
3 * VBoxManage - VirtualBox command-line interface, internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2020 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
18#ifndef VBOX_INCLUDED_SRC_VBoxManage_VBoxManage_h
19#define VBOX_INCLUDED_SRC_VBoxManage_VBoxManage_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#ifndef VBOX_ONLY_DOCS
25#include <VBox/com/com.h>
26#include <VBox/com/ptr.h>
27#include <VBox/com/VirtualBox.h>
28#include <VBox/com/string.h>
29#include <VBox/com/array.h>
30#endif /* !VBOX_ONLY_DOCS */
31
32#include <iprt/types.h>
33#include <iprt/message.h>
34#include <iprt/stream.h>
35#include <iprt/getopt.h>
36
37#ifndef VBOX_ONLY_DOCS
38# include "VBoxManageBuiltInHelp.h"
39# include "PasswordInput.h"
40#endif
41
42
43////////////////////////////////////////////////////////////////////////////////
44//
45// definitions
46//
47////////////////////////////////////////////////////////////////////////////////
48
49/** @name Syntax diagram category, i.e. the command.
50 * @{ */
51typedef enum
52{
53 USAGE_INVALID = 0,
54 USAGE_LIST,
55 USAGE_SHOWVMINFO,
56 USAGE_REGISTERVM,
57 USAGE_UNREGISTERVM,
58 USAGE_CREATEVM,
59 USAGE_MODIFYVM,
60 USAGE_STARTVM,
61 USAGE_CONTROLVM,
62 USAGE_DISCARDSTATE,
63 USAGE_CLOSEMEDIUM,
64 USAGE_SHOWMEDIUMINFO,
65 USAGE_CREATEMEDIUM,
66 USAGE_MODIFYMEDIUM,
67 USAGE_CLONEMEDIUM,
68 USAGE_MOVEVM,
69 USAGE_CREATEHOSTIF,
70 USAGE_REMOVEHOSTIF,
71 USAGE_GETEXTRADATA,
72 USAGE_SETEXTRADATA,
73 USAGE_SETPROPERTY,
74 USAGE_USBFILTER,
75 USAGE_I_LOADSYMS,
76 USAGE_I_LOADMAP,
77 USAGE_I_SETHDUUID,
78 USAGE_CONVERTFROMRAW,
79 USAGE_I_LISTPARTITIONS,
80 USAGE_I_CREATERAWVMDK,
81 USAGE_ADOPTSTATE,
82 USAGE_I_MODINSTALL,
83 USAGE_I_MODUNINSTALL,
84 USAGE_I_RENAMEVMDK,
85#ifdef VBOX_WITH_GUEST_PROPS
86 USAGE_GUESTPROPERTY,
87#endif /* VBOX_WITH_GUEST_PROPS defined */
88 USAGE_I_CONVERTTORAW,
89 USAGE_METRICS,
90 USAGE_I_CONVERTHD,
91 USAGE_IMPORTAPPLIANCE,
92 USAGE_EXPORTAPPLIANCE,
93 USAGE_HOSTONLYIFS,
94 USAGE_I_DUMPHDINFO,
95 USAGE_STORAGEATTACH,
96 USAGE_STORAGECONTROLLER,
97#ifdef VBOX_WITH_GUEST_CONTROL
98 USAGE_GUESTCONTROL,
99#endif /* VBOX_WITH_GUEST_CONTROL defined */
100 USAGE_I_DEBUGLOG,
101 USAGE_I_SETHDPARENTUUID,
102 USAGE_I_PASSWORDHASH,
103 USAGE_BANDWIDTHCONTROL,
104 USAGE_I_GUESTSTATS,
105 USAGE_I_REPAIRHD,
106 USAGE_NATNETWORK,
107 USAGE_MEDIUMPROPERTY,
108 USAGE_ENCRYPTMEDIUM,
109 USAGE_MEDIUMENCCHKPWD,
110 USAGE_USBDEVSOURCE,
111 USAGE_CLOUDPROFILE,
112 USAGE_UPDATECHECK,
113 /* Insert new entries before this line, but only if it is not an option
114 * to go for the new style command and help handling (see e.g. extpack,
115 * unattend or mediumio. */
116 USAGE_S_NEWCMD = 10000, /**< new style command with no old help support */
117 USAGE_S_ALL,
118 USAGE_S_DUMPOPTS
119} USAGECATEGORY;
120/** @} */
121
122
123#define HELP_SCOPE_USBFILTER_ADD RT_BIT_64(0)
124#define HELP_SCOPE_USBFILTER_MODIFY RT_BIT_64(1)
125#define HELP_SCOPE_USBFILTER_REMOVE RT_BIT_64(2)
126
127#ifdef VBOX_WITH_GUEST_CONTROL
128# define HELP_SCOPE_GSTCTRL_RUN RT_BIT(0)
129# define HELP_SCOPE_GSTCTRL_START RT_BIT(1)
130# define HELP_SCOPE_GSTCTRL_COPYFROM RT_BIT(2)
131# define HELP_SCOPE_GSTCTRL_COPYTO RT_BIT(3)
132# define HELP_SCOPE_GSTCTRL_MKDIR RT_BIT(4)
133# define HELP_SCOPE_GSTCTRL_RMDIR RT_BIT(5)
134# define HELP_SCOPE_GSTCTRL_RM RT_BIT(6)
135# define HELP_SCOPE_GSTCTRL_MV RT_BIT(7)
136# define HELP_SCOPE_GSTCTRL_MKTEMP RT_BIT(8)
137# define HELP_SCOPE_GSTCTRL_LIST RT_BIT(9)
138# define HELP_SCOPE_GSTCTRL_CLOSEPROCESS RT_BIT(10)
139# define HELP_SCOPE_GSTCTRL_CLOSESESSION RT_BIT(11)
140# define HELP_SCOPE_GSTCTRL_STAT RT_BIT(12)
141# define HELP_SCOPE_GSTCTRL_UPDATEGA RT_BIT(13)
142# define HELP_SCOPE_GSTCTRL_WATCH RT_BIT(14)
143# define HELP_SCOPE_GSTCTRL_WAITRUNLEVEL RT_BIT(15)
144#endif
145
146/** command handler argument */
147struct HandlerArg
148{
149 int argc;
150 char **argv;
151
152#ifndef VBOX_ONLY_DOCS
153 ComPtr<IVirtualBox> virtualBox;
154 ComPtr<ISession> session;
155#endif
156};
157
158/** flag whether we're in internal mode */
159extern bool g_fInternalMode;
160
161/** showVMInfo details */
162typedef enum
163{
164 VMINFO_NONE = 0,
165 VMINFO_STANDARD = 1, /**< standard details */
166 VMINFO_FULL = 2, /**< both */
167 VMINFO_MACHINEREADABLE = 3, /**< both, and make it machine readable */
168 VMINFO_COMPACT = 4
169} VMINFO_DETAILS;
170
171
172////////////////////////////////////////////////////////////////////////////////
173//
174// global variables
175//
176////////////////////////////////////////////////////////////////////////////////
177
178extern bool g_fDetailedProgress; // in VBoxManage.cpp
179
180
181////////////////////////////////////////////////////////////////////////////////
182//
183// prototypes
184//
185////////////////////////////////////////////////////////////////////////////////
186
187/* VBoxManageHelp.cpp */
188
189/* Legacy help infrastructure, to be replaced by new one using generated help. */
190void printUsage(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, PRTSTREAM pStrm);
191RTEXITCODE errorSyntax(USAGECATEGORY enmCommand, const char *pszFormat, ...);
192RTEXITCODE errorSyntaxEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, const char *pszFormat, ...);
193RTEXITCODE errorGetOpt(USAGECATEGORY enmCommand, int rc, union RTGETOPTUNION const *pValueUnion);
194RTEXITCODE errorGetOptEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, int rc, union RTGETOPTUNION const *pValueUnion);
195RTEXITCODE errorArgument(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
196
197void printUsageInternal(USAGECATEGORY enmCommand, PRTSTREAM pStrm);
198
199#ifndef VBOX_ONLY_DOCS
200void setCurrentCommand(enum HELP_CMD_VBOXMANAGE enmCommand);
201void setCurrentSubcommand(uint64_t fCurSubcommandScope);
202
203void printUsage(PRTSTREAM pStrm);
204void printHelp(PRTSTREAM pStrm);
205RTEXITCODE errorNoSubcommand(void);
206RTEXITCODE errorUnknownSubcommand(const char *pszSubCmd);
207RTEXITCODE errorTooManyParameters(char **papszArgs);
208RTEXITCODE errorGetOpt(int rcGetOpt, union RTGETOPTUNION const *pValueUnion);
209RTEXITCODE errorFetchValue(int iValueNo, const char *pszOption, int rcGetOptFetchValue, union RTGETOPTUNION const *pValueUnion);
210RTEXITCODE errorSyntax(const char *pszFormat, ...);
211
212HRESULT showProgress(ComPtr<IProgress> progress);
213#endif
214
215/* VBoxManage.cpp */
216void showLogo(PRTSTREAM pStrm);
217
218#ifndef VBOX_ONLY_DOCS
219RTEXITCODE handleInternalCommands(HandlerArg *a);
220#endif /* !VBOX_ONLY_DOCS */
221
222/* VBoxManageControlVM.cpp */
223RTEXITCODE handleControlVM(HandlerArg *a);
224#ifndef VBOX_ONLY_DOCS
225unsigned int getMaxNics(IVirtualBox* vbox, IMachine* mach);
226#endif
227
228/* VBoxManageModifyVM.cpp */
229#ifndef VBOX_ONLY_DOCS
230void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups);
231#endif
232RTEXITCODE handleModifyVM(HandlerArg *a);
233
234/* VBoxManageDebugVM.cpp */
235RTEXITCODE handleDebugVM(HandlerArg *a);
236
237/* VBoxManageGuestProp.cpp */
238extern void usageGuestProperty(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2);
239
240/* VBoxManageGuestCtrl.cpp */
241extern void usageGuestControl(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2, uint64_t fSubcommandScope);
242
243#ifndef VBOX_ONLY_DOCS
244/* VBoxManageGuestProp.cpp */
245RTEXITCODE handleGuestProperty(HandlerArg *a);
246
247/* VBoxManageGuestCtrl.cpp */
248RTEXITCODE handleGuestControl(HandlerArg *a);
249
250/* VBoxManageVMInfo.cpp */
251HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
252 ComPtr<ISnapshot> &currentSnapshot,
253 VMINFO_DETAILS details,
254 const com::Utf8Str &prefix = "",
255 int level = 0);
256RTEXITCODE handleShowVMInfo(HandlerArg *a);
257HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox,
258 ComPtr<IMachine> pMachine,
259 ComPtr<ISession> pSession,
260 VMINFO_DETAILS details = VMINFO_NONE);
261const char *machineStateToName(MachineState_T machineState, bool fShort);
262HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
263 VMINFO_DETAILS details);
264
265/* VBoxManageList.cpp */
266RTEXITCODE handleList(HandlerArg *a);
267
268/* VBoxManageMetrics.cpp */
269RTEXITCODE handleMetrics(HandlerArg *a);
270
271/* VBoxManageMisc.cpp */
272RTEXITCODE handleRegisterVM(HandlerArg *a);
273RTEXITCODE handleUnregisterVM(HandlerArg *a);
274RTEXITCODE handleCreateVM(HandlerArg *a);
275RTEXITCODE handleCloneVM(HandlerArg *a);
276RTEXITCODE handleStartVM(HandlerArg *a);
277RTEXITCODE handleDiscardState(HandlerArg *a);
278RTEXITCODE handleAdoptState(HandlerArg *a);
279RTEXITCODE handleGetExtraData(HandlerArg *a);
280RTEXITCODE handleSetExtraData(HandlerArg *a);
281RTEXITCODE handleSetProperty(HandlerArg *a);
282RTEXITCODE handleSharedFolder(HandlerArg *a);
283RTEXITCODE handleExtPack(HandlerArg *a);
284RTEXITCODE handleUnattended(HandlerArg *a);
285RTEXITCODE handleMoveVM(HandlerArg *a);
286RTEXITCODE handleCloudProfile(HandlerArg *a);
287
288/* VBoxManageDisk.cpp */
289HRESULT openMedium(HandlerArg *a, const char *pszFilenameOrUuid,
290 DeviceType_T enmDevType, AccessMode_T enmAccessMode,
291 ComPtr<IMedium> &pMedium, bool fForceNewUuidOnOpen,
292 bool fSilent);
293RTEXITCODE handleCreateMedium(HandlerArg *a);
294RTEXITCODE handleModifyMedium(HandlerArg *a);
295RTEXITCODE handleCloneMedium(HandlerArg *a);
296RTEXITCODE handleMediumProperty(HandlerArg *a);
297RTEXITCODE handleEncryptMedium(HandlerArg *a);
298RTEXITCODE handleCheckMediumPassword(HandlerArg *a);
299RTEXITCODE handleConvertFromRaw(HandlerArg *a);
300HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
301 const ComPtr<IMedium> &pMedium,
302 const char *pszParentUUID,
303 bool fOptLong);
304RTEXITCODE handleShowMediumInfo(HandlerArg *a);
305RTEXITCODE handleCloseMedium(HandlerArg *a);
306RTEXITCODE handleMediumIO(HandlerArg *a);
307int parseMediumType(const char *psz, MediumType_T *penmMediumType);
308int parseBool(const char *psz, bool *pb);
309
310/* VBoxManageStorageController.cpp */
311RTEXITCODE handleStorageAttach(HandlerArg *a);
312RTEXITCODE handleStorageController(HandlerArg *a);
313
314// VBoxManageAppliance.cpp
315RTEXITCODE handleImportAppliance(HandlerArg *a);
316RTEXITCODE handleExportAppliance(HandlerArg *a);
317RTEXITCODE handleSignAppliance(HandlerArg *a);
318
319// VBoxManageSnapshot.cpp
320RTEXITCODE handleSnapshot(HandlerArg *a);
321
322/* VBoxManageUSB.cpp */
323RTEXITCODE handleUSBFilter(HandlerArg *a);
324RTEXITCODE handleUSBDevSource(HandlerArg *a);
325
326/* VBoxManageHostonly.cpp */
327RTEXITCODE handleHostonlyIf(HandlerArg *a);
328
329/* VBoxManageDHCPServer.cpp */
330RTEXITCODE handleDHCPServer(HandlerArg *a);
331
332/* VBoxManageNATNetwork.cpp */
333RTEXITCODE handleNATNetwork(HandlerArg *a);
334
335
336/* VBoxManageBandwidthControl.cpp */
337RTEXITCODE handleBandwidthControl(HandlerArg *a);
338
339/* VBoxManageCloud.cpp */
340RTEXITCODE handleCloud(HandlerArg *a);
341
342/* VBoxManageUpdateCheck.cpp */
343RTEXITCODE handleUpdateCheck(HandlerArg *a);
344
345#endif /* !VBOX_ONLY_DOCS */
346
347#endif /* !VBOX_INCLUDED_SRC_VBoxManage_VBoxManage_h */
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