VirtualBox

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

Last change on this file since 76678 was 76582, checked in by vboxsync, 5 years ago

Frontends: scm header guard alignment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.2 KB
Line 
1/* $Id: VBoxManage.h 76582 2019-01-01 06:25:48Z vboxsync $ */
2/** @file
3 * VBoxManage - VirtualBox command-line interface, internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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#endif
40
41
42////////////////////////////////////////////////////////////////////////////////
43//
44// definitions
45//
46////////////////////////////////////////////////////////////////////////////////
47
48/** @name Syntax diagram category.
49 * @{ */
50#define USAGE_DUMPOPTS 0
51#define USAGE_LIST RT_BIT_64(0)
52#define USAGE_SHOWVMINFO RT_BIT_64(1)
53#define USAGE_REGISTERVM RT_BIT_64(2)
54#define USAGE_UNREGISTERVM RT_BIT_64(3)
55#define USAGE_CREATEVM RT_BIT_64(4)
56#define USAGE_MODIFYVM RT_BIT_64(5)
57#define USAGE_CLONEVM RT_BIT_64(6)
58#define USAGE_STARTVM RT_BIT_64(7)
59#define USAGE_CONTROLVM RT_BIT_64(8)
60#define USAGE_DISCARDSTATE RT_BIT_64(9)
61#define USAGE_SNAPSHOT RT_BIT_64(10)
62#define USAGE_CLOSEMEDIUM RT_BIT_64(11)
63#define USAGE_SHOWMEDIUMINFO RT_BIT_64(12)
64#define USAGE_CREATEMEDIUM RT_BIT_64(13)
65#define USAGE_MODIFYMEDIUM RT_BIT_64(14)
66#define USAGE_CLONEMEDIUM RT_BIT_64(15)
67#define USAGE_MOVEVM RT_BIT_64(16)
68#define USAGE_CREATEHOSTIF RT_BIT_64(17)
69#define USAGE_REMOVEHOSTIF RT_BIT_64(18)
70#define USAGE_GETEXTRADATA RT_BIT_64(19)
71#define USAGE_SETEXTRADATA RT_BIT_64(20)
72#define USAGE_SETPROPERTY RT_BIT_64(21)
73#define USAGE_USBFILTER (RT_BIT_64(22) | RT_BIT_64(23) | RT_BIT_64(24))
74#define USAGE_USBFILTER_ADD RT_BIT_64(22)
75#define USAGE_USBFILTER_MODIFY RT_BIT_64(23)
76#define USAGE_USBFILTER_REMOVE RT_BIT_64(24)
77#define USAGE_SHAREDFOLDER (RT_BIT_64(25) | RT_BIT_64(26))
78#define USAGE_SHAREDFOLDER_ADD RT_BIT_64(25)
79#define USAGE_SHAREDFOLDER_REMOVE RT_BIT_64(26)
80#define USAGE_UNATTENDED RT_BIT_64(27)
81#define USAGE_MEDIUMIO RT_BIT_64(28)
82#define USAGE_LOADSYMS RT_BIT_64(29)
83#define USAGE_LOADMAP RT_BIT_64(30)
84#define USAGE_SETHDUUID RT_BIT_64(31)
85#define USAGE_CONVERTFROMRAW RT_BIT_64(32)
86#define USAGE_LISTPARTITIONS RT_BIT_64(33)
87#define USAGE_CREATERAWVMDK RT_BIT_64(34)
88#define USAGE_DEBUGVM RT_BIT_64(35)
89#define USAGE_ADOPTSTATE RT_BIT_64(36)
90#define USAGE_MODINSTALL RT_BIT_64(37)
91#define USAGE_MODUNINSTALL RT_BIT_64(38)
92#define USAGE_RENAMEVMDK RT_BIT_64(39)
93#ifdef VBOX_WITH_GUEST_PROPS
94# define USAGE_GUESTPROPERTY RT_BIT_64(40)
95#endif /* VBOX_WITH_GUEST_PROPS defined */
96#define USAGE_CONVERTTORAW RT_BIT_64(41)
97#define USAGE_METRICS RT_BIT_64(42)
98#define USAGE_CONVERTHD RT_BIT_64(43)
99#define USAGE_IMPORTAPPLIANCE RT_BIT_64(44)
100#define USAGE_EXPORTAPPLIANCE RT_BIT_64(45)
101#define USAGE_HOSTONLYIFS RT_BIT_64(46)
102#define USAGE_DHCPSERVER RT_BIT_64(47)
103#define USAGE_DUMPHDINFO RT_BIT_64(48)
104#define USAGE_STORAGEATTACH RT_BIT_64(49)
105#define USAGE_STORAGECONTROLLER RT_BIT_64(50)
106#ifdef VBOX_WITH_GUEST_CONTROL
107# define USAGE_GUESTCONTROL RT_BIT_64(51)
108#endif /* VBOX_WITH_GUEST_CONTROL defined */
109#define USAGE_DEBUGLOG RT_BIT_64(52)
110#define USAGE_SETHDPARENTUUID RT_BIT_64(53)
111#define USAGE_PASSWORDHASH RT_BIT_64(54)
112#define USAGE_EXTPACK RT_BIT_64(55)
113#define USAGE_BANDWIDTHCONTROL RT_BIT_64(56)
114#define USAGE_GUESTSTATS RT_BIT_64(57)
115#define USAGE_REPAIRHD RT_BIT_64(58)
116#define USAGE_NATNETWORK RT_BIT_64(59)
117#define USAGE_MEDIUMPROPERTY RT_BIT_64(60)
118#define USAGE_ENCRYPTMEDIUM RT_BIT_64(61)
119#define USAGE_MEDIUMENCCHKPWD RT_BIT_64(62)
120#define USAGE_USBDEVSOURCE RT_BIT_64(63)
121#define USAGE_ALL (~(uint64_t)0)
122/** @} */
123
124#ifdef VBOX_WITH_GUEST_CONTROL
125# define USAGE_GSTCTRL_RUN RT_BIT(0)
126# define USAGE_GSTCTRL_START RT_BIT(1)
127# define USAGE_GSTCTRL_COPYFROM RT_BIT(2)
128# define USAGE_GSTCTRL_COPYTO RT_BIT(3)
129# define USAGE_GSTCTRL_MKDIR RT_BIT(4)
130# define USAGE_GSTCTRL_RMDIR RT_BIT(5)
131# define USAGE_GSTCTRL_RM RT_BIT(6)
132# define USAGE_GSTCTRL_MV RT_BIT(7)
133# define USAGE_GSTCTRL_MKTEMP RT_BIT(8)
134# define USAGE_GSTCTRL_LIST RT_BIT(9)
135# define USAGE_GSTCTRL_CLOSEPROCESS RT_BIT(10)
136# define USAGE_GSTCTRL_CLOSESESSION RT_BIT(11)
137# define USAGE_GSTCTRL_STAT RT_BIT(12)
138# define USAGE_GSTCTRL_UPDATEGA RT_BIT(13)
139# define USAGE_GSTCTRL_WATCH RT_BIT(14)
140#endif
141
142
143typedef uint64_t USAGECATEGORY;
144
145/** command handler argument */
146struct HandlerArg
147{
148 int argc;
149 char **argv;
150
151#ifndef VBOX_ONLY_DOCS
152 ComPtr<IVirtualBox> virtualBox;
153 ComPtr<ISession> session;
154#endif
155};
156
157/** flag whether we're in internal mode */
158extern bool g_fInternalMode;
159
160/** showVMInfo details */
161typedef enum
162{
163 VMINFO_NONE = 0,
164 VMINFO_STANDARD = 1, /**< standard details */
165 VMINFO_FULL = 2, /**< both */
166 VMINFO_MACHINEREADABLE = 3, /**< both, and make it machine readable */
167 VMINFO_COMPACT = 4
168} VMINFO_DETAILS;
169
170
171////////////////////////////////////////////////////////////////////////////////
172//
173// global variables
174//
175////////////////////////////////////////////////////////////////////////////////
176
177extern bool g_fDetailedProgress; // in VBoxManage.cpp
178
179
180////////////////////////////////////////////////////////////////////////////////
181//
182// prototypes
183//
184////////////////////////////////////////////////////////////////////////////////
185
186/* VBoxManageHelp.cpp */
187void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm);
188RTEXITCODE errorSyntax(USAGECATEGORY fCategory, const char *pszFormat, ...);
189RTEXITCODE errorSyntaxEx(USAGECATEGORY fCategory, uint32_t fSubCategory, const char *pszFormat, ...);
190RTEXITCODE errorGetOpt(USAGECATEGORY fCategory, int rc, union RTGETOPTUNION const *pValueUnion);
191RTEXITCODE errorGetOptEx(USAGECATEGORY fCategory, uint32_t fSubCategory, int rc, union RTGETOPTUNION const *pValueUnion);
192RTEXITCODE errorArgument(const char *pszFormat, ...);
193
194void printUsageInternal(USAGECATEGORY fCategory, PRTSTREAM pStrm);
195
196#ifndef VBOX_ONLY_DOCS
197void setCurrentCommand(enum HELP_CMD_VBOXMANAGE enmCommand);
198void setCurrentSubcommand(uint64_t fCurSubcommandScope);
199
200void printUsage(PRTSTREAM pStrm);
201void printHelp(PRTSTREAM pStrm);
202RTEXITCODE errorNoSubcommand(void);
203RTEXITCODE errorUnknownSubcommand(const char *pszSubCmd);
204RTEXITCODE errorTooManyParameters(char **papszArgs);
205RTEXITCODE errorGetOpt(int rcGetOpt, union RTGETOPTUNION const *pValueUnion);
206RTEXITCODE errorSyntax(const char *pszFormat, ...);
207
208HRESULT showProgress(ComPtr<IProgress> progress);
209#endif
210
211/* VBoxManage.cpp */
212void showLogo(PRTSTREAM pStrm);
213
214#ifndef VBOX_ONLY_DOCS
215RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd);
216RTEXITCODE readPasswordFromConsole(com::Utf8Str *pPassword, const char *pszPrompt, ...);
217
218RTEXITCODE handleInternalCommands(HandlerArg *a);
219#endif /* !VBOX_ONLY_DOCS */
220
221/* VBoxManageControlVM.cpp */
222RTEXITCODE handleControlVM(HandlerArg *a);
223#ifndef VBOX_ONLY_DOCS
224unsigned int getMaxNics(IVirtualBox* vbox, IMachine* mach);
225#endif
226
227/* VBoxManageModifyVM.cpp */
228#ifndef VBOX_ONLY_DOCS
229void parseGroups(const char *pcszGroups, com::SafeArray<BSTR> *pGroups);
230#endif
231RTEXITCODE handleModifyVM(HandlerArg *a);
232
233/* VBoxManageDebugVM.cpp */
234RTEXITCODE handleDebugVM(HandlerArg *a);
235
236/* VBoxManageGuestProp.cpp */
237extern void usageGuestProperty(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2);
238
239/* VBoxManageGuestCtrl.cpp */
240extern void usageGuestControl(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2, uint32_t fSubCategory);
241
242#ifndef VBOX_ONLY_DOCS
243/* VBoxManageGuestProp.cpp */
244RTEXITCODE handleGuestProperty(HandlerArg *a);
245
246/* VBoxManageGuestCtrl.cpp */
247RTEXITCODE handleGuestControl(HandlerArg *a);
248
249/* VBoxManageVMInfo.cpp */
250HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
251 ComPtr<ISnapshot> &currentSnapshot,
252 VMINFO_DETAILS details,
253 const com::Utf8Str &prefix = "",
254 int level = 0);
255RTEXITCODE handleShowVMInfo(HandlerArg *a);
256HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox,
257 ComPtr<IMachine> pMachine,
258 ComPtr<ISession> pSession,
259 VMINFO_DETAILS details = VMINFO_NONE);
260const char *machineStateToName(MachineState_T machineState, bool fShort);
261HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
262 VMINFO_DETAILS details);
263
264/* VBoxManageList.cpp */
265RTEXITCODE handleList(HandlerArg *a);
266
267/* VBoxManageMetrics.cpp */
268RTEXITCODE handleMetrics(HandlerArg *a);
269
270/* VBoxManageMisc.cpp */
271RTEXITCODE handleRegisterVM(HandlerArg *a);
272RTEXITCODE handleUnregisterVM(HandlerArg *a);
273RTEXITCODE handleCreateVM(HandlerArg *a);
274RTEXITCODE handleCloneVM(HandlerArg *a);
275RTEXITCODE handleStartVM(HandlerArg *a);
276RTEXITCODE handleDiscardState(HandlerArg *a);
277RTEXITCODE handleAdoptState(HandlerArg *a);
278RTEXITCODE handleGetExtraData(HandlerArg *a);
279RTEXITCODE handleSetExtraData(HandlerArg *a);
280RTEXITCODE handleSetProperty(HandlerArg *a);
281RTEXITCODE handleSharedFolder(HandlerArg *a);
282RTEXITCODE handleExtPack(HandlerArg *a);
283RTEXITCODE handleUnattended(HandlerArg *a);
284RTEXITCODE handleMoveVM(HandlerArg *a);
285
286/* VBoxManageDisk.cpp */
287HRESULT openMedium(HandlerArg *a, const char *pszFilenameOrUuid,
288 DeviceType_T enmDevType, AccessMode_T enmAccessMode,
289 ComPtr<IMedium> &pMedium, bool fForceNewUuidOnOpen,
290 bool fSilent);
291RTEXITCODE handleCreateMedium(HandlerArg *a);
292RTEXITCODE handleModifyMedium(HandlerArg *a);
293RTEXITCODE handleCloneMedium(HandlerArg *a);
294RTEXITCODE handleMediumProperty(HandlerArg *a);
295RTEXITCODE handleEncryptMedium(HandlerArg *a);
296RTEXITCODE handleCheckMediumPassword(HandlerArg *a);
297RTEXITCODE handleConvertFromRaw(HandlerArg *a);
298HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
299 const ComPtr<IMedium> &pMedium,
300 const char *pszParentUUID,
301 bool fOptLong);
302RTEXITCODE handleShowMediumInfo(HandlerArg *a);
303RTEXITCODE handleCloseMedium(HandlerArg *a);
304RTEXITCODE handleMediumIO(HandlerArg *a);
305int parseMediumType(const char *psz, MediumType_T *penmMediumType);
306int parseBool(const char *psz, bool *pb);
307
308/* VBoxManageStorageController.cpp */
309RTEXITCODE handleStorageAttach(HandlerArg *a);
310RTEXITCODE handleStorageController(HandlerArg *a);
311
312// VBoxManageImport.cpp
313RTEXITCODE handleImportAppliance(HandlerArg *a);
314RTEXITCODE handleExportAppliance(HandlerArg *a);
315
316// VBoxManageSnapshot.cpp
317RTEXITCODE handleSnapshot(HandlerArg *a);
318
319/* VBoxManageUSB.cpp */
320RTEXITCODE handleUSBFilter(HandlerArg *a);
321RTEXITCODE handleUSBDevSource(HandlerArg *a);
322
323/* VBoxManageHostonly.cpp */
324RTEXITCODE handleHostonlyIf(HandlerArg *a);
325
326/* VBoxManageDHCPServer.cpp */
327RTEXITCODE handleDHCPServer(HandlerArg *a);
328
329/* VBoxManageNATNetwork.cpp */
330RTEXITCODE handleNATNetwork(HandlerArg *a);
331
332
333/* VBoxManageBandwidthControl.cpp */
334RTEXITCODE handleBandwidthControl(HandlerArg *a);
335
336#endif /* !VBOX_ONLY_DOCS */
337
338#endif /* !VBOX_INCLUDED_SRC_VBoxManage_VBoxManage_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use