VirtualBox

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

Last change on this file since 92406 was 92372, checked in by vboxsync, 3 years ago

Main: bugref:1909: Added translation marks around messages of VBoxManage output

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