1 | /* $Id: VBoxManage.h 21806 2009-07-27 10:14:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxManage - VirtualBox command-line interface, internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___H_VBOXMANAGE
|
---|
23 | #define ___H_VBOXMANAGE
|
---|
24 |
|
---|
25 | #ifndef VBOX_ONLY_DOCS
|
---|
26 | #include <VBox/com/com.h>
|
---|
27 | #include <VBox/com/ptr.h>
|
---|
28 | #include <VBox/com/VirtualBox.h>
|
---|
29 | #include <VBox/com/EventQueue.h>
|
---|
30 | #include <VBox/com/string.h>
|
---|
31 | #endif /* !VBOX_ONLY_DOCS */
|
---|
32 |
|
---|
33 | #include <iprt/types.h>
|
---|
34 |
|
---|
35 | #if defined(VBOX_WITH_XPCOM) && !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2)
|
---|
36 | # define USE_XPCOM_QUEUE
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | ////////////////////////////////////////////////////////////////////////////////
|
---|
40 | //
|
---|
41 | // definitions
|
---|
42 | //
|
---|
43 | ////////////////////////////////////////////////////////////////////////////////
|
---|
44 |
|
---|
45 | /** @name Syntax diagram category.
|
---|
46 | * @{ */
|
---|
47 | #define USAGE_DUMPOPTS 0
|
---|
48 | #define USAGE_LIST RT_BIT_64(0)
|
---|
49 | #define USAGE_SHOWVMINFO RT_BIT_64(1)
|
---|
50 | #define USAGE_REGISTERVM RT_BIT_64(2)
|
---|
51 | #define USAGE_UNREGISTERVM RT_BIT_64(3)
|
---|
52 | #define USAGE_CREATEVM RT_BIT_64(4)
|
---|
53 | #define USAGE_MODIFYVM RT_BIT_64(5)
|
---|
54 | #define USAGE_STARTVM RT_BIT_64(6)
|
---|
55 | #define USAGE_CONTROLVM RT_BIT_64(7)
|
---|
56 | #define USAGE_DISCARDSTATE RT_BIT_64(8)
|
---|
57 | #define USAGE_SNAPSHOT RT_BIT_64(9)
|
---|
58 | #define USAGE_OPENMEDIUM RT_BIT_64(10)
|
---|
59 | #define USAGE_CLOSEMEDIUM RT_BIT_64(11)
|
---|
60 | #define USAGE_SHOWHDINFO RT_BIT_64(12)
|
---|
61 | #define USAGE_CREATEHD RT_BIT_64(13)
|
---|
62 | #define USAGE_MODIFYHD RT_BIT_64(14)
|
---|
63 | #define USAGE_CLONEHD RT_BIT_64(15)
|
---|
64 | #define USAGE_ADDISCSIDISK RT_BIT_64(16)
|
---|
65 | #define USAGE_CREATEHOSTIF RT_BIT_64(17)
|
---|
66 | #define USAGE_REMOVEHOSTIF RT_BIT_64(18)
|
---|
67 | #define USAGE_GETEXTRADATA RT_BIT_64(19)
|
---|
68 | #define USAGE_SETEXTRADATA RT_BIT_64(20)
|
---|
69 | #define USAGE_SETPROPERTY RT_BIT_64(21)
|
---|
70 | #define USAGE_USBFILTER (RT_BIT_64(22) | RT_BIT_64(23) | RT_BIT_64(24))
|
---|
71 | #define USAGE_USBFILTER_ADD RT_BIT_64(22)
|
---|
72 | #define USAGE_USBFILTER_MODIFY RT_BIT_64(23)
|
---|
73 | #define USAGE_USBFILTER_REMOVE RT_BIT_64(24)
|
---|
74 | #define USAGE_SHAREDFOLDER (RT_BIT_64(25) | RT_BIT_64(26))
|
---|
75 | #define USAGE_SHAREDFOLDER_ADD RT_BIT_64(25)
|
---|
76 | #define USAGE_SHAREDFOLDER_REMOVE RT_BIT_64(26)
|
---|
77 | #define USAGE_LOADSYMS RT_BIT_64(29)
|
---|
78 | #define USAGE_UNLOADSYMS RT_BIT_64(30)
|
---|
79 | #define USAGE_SETHDUUID RT_BIT_64(31)
|
---|
80 | #define USAGE_CONVERTFROMRAW RT_BIT_64(32)
|
---|
81 | #define USAGE_LISTPARTITIONS RT_BIT_64(33)
|
---|
82 | #define USAGE_CREATERAWVMDK RT_BIT_64(34)
|
---|
83 | #define USAGE_VM_STATISTICS RT_BIT_64(35)
|
---|
84 | #define USAGE_ADOPTSTATE RT_BIT_64(36)
|
---|
85 | #define USAGE_MODINSTALL RT_BIT_64(37)
|
---|
86 | #define USAGE_MODUNINSTALL RT_BIT_64(38)
|
---|
87 | #define USAGE_RENAMEVMDK RT_BIT_64(39)
|
---|
88 | #ifdef VBOX_WITH_GUEST_PROPS
|
---|
89 | #define USAGE_GUESTPROPERTY RT_BIT_64(40)
|
---|
90 | #endif /* VBOX_WITH_GUEST_PROPS defined */
|
---|
91 | #define USAGE_CONVERTTORAW RT_BIT_64(41)
|
---|
92 | #define USAGE_METRICS RT_BIT_64(42)
|
---|
93 | #define USAGE_CONVERTHD RT_BIT_64(43)
|
---|
94 | #define USAGE_IMPORTAPPLIANCE RT_BIT_64(44)
|
---|
95 | #define USAGE_EXPORTAPPLIANCE RT_BIT_64(45)
|
---|
96 | #define USAGE_HOSTONLYIFS RT_BIT_64(46)
|
---|
97 | #define USAGE_DHCPSERVER RT_BIT_64(47)
|
---|
98 | #define USAGE_DUMPHDINFO RT_BIT_64(48)
|
---|
99 | #define USAGE_ALL (~(uint64_t)0)
|
---|
100 | /** @} */
|
---|
101 |
|
---|
102 | typedef uint64_t USAGECATEGORY;
|
---|
103 |
|
---|
104 | /** command handler argument */
|
---|
105 | struct HandlerArg
|
---|
106 | {
|
---|
107 | int argc;
|
---|
108 | char **argv;
|
---|
109 |
|
---|
110 | #ifdef USE_XPCOM_QUEUE
|
---|
111 | nsCOMPtr<nsIEventQueue> eventQ;
|
---|
112 | #endif
|
---|
113 | #ifndef VBOX_ONLY_DOCS
|
---|
114 | ComPtr<IVirtualBox> virtualBox;
|
---|
115 | ComPtr<ISession> session;
|
---|
116 | #endif
|
---|
117 | };
|
---|
118 |
|
---|
119 | /** flag whether we're in internal mode */
|
---|
120 | extern bool g_fInternalMode;
|
---|
121 |
|
---|
122 | /** showVMInfo details */
|
---|
123 | typedef enum
|
---|
124 | {
|
---|
125 | VMINFO_NONE = 0,
|
---|
126 | VMINFO_STANDARD = 1, /**< standard details */
|
---|
127 | VMINFO_STATISTICS = 2, /**< guest statistics */
|
---|
128 | VMINFO_FULL = 3, /**< both */
|
---|
129 | VMINFO_MACHINEREADABLE = 4, /**< both, and make it machine readable */
|
---|
130 | VMINFO_COMPACT = 5
|
---|
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);
|
---|
149 | int errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...);
|
---|
150 | int errorArgument(const char *pszFormat, ...);
|
---|
151 |
|
---|
152 | void printUsageInternal(USAGECATEGORY u64Cmd);
|
---|
153 |
|
---|
154 | #ifndef VBOX_ONLY_DOCS
|
---|
155 | LONG showProgress(ComPtr<IProgress> progress);
|
---|
156 | #endif
|
---|
157 |
|
---|
158 | /* VBoxManage.cpp */
|
---|
159 | void showLogo(void);
|
---|
160 |
|
---|
161 | #ifndef VBOX_ONLY_DOCS
|
---|
162 | int handleInternalCommands(HandlerArg *a);
|
---|
163 |
|
---|
164 | unsigned parseNum(const char *psz, unsigned cMaxNum, const char *name);
|
---|
165 | #endif /* !VBOX_ONLY_DOCS */
|
---|
166 |
|
---|
167 | /* VBoxManageModifyVM.cpp */
|
---|
168 | int handleModifyVM(HandlerArg *a);
|
---|
169 |
|
---|
170 | /* VBoxManageGuestProp.cpp */
|
---|
171 | extern void usageGuestProperty(void);
|
---|
172 | #ifndef VBOX_ONLY_DOCS
|
---|
173 | extern int handleGuestProperty(HandlerArg *a);
|
---|
174 |
|
---|
175 | /* VBoxManageVMInfo.cpp */
|
---|
176 | void showSnapshots(ComPtr<ISnapshot> rootSnapshot, VMINFO_DETAILS details, const com::Bstr &prefix = "", int level = 0);
|
---|
177 | int handleShowVMInfo(HandlerArg *a);
|
---|
178 | HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
|
---|
179 | ComPtr<IMachine> machine,
|
---|
180 | VMINFO_DETAILS details = VMINFO_NONE,
|
---|
181 | ComPtr <IConsole> console = ComPtr<IConsole>());
|
---|
182 |
|
---|
183 | /* VBoxManageList.cpp */
|
---|
184 | int handleList(HandlerArg *a);
|
---|
185 |
|
---|
186 | /* VBoxManageMetrics.cpp */
|
---|
187 | int handleMetrics(HandlerArg *a);
|
---|
188 |
|
---|
189 | /* VBoxManageDisk.cpp */
|
---|
190 | int handleCreateHardDisk(HandlerArg *a);
|
---|
191 | int handleModifyHardDisk(HandlerArg *a);
|
---|
192 | int handleCloneHardDisk(HandlerArg *a);
|
---|
193 | int handleConvertFromRaw(int argc, char *argv[]);
|
---|
194 | int handleAddiSCSIDisk(HandlerArg *a);
|
---|
195 | int handleShowHardDiskInfo(HandlerArg *a);
|
---|
196 | int handleOpenMedium(HandlerArg *a);
|
---|
197 | int handleCloseMedium(HandlerArg *a);
|
---|
198 |
|
---|
199 | // VBoxManageImport.cpp
|
---|
200 | int handleImportAppliance(HandlerArg *a);
|
---|
201 | int handleExportAppliance(HandlerArg *a);
|
---|
202 |
|
---|
203 | // VBoxManageSnapshot.cpp
|
---|
204 | int handleSnapshot(HandlerArg *a);
|
---|
205 |
|
---|
206 | /* VBoxManageUSB.cpp */
|
---|
207 | int handleUSBFilter(HandlerArg *a);
|
---|
208 |
|
---|
209 | /* VBoxManageHostonly.cpp */
|
---|
210 | int handleHostonlyIf(HandlerArg *a);
|
---|
211 |
|
---|
212 | /* VBoxManageHostonly.cpp */
|
---|
213 | int handleDHCPServer(HandlerArg *a);
|
---|
214 |
|
---|
215 | #endif /* !VBOX_ONLY_DOCS */
|
---|
216 | unsigned long VBoxSVNRev();
|
---|
217 |
|
---|
218 | #endif /* !___H_VBOXMANAGE */
|
---|
219 |
|
---|