1 | /* $Id: VBoxManage.h 40470 2012-03-15 06:18:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - VirtualBox command-line interface, internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2011 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 ___H_VBOXMANAGE
|
---|
19 | #define ___H_VBOXMANAGE
|
---|
20 |
|
---|
21 | #ifndef VBOX_ONLY_DOCS
|
---|
22 | #include <VBox/com/com.h>
|
---|
23 | #include <VBox/com/ptr.h>
|
---|
24 | #include <VBox/com/VirtualBox.h>
|
---|
25 | #include <VBox/com/string.h>
|
---|
26 | #endif /* !VBOX_ONLY_DOCS */
|
---|
27 |
|
---|
28 | #include <iprt/types.h>
|
---|
29 | #include <iprt/message.h>
|
---|
30 | #include <iprt/stream.h>
|
---|
31 |
|
---|
32 | ////////////////////////////////////////////////////////////////////////////////
|
---|
33 | //
|
---|
34 | // definitions
|
---|
35 | //
|
---|
36 | ////////////////////////////////////////////////////////////////////////////////
|
---|
37 |
|
---|
38 | /** @name Syntax diagram category.
|
---|
39 | * @{ */
|
---|
40 | #define USAGE_DUMPOPTS 0
|
---|
41 | #define USAGE_LIST RT_BIT_64(0)
|
---|
42 | #define USAGE_SHOWVMINFO RT_BIT_64(1)
|
---|
43 | #define USAGE_REGISTERVM RT_BIT_64(2)
|
---|
44 | #define USAGE_UNREGISTERVM RT_BIT_64(3)
|
---|
45 | #define USAGE_CREATEVM RT_BIT_64(4)
|
---|
46 | #define USAGE_MODIFYVM RT_BIT_64(5)
|
---|
47 | #define USAGE_CLONEVM RT_BIT_64(6)
|
---|
48 | #define USAGE_STARTVM RT_BIT_64(7)
|
---|
49 | #define USAGE_CONTROLVM RT_BIT_64(8)
|
---|
50 | #define USAGE_DISCARDSTATE RT_BIT_64(9)
|
---|
51 | #define USAGE_SNAPSHOT RT_BIT_64(10)
|
---|
52 | #define USAGE_CLOSEMEDIUM RT_BIT_64(11)
|
---|
53 | #define USAGE_SHOWHDINFO RT_BIT_64(12)
|
---|
54 | #define USAGE_CREATEHD RT_BIT_64(13)
|
---|
55 | #define USAGE_MODIFYHD RT_BIT_64(14)
|
---|
56 | #define USAGE_CLONEHD RT_BIT_64(15)
|
---|
57 | #define USAGE_CREATEHOSTIF RT_BIT_64(17)
|
---|
58 | #define USAGE_REMOVEHOSTIF RT_BIT_64(18)
|
---|
59 | #define USAGE_GETEXTRADATA RT_BIT_64(19)
|
---|
60 | #define USAGE_SETEXTRADATA RT_BIT_64(20)
|
---|
61 | #define USAGE_SETPROPERTY RT_BIT_64(21)
|
---|
62 | #define USAGE_USBFILTER (RT_BIT_64(22) | RT_BIT_64(23) | RT_BIT_64(24))
|
---|
63 | #define USAGE_USBFILTER_ADD RT_BIT_64(22)
|
---|
64 | #define USAGE_USBFILTER_MODIFY RT_BIT_64(23)
|
---|
65 | #define USAGE_USBFILTER_REMOVE RT_BIT_64(24)
|
---|
66 | #define USAGE_SHAREDFOLDER (RT_BIT_64(25) | RT_BIT_64(26))
|
---|
67 | #define USAGE_SHAREDFOLDER_ADD RT_BIT_64(25)
|
---|
68 | #define USAGE_SHAREDFOLDER_REMOVE RT_BIT_64(26)
|
---|
69 | #define USAGE_LOADSYMS RT_BIT_64(29)
|
---|
70 | #define USAGE_LOADMAP RT_BIT_64(30)
|
---|
71 | #define USAGE_SETHDUUID RT_BIT_64(31)
|
---|
72 | #define USAGE_CONVERTFROMRAW RT_BIT_64(32)
|
---|
73 | #define USAGE_LISTPARTITIONS RT_BIT_64(33)
|
---|
74 | #define USAGE_CREATERAWVMDK RT_BIT_64(34)
|
---|
75 | #define USAGE_DEBUGVM RT_BIT_64(35)
|
---|
76 | #define USAGE_ADOPTSTATE RT_BIT_64(36)
|
---|
77 | #define USAGE_MODINSTALL RT_BIT_64(37)
|
---|
78 | #define USAGE_MODUNINSTALL RT_BIT_64(38)
|
---|
79 | #define USAGE_RENAMEVMDK RT_BIT_64(39)
|
---|
80 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
81 | # define USAGE_GUESTPROPERTY RT_BIT_64(40)
|
---|
82 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
83 | #define USAGE_CONVERTTORAW RT_BIT_64(41)
|
---|
84 | #define USAGE_METRICS RT_BIT_64(42)
|
---|
85 | #define USAGE_CONVERTHD RT_BIT_64(43)
|
---|
86 | #define USAGE_IMPORTAPPLIANCE RT_BIT_64(44)
|
---|
87 | #define USAGE_EXPORTAPPLIANCE RT_BIT_64(45)
|
---|
88 | #define USAGE_HOSTONLYIFS RT_BIT_64(46)
|
---|
89 | #define USAGE_DHCPSERVER RT_BIT_64(47)
|
---|
90 | #define USAGE_DUMPHDINFO RT_BIT_64(48)
|
---|
91 | #define USAGE_STORAGEATTACH RT_BIT_64(49)
|
---|
92 | #define USAGE_STORAGECONTROLLER RT_BIT_64(50)
|
---|
93 | #ifdef VBOX_WITH_GUEST_CONTROL
|
---|
94 | # define USAGE_GUESTCONTROL RT_BIT_64(51)
|
---|
95 | #endif /* VBOX_WITH_GUEST_CONTROL defined */
|
---|
96 | #define USAGE_DEBUGLOG RT_BIT_64(52)
|
---|
97 | #define USAGE_SETHDPARENTUUID RT_BIT_64(53)
|
---|
98 | #define USAGE_PASSWORDHASH RT_BIT_64(54)
|
---|
99 | #define USAGE_EXTPACK RT_BIT_64(55)
|
---|
100 | #define USAGE_BANDWIDTHCONTROL RT_BIT_64(56)
|
---|
101 | #define USAGE_GUESTSTATS RT_BIT_64(57)
|
---|
102 | #define USAGE_REPAIRHD RT_BIT_64(58)
|
---|
103 | #define USAGE_ALL (~(uint64_t)0)
|
---|
104 | /** @} */
|
---|
105 |
|
---|
106 | typedef uint64_t USAGECATEGORY;
|
---|
107 |
|
---|
108 | /** command handler argument */
|
---|
109 | struct HandlerArg
|
---|
110 | {
|
---|
111 | int argc;
|
---|
112 | char **argv;
|
---|
113 |
|
---|
114 | #ifndef VBOX_ONLY_DOCS
|
---|
115 | ComPtr<IVirtualBox> virtualBox;
|
---|
116 | ComPtr<ISession> session;
|
---|
117 | #endif
|
---|
118 | };
|
---|
119 |
|
---|
120 | /** flag whether we're in internal mode */
|
---|
121 | extern bool g_fInternalMode;
|
---|
122 |
|
---|
123 | /** showVMInfo details */
|
---|
124 | typedef enum
|
---|
125 | {
|
---|
126 | VMINFO_NONE = 0,
|
---|
127 | VMINFO_STANDARD = 1, /**< standard details */
|
---|
128 | VMINFO_FULL = 2, /**< both */
|
---|
129 | VMINFO_MACHINEREADABLE = 3, /**< both, and make it machine readable */
|
---|
130 | VMINFO_COMPACT = 4
|
---|
131 | } VMINFO_DETAILS;
|
---|
132 |
|
---|
133 | ////////////////////////////////////////////////////////////////////////////////
|
---|
134 | //
|
---|
135 | // global variables
|
---|
136 | //
|
---|
137 | ////////////////////////////////////////////////////////////////////////////////
|
---|
138 |
|
---|
139 | extern bool g_fDetailedProgress; // in VBoxManage.cpp
|
---|
140 |
|
---|
141 | ////////////////////////////////////////////////////////////////////////////////
|
---|
142 | //
|
---|
143 | // prototypes
|
---|
144 | //
|
---|
145 | ////////////////////////////////////////////////////////////////////////////////
|
---|
146 |
|
---|
147 | /* VBoxManageHelp.cpp */
|
---|
148 | void printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm);
|
---|
149 | RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...);
|
---|
150 | RTEXITCODE errorGetOpt(USAGECATEGORY u64Cmd, int rc, union RTGETOPTUNION const *pValueUnion);
|
---|
151 | RTEXITCODE errorArgument(const char *pszFormat, ...);
|
---|
152 |
|
---|
153 | void printUsageInternal(USAGECATEGORY u64Cmd, PRTSTREAM pStrm);
|
---|
154 |
|
---|
155 | #ifndef VBOX_ONLY_DOCS
|
---|
156 | HRESULT showProgress(ComPtr<IProgress> progress);
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | /* VBoxManage.cpp */
|
---|
160 | void showLogo(PRTSTREAM pStrm);
|
---|
161 |
|
---|
162 | #ifndef VBOX_ONLY_DOCS
|
---|
163 | int handleInternalCommands(HandlerArg *a);
|
---|
164 | #endif /* !VBOX_ONLY_DOCS */
|
---|
165 |
|
---|
166 | /* VBoxManageControlVM.cpp */
|
---|
167 | int handleControlVM(HandlerArg *a);
|
---|
168 | #ifndef VBOX_ONLY_DOCS
|
---|
169 | unsigned int getMaxNics(IVirtualBox* vbox, IMachine* mach);
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | /* VBoxManageModifyVM.cpp */
|
---|
173 | int handleModifyVM(HandlerArg *a);
|
---|
174 |
|
---|
175 | /* VBoxManageDebugVM.cpp */
|
---|
176 | int handleDebugVM(HandlerArg *a);
|
---|
177 |
|
---|
178 | /* VBoxManageGuestProp.cpp */
|
---|
179 | extern void usageGuestProperty(PRTSTREAM pStrm);
|
---|
180 |
|
---|
181 | /* VBoxManageGuestCtrl.cpp */
|
---|
182 | extern void usageGuestControl(PRTSTREAM pStrm);
|
---|
183 |
|
---|
184 | #ifndef VBOX_ONLY_DOCS
|
---|
185 | /* VBoxManageGuestProp.cpp */
|
---|
186 | extern int handleGuestProperty(HandlerArg *a);
|
---|
187 |
|
---|
188 | /* VBoxManageGuestCtrl.cpp */
|
---|
189 | extern int handleGuestControl(HandlerArg *a);
|
---|
190 |
|
---|
191 | /* VBoxManageVMInfo.cpp */
|
---|
192 | HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
|
---|
193 | ComPtr<ISnapshot> ¤tSnapshot,
|
---|
194 | VMINFO_DETAILS details,
|
---|
195 | const com::Bstr &prefix = "",
|
---|
196 | int level = 0);
|
---|
197 | int handleShowVMInfo(HandlerArg *a);
|
---|
198 | HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
|
---|
199 | ComPtr<IMachine> machine,
|
---|
200 | VMINFO_DETAILS details = VMINFO_NONE,
|
---|
201 | ComPtr <IConsole> console = ComPtr<IConsole>());
|
---|
202 | const char *machineStateToName(MachineState_T machineState, bool fShort);
|
---|
203 | HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
|
---|
204 | VMINFO_DETAILS details);
|
---|
205 |
|
---|
206 | /* VBoxManageList.cpp */
|
---|
207 | int handleList(HandlerArg *a);
|
---|
208 |
|
---|
209 | /* VBoxManageMetrics.cpp */
|
---|
210 | int handleMetrics(HandlerArg *a);
|
---|
211 |
|
---|
212 | /* VBoxManageMisc.cpp */
|
---|
213 | int handleRegisterVM(HandlerArg *a);
|
---|
214 | int handleUnregisterVM(HandlerArg *a);
|
---|
215 | int handleCreateVM(HandlerArg *a);
|
---|
216 | int handleCloneVM(HandlerArg *a);
|
---|
217 | int handleStartVM(HandlerArg *a);
|
---|
218 | int handleDiscardState(HandlerArg *a);
|
---|
219 | int handleAdoptState(HandlerArg *a);
|
---|
220 | int handleGetExtraData(HandlerArg *a);
|
---|
221 | int handleSetExtraData(HandlerArg *a);
|
---|
222 | int handleSetProperty(HandlerArg *a);
|
---|
223 | int handleSharedFolder(HandlerArg *a);
|
---|
224 | int handleExtPack(HandlerArg *a);
|
---|
225 |
|
---|
226 | /* VBoxManageDisk.cpp */
|
---|
227 | HRESULT findMedium(HandlerArg *a, const char *pszFilenameOrUuid,
|
---|
228 | DeviceType_T enmDevType, bool fSilent,
|
---|
229 | ComPtr<IMedium> &pMedium);
|
---|
230 | HRESULT findOrOpenMedium(HandlerArg *a, const char *pszFilenameOrUuid,
|
---|
231 | DeviceType_T enmDevType, ComPtr<IMedium> &pMedium,
|
---|
232 | bool fForceNewUuidOnOpen, bool *pfWasUnknown);
|
---|
233 | int handleCreateHardDisk(HandlerArg *a);
|
---|
234 | int handleModifyHardDisk(HandlerArg *a);
|
---|
235 | int handleCloneHardDisk(HandlerArg *a);
|
---|
236 | RTEXITCODE handleConvertFromRaw(int argc, char *argv[]);
|
---|
237 | int handleShowHardDiskInfo(HandlerArg *a);
|
---|
238 | int handleCloseMedium(HandlerArg *a);
|
---|
239 | int parseDiskType(const char *psz, MediumType_T *pDiskType);
|
---|
240 |
|
---|
241 | /* VBoxManageStorageController.cpp */
|
---|
242 | int handleStorageAttach(HandlerArg *a);
|
---|
243 | int handleStorageController(HandlerArg *a);
|
---|
244 |
|
---|
245 | // VBoxManageImport.cpp
|
---|
246 | int handleImportAppliance(HandlerArg *a);
|
---|
247 | int handleExportAppliance(HandlerArg *a);
|
---|
248 |
|
---|
249 | // VBoxManageSnapshot.cpp
|
---|
250 | int handleSnapshot(HandlerArg *a);
|
---|
251 |
|
---|
252 | /* VBoxManageUSB.cpp */
|
---|
253 | int handleUSBFilter(HandlerArg *a);
|
---|
254 |
|
---|
255 | /* VBoxManageHostonly.cpp */
|
---|
256 | int handleHostonlyIf(HandlerArg *a);
|
---|
257 |
|
---|
258 | /* VBoxManageHostonly.cpp */
|
---|
259 | int handleDHCPServer(HandlerArg *a);
|
---|
260 |
|
---|
261 | /* VBoxManageBandwidthControl.cpp */
|
---|
262 | int handleBandwidthControl(HandlerArg *a);
|
---|
263 |
|
---|
264 | #endif /* !VBOX_ONLY_DOCS */
|
---|
265 |
|
---|
266 | #endif /* !___H_VBOXMANAGE */
|
---|