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