1 | /* $Id: VBoxManage.h 30319 2010-06-21 08:29:08Z 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_DEBUGLOG RT_BIT_64(52)
|
---|
96 | #define USAGE_ALL (~(uint64_t)0)
|
---|
97 | /** @} */
|
---|
98 |
|
---|
99 | typedef uint64_t USAGECATEGORY;
|
---|
100 |
|
---|
101 | /** command handler argument */
|
---|
102 | struct HandlerArg
|
---|
103 | {
|
---|
104 | int argc;
|
---|
105 | char **argv;
|
---|
106 |
|
---|
107 | #ifndef VBOX_ONLY_DOCS
|
---|
108 | ComPtr<IVirtualBox> virtualBox;
|
---|
109 | ComPtr<ISession> session;
|
---|
110 | #endif
|
---|
111 | };
|
---|
112 |
|
---|
113 | /** flag whether we're in internal mode */
|
---|
114 | extern bool g_fInternalMode;
|
---|
115 |
|
---|
116 | /** showVMInfo details */
|
---|
117 | typedef enum
|
---|
118 | {
|
---|
119 | VMINFO_NONE = 0,
|
---|
120 | VMINFO_STANDARD = 1, /**< standard details */
|
---|
121 | VMINFO_FULL = 2, /**< both */
|
---|
122 | VMINFO_MACHINEREADABLE = 3, /**< both, and make it machine readable */
|
---|
123 | VMINFO_COMPACT = 4
|
---|
124 | } VMINFO_DETAILS;
|
---|
125 |
|
---|
126 | ////////////////////////////////////////////////////////////////////////////////
|
---|
127 | //
|
---|
128 | // global variables
|
---|
129 | //
|
---|
130 | ////////////////////////////////////////////////////////////////////////////////
|
---|
131 |
|
---|
132 | extern bool g_fDetailedProgress; // in VBoxManage.cpp
|
---|
133 |
|
---|
134 | ////////////////////////////////////////////////////////////////////////////////
|
---|
135 | //
|
---|
136 | // prototypes
|
---|
137 | //
|
---|
138 | ////////////////////////////////////////////////////////////////////////////////
|
---|
139 |
|
---|
140 | /* VBoxManageHelp.cpp */
|
---|
141 | void printUsage(USAGECATEGORY u64Cmd);
|
---|
142 | int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...);
|
---|
143 | int errorGetOpt(USAGECATEGORY u64Cmd, int rc, union RTGETOPTUNION const *pValueUnion);
|
---|
144 | int errorArgument(const char *pszFormat, ...);
|
---|
145 |
|
---|
146 | void printUsageInternal(USAGECATEGORY u64Cmd);
|
---|
147 |
|
---|
148 | #ifndef VBOX_ONLY_DOCS
|
---|
149 | HRESULT showProgress(ComPtr<IProgress> progress);
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | /* VBoxManage.cpp */
|
---|
153 | void showLogo(void);
|
---|
154 |
|
---|
155 | #ifndef VBOX_ONLY_DOCS
|
---|
156 | int handleInternalCommands(HandlerArg *a);
|
---|
157 | #endif /* !VBOX_ONLY_DOCS */
|
---|
158 |
|
---|
159 | /* VBoxManageControlVM.cpp */
|
---|
160 | int handleControlVM(HandlerArg *a);
|
---|
161 |
|
---|
162 | /* VBoxManageModifyVM.cpp */
|
---|
163 | int handleModifyVM(HandlerArg *a);
|
---|
164 |
|
---|
165 | /* VBoxManageGuestProp.cpp */
|
---|
166 | extern void usageGuestProperty(void);
|
---|
167 | #ifndef VBOX_ONLY_DOCS
|
---|
168 | extern int handleGuestProperty(HandlerArg *a);
|
---|
169 |
|
---|
170 | /* VBoxManageGuestCtrl.cpp */
|
---|
171 | extern int handleGuestControl(HandlerArg *a);
|
---|
172 | extern void usageGuestControl(void);
|
---|
173 |
|
---|
174 | /* VBoxManageVMInfo.cpp */
|
---|
175 | void showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
|
---|
176 | ComPtr<ISnapshot> ¤tSnapshot,
|
---|
177 | VMINFO_DETAILS details,
|
---|
178 | const com::Bstr &prefix = "",
|
---|
179 | int level = 0);
|
---|
180 | int handleShowVMInfo(HandlerArg *a);
|
---|
181 | HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
|
---|
182 | ComPtr<IMachine> machine,
|
---|
183 | VMINFO_DETAILS details = VMINFO_NONE,
|
---|
184 | ComPtr <IConsole> console = ComPtr<IConsole>());
|
---|
185 |
|
---|
186 | /* VBoxManageList.cpp */
|
---|
187 | int handleList(HandlerArg *a);
|
---|
188 |
|
---|
189 | /* VBoxManageMetrics.cpp */
|
---|
190 | int handleMetrics(HandlerArg *a);
|
---|
191 |
|
---|
192 | /* VBoxManageMisc.cpp */
|
---|
193 | int handleRegisterVM(HandlerArg *a);
|
---|
194 | int handleUnregisterVM(HandlerArg *a);
|
---|
195 | int handleCreateVM(HandlerArg *a);
|
---|
196 | int handleStartVM(HandlerArg *a);
|
---|
197 | int handleDiscardState(HandlerArg *a);
|
---|
198 | int handleAdoptState(HandlerArg *a);
|
---|
199 | int handleGetExtraData(HandlerArg *a);
|
---|
200 | int handleSetExtraData(HandlerArg *a);
|
---|
201 | int handleSetProperty(HandlerArg *a);
|
---|
202 | int handleSharedFolder(HandlerArg *a);
|
---|
203 | int handleVMStatistics(HandlerArg *a);
|
---|
204 |
|
---|
205 | /* VBoxManageDisk.cpp */
|
---|
206 | int handleCreateHardDisk(HandlerArg *a);
|
---|
207 | int handleModifyHardDisk(HandlerArg *a);
|
---|
208 | int handleCloneHardDisk(HandlerArg *a);
|
---|
209 | int handleConvertFromRaw(int argc, char *argv[]);
|
---|
210 | int handleAddiSCSIDisk(HandlerArg *a);
|
---|
211 | int handleShowHardDiskInfo(HandlerArg *a);
|
---|
212 | int handleOpenMedium(HandlerArg *a);
|
---|
213 | int handleCloseMedium(HandlerArg *a);
|
---|
214 |
|
---|
215 | /* VBoxManageStorageController.cpp */
|
---|
216 | int handleStorageAttach(HandlerArg *a);
|
---|
217 | int handleStorageController(HandlerArg *a);
|
---|
218 |
|
---|
219 | // VBoxManageImport.cpp
|
---|
220 | int handleImportAppliance(HandlerArg *a);
|
---|
221 | int handleExportAppliance(HandlerArg *a);
|
---|
222 |
|
---|
223 | // VBoxManageSnapshot.cpp
|
---|
224 | int handleSnapshot(HandlerArg *a);
|
---|
225 |
|
---|
226 | /* VBoxManageUSB.cpp */
|
---|
227 | int handleUSBFilter(HandlerArg *a);
|
---|
228 |
|
---|
229 | /* VBoxManageHostonly.cpp */
|
---|
230 | int handleHostonlyIf(HandlerArg *a);
|
---|
231 |
|
---|
232 | /* VBoxManageHostonly.cpp */
|
---|
233 | int handleDHCPServer(HandlerArg *a);
|
---|
234 |
|
---|
235 | #endif /* !VBOX_ONLY_DOCS */
|
---|
236 |
|
---|
237 | #endif /* !___H_VBOXMANAGE */
|
---|
238 |
|
---|