VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp@ 36082

Last change on this file since 36082 was 36082, checked in by vboxsync, 14 years ago

Added a promiscModePolicy attribute to INetworkAdapter, three values: deny (default), allow-network (i.e. VMs), allow-all (i.e. include unrelated host traffic).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 37.0 KB
Line 
1/* $Id: VBoxManageHelp.cpp 36082 2011-02-25 12:21:57Z vboxsync $ */
2/** @file
3 * VBoxManage - help and other message output.
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
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <VBox/version.h>
23
24#include <iprt/buildconfig.h>
25#include <iprt/ctype.h>
26#include <iprt/err.h>
27#include <iprt/getopt.h>
28#include <iprt/stream.h>
29
30#include "VBoxManage.h"
31
32
33
34void showLogo(PRTSTREAM pStrm)
35{
36 static bool s_fShown; /* show only once */
37
38 if (!s_fShown)
39 {
40 RTStrmPrintf(pStrm, VBOX_PRODUCT " Command Line Management Interface Version "
41 VBOX_VERSION_STRING "\n"
42 "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
43 "All rights reserved.\n"
44 "\n");
45 s_fShown = true;
46 }
47}
48
49void printUsage(USAGECATEGORY u64Cmd, PRTSTREAM pStrm)
50{
51 bool fDumpOpts = false;
52#ifdef RT_OS_LINUX
53 bool fLinux = true;
54#else
55 bool fLinux = false;
56#endif
57#ifdef RT_OS_WINDOWS
58 bool fWin = true;
59#else
60 bool fWin = false;
61#endif
62#ifdef RT_OS_SOLARIS
63 bool fSolaris = true;
64#else
65 bool fSolaris = false;
66#endif
67#ifdef RT_OS_FREEBSD
68 bool fFreeBSD = true;
69#else
70 bool fFreeBSD = false;
71#endif
72#ifdef RT_OS_DARWIN
73 bool fDarwin = true;
74#else
75 bool fDarwin = false;
76#endif
77#ifdef VBOX_WITH_VBOXSDL
78 bool fVBoxSDL = true;
79#else
80 bool fVBoxSDL = false;
81#endif
82
83 if (u64Cmd == USAGE_DUMPOPTS)
84 {
85 fDumpOpts = true;
86 fLinux = true;
87 fWin = true;
88 fSolaris = true;
89 fFreeBSD = true;
90 fDarwin = true;
91 fVBoxSDL = true;
92 u64Cmd = USAGE_ALL;
93 }
94
95 RTStrmPrintf(pStrm,
96 "Usage:\n"
97 "\n");
98
99 if (u64Cmd == USAGE_ALL)
100 RTStrmPrintf(pStrm,
101 "VBoxManage [-v|--version] print version number and exit\n"
102 "VBoxManage [-q|--nologo] ... suppress the logo\n"
103 "\n");
104
105 if (u64Cmd & USAGE_LIST)
106 RTStrmPrintf(pStrm,
107 "VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|\n"
108#if defined(VBOX_WITH_NETFLT)
109 " bridgedifs|hostonlyifs|dhcpservers|hostinfo|\n"
110#else
111 " bridgedifs|dhcpservers|hostinfo|\n"
112#endif
113 " hostcpuids|hddbackends|hdds|dvds|floppies|\n"
114 " usbhost|usbfilters|systemproperties|extpacks\n"
115 "\n");
116
117 if (u64Cmd & USAGE_SHOWVMINFO)
118 RTStrmPrintf(pStrm,
119 "VBoxManage showvminfo <uuid>|<name> [--details]\n"
120 " [--machinereadable]\n"
121 "VBoxManage showvminfo <uuid>|<name> --log <idx>\n"
122 "\n");
123
124 if (u64Cmd & USAGE_REGISTERVM)
125 RTStrmPrintf(pStrm,
126 "VBoxManage registervm <filename>\n"
127 "\n");
128
129 if (u64Cmd & USAGE_UNREGISTERVM)
130 RTStrmPrintf(pStrm,
131 "VBoxManage unregistervm <uuid>|<name> [--delete]\n"
132 "\n");
133
134 if (u64Cmd & USAGE_CREATEVM)
135 RTStrmPrintf(pStrm,
136 "VBoxManage createvm --name <name>\n"
137 " [--ostype <ostype>]\n"
138 " [--register]\n"
139 " [--basefolder <path> | --settingsfile <path>]\n"
140 " [--uuid <uuid>]\n"
141 "\n");
142
143 if (u64Cmd & USAGE_MODIFYVM)
144 {
145 RTStrmPrintf(pStrm,
146 "VBoxManage modifyvm <uuid|name>\n"
147 " [--name <name>]\n"
148 " [--ostype <ostype>]\n"
149 " [--memory <memorysize in MB>]\n"
150 " [--pagefusion on|off]\n"
151 " [--vram <vramsize in MB>]\n"
152 " [--acpi on|off]\n"
153 " [--ioapic on|off]\n"
154 " [--pae on|off]\n"
155 " [--hpet on|off]\n"
156 " [--hwvirtex on|off]\n"
157 " [--hwvirtexexcl on|off]\n"
158 " [--nestedpaging on|off]\n"
159 " [--largepages on|off]\n"
160 " [--vtxvpid on|off]\n"
161 " [--synthcpu on|off]\n"
162 " [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
163 " [--cpuidremove <leaf>]\n"
164 " [--cpuidremoveall]\n"
165 " [--hardwareuuid <uuid>]\n"
166 " [--cpus <number>]\n"
167 " [--cpuhotplug on|off]\n"
168 " [--plugcpu <id>]\n"
169 " [--unplugcpu <id>]\n"
170 " [--cpuexecutioncap <1-100>]\n"
171 " [--rtcuseutc on|off]\n"
172 " [--monitorcount <number>]\n"
173 " [--accelerate3d on|off]\n"
174#ifdef VBOX_WITH_VIDEOHWACCEL
175 " [--accelerate2dvideo on|off]\n"
176#endif
177 " [--firmware bios|efi|efi32|efi64]\n"
178 " [--chipset ich9|piix3]\n"
179 " [--bioslogofadein on|off]\n"
180 " [--bioslogofadeout on|off]\n"
181 " [--bioslogodisplaytime <msec>]\n"
182 " [--bioslogoimagepath <imagepath>]\n"
183 " [--biosbootmenu disabled|menuonly|messageandmenu]\n"
184 " [--biossystemtimeoffset <msec>]\n"
185 " [--biospxedebug on|off]\n"
186 " [--boot<1-4> none|floppy|dvd|disk|net>]\n"
187 " [--nic<1-N> none|null|nat|bridged|intnet"
188#if defined(VBOX_WITH_NETFLT)
189 "|hostonly"
190#endif
191#ifdef VBOX_WITH_VDE
192 "|\n"
193 " vde"
194#endif
195 "]\n"
196 " [--nictype<1-N> Am79C970A|Am79C973"
197#ifdef VBOX_WITH_E1000
198 "|\n 82540EM|82543GC|82545EM"
199#endif
200#ifdef VBOX_WITH_VIRTIO
201 "|\n virtio"
202#endif /* VBOX_WITH_VIRTIO */
203 "]\n"
204 " [--cableconnected<1-N> on|off]\n"
205 " [--nictrace<1-N> on|off]\n"
206 " [--nictracefile<1-N> <filename>]\n"
207 " [--nicspeed<1-N> <kbps>]\n"
208 " [--nicbootprio<1-N> <priority>]\n"
209 " [--nicpromisc<1-N> deny|allow-vms|allow-all]\n"
210 " [--bridgeadapter<1-N> none|<devicename>]\n"
211#if defined(VBOX_WITH_NETFLT)
212 " [--hostonlyadapter<1-N> none|<devicename>]\n"
213#endif
214 " [--intnet<1-N> <network name>]\n"
215 " [--natnet<1-N> <network>|default]\n"
216#ifdef VBOX_WITH_VDE
217 " [--vdenet<1-N> <network>|default]\n"
218#endif
219 " [--natsettings<1-N> [<mtu>],[<socksnd>],\n"
220 " [<sockrcv>],[<tcpsnd>],\n"
221 " [<tcprcv>]]\n"
222 " [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
223 " <hostport>,[<guestip>],<guestport>]\n"
224 " [--natpf<1-N> delete <rulename>]\n"
225 " [--nattftpprefix<1-N> <prefix>]\n"
226 " [--nattftpfile<1-N> <file>]\n"
227 " [--nattftpserver<1-N> <ip>]\n"
228 " [--natdnspassdomain<1-N> on|off]\n"
229 " [--natdnsproxy<1-N> on|off]\n"
230 " [--natdnshostresolver<1-N> on|off]\n"
231 " [--nataliasmode<1-N> default|[log],[proxyonly],\n"
232 " [sameports]]\n"
233 " [--macaddress<1-N> auto|<mac>]\n"
234 " [--mouse ps2|usb|usbtablet\n"
235 " [--keyboard ps2|usb\n"
236 " [--uart<1-N> off|<I/O base> <IRQ>]\n"
237 " [--uartmode<1-N> disconnected|\n"
238 " server <pipe>|\n"
239 " client <pipe>|\n"
240 " file <file>|\n"
241 " <devicename>]\n"
242 " [--guestmemoryballoon <balloonsize in MB>]\n"
243 " [--gueststatisticsinterval <seconds>]\n"
244 " [--audio none|null");
245 if (fWin)
246 {
247#ifdef VBOX_WITH_WINMM
248 RTStrmPrintf(pStrm, "|winmm|dsound");
249#else
250 RTStrmPrintf(pStrm, "|dsound");
251#endif
252 }
253 if (fSolaris)
254 {
255 RTStrmPrintf(pStrm, "|solaudio"
256#ifdef VBOX_WITH_SOLARIS_OSS
257 "|oss"
258#endif
259 );
260 }
261 if (fLinux)
262 {
263 RTStrmPrintf(pStrm, "|oss"
264#ifdef VBOX_WITH_ALSA
265 "|alsa"
266#endif
267#ifdef VBOX_WITH_PULSE
268 "|pulse"
269#endif
270 );
271 }
272 if (fFreeBSD)
273 {
274 /* Get the line break sorted when dumping all option variants. */
275 if (fDumpOpts)
276 {
277 RTStrmPrintf(pStrm, "|\n"
278 " oss");
279 }
280 else
281 RTStrmPrintf(pStrm, "|oss");
282#ifdef VBOX_WITH_PULSE
283 RTStrmPrintf(pStrm, "|pulse");
284#endif
285 }
286 if (fDarwin)
287 {
288 RTStrmPrintf(pStrm, "|coreaudio");
289 }
290 RTStrmPrintf(pStrm, "]\n");
291 RTStrmPrintf(pStrm,
292 " [--audiocontroller ac97|hda|sb16]\n"
293 " [--clipboard disabled|hosttoguest|guesttohost|\n"
294 " bidirectional]\n");
295 RTStrmPrintf(pStrm,
296 " [--vrde on|off]\n"
297 " [--vrdeextpack default|<name>\n"
298 " [--vrdeproperty <name=[value]>]\n"
299 " [--vrdeport <hostport>]\n"
300 " [--vrdeaddress <hostip>]\n"
301 " [--vrdeauthtype null|external|guest]\n"
302 " [--vrdeauthlibrary default|<name>\n"
303 " [--vrdemulticon on|off]\n"
304 " [--vrdereusecon on|off]\n"
305 " [--vrdevideochannel on|off]\n"
306 " [--vrdevideochannelquality <percent>]\n");
307 RTStrmPrintf(pStrm,
308 " [--usb on|off]\n"
309 " [--usbehci on|off]\n"
310 " [--snapshotfolder default|<path>]\n"
311 " [--teleporter on|off]\n"
312 " [--teleporterport <port>]\n"
313 " [--teleporteraddress <address|empty>\n"
314 " [--teleporterpassword <password>]\n"
315#if 0
316 " [--iocache on|off]\n"
317 " [--iocachesize <I/O cache size in MB>]\n"
318#endif
319#if 0
320 " [--faulttolerance master|standby]\n"
321 " [--faulttoleranceaddress <name>]\n"
322 " [--faulttoleranceport <port>]\n"
323 " [--faulttolerancesyncinterval <msec>]\n"
324 " [--faulttolerancepassword <password>]\n"
325#endif
326 "\n");
327 }
328
329 if (u64Cmd & USAGE_IMPORTAPPLIANCE)
330 RTStrmPrintf(pStrm,
331 "VBoxManage import <ovf/ova> [--dry-run|-n] [more options]\n"
332 " (run with -n to have options displayed\n"
333 " for a particular OVF)\n\n");
334
335 if (u64Cmd & USAGE_EXPORTAPPLIANCE)
336 RTStrmPrintf(pStrm,
337 "VBoxManage export <machines> --output|-o <ovf/ova>\n"
338 " [--legacy09]\n"
339 " [--manifest]\n"
340 " [--vsys <number of virtual system>]\n"
341 " [--product <product name>]\n"
342 " [--producturl <product url>]\n"
343 " [--vendor <vendor name>]\n"
344 " [--vendorurl <vendor url>]\n"
345 " [--version <version info>]\n"
346 " [--eula <license text>]\n"
347 " [--eulafile <filename>]\n"
348 "\n");
349
350 if (u64Cmd & USAGE_STARTVM)
351 {
352 RTStrmPrintf(pStrm,
353 "VBoxManage startvm <uuid>|<name>\n");
354 RTStrmPrintf(pStrm,
355 " [--type gui");
356 if (fVBoxSDL)
357 RTStrmPrintf(pStrm, "|sdl");
358 RTStrmPrintf(pStrm, "|headless]\n");
359 RTStrmPrintf(pStrm,
360 "\n");
361 }
362
363 if (u64Cmd & USAGE_CONTROLVM)
364 {
365 RTStrmPrintf(pStrm,
366 "VBoxManage controlvm <uuid>|<name>\n"
367 " pause|resume|reset|poweroff|savestate|\n"
368 " acpipowerbutton|acpisleepbutton|\n"
369 " keyboardputscancode <hex> [<hex> ...]|\n"
370 " setlinkstate<1-N> on|off |\n"
371#if defined(VBOX_WITH_NETFLT)
372 " nic<1-N> null|nat|bridged|intnet|hostonly\n"
373 " [<devicename>] |\n"
374#else /* !RT_OS_LINUX && !RT_OS_DARWIN */
375 " nic<1-N> null|nat|bridged|intnet\n"
376 " [<devicename>] |\n"
377#endif /* !RT_OS_LINUX && !RT_OS_DARWIN */
378 " nictrace<1-N> on|off\n"
379 " nictracefile<1-N> <filename>\n"
380 " natpf<1-N> [<rulename>],tcp|udp,[<hostip>],\n"
381 " <hostport>,[<guestip>],<guestport>\n"
382 " natpf<1-N> delete <rulename>\n"
383 " guestmemoryballoon <balloonsize in MB>]\n"
384 " gueststatisticsinterval <seconds>]\n"
385 " usbattach <uuid>|<address> |\n"
386 " usbdetach <uuid>|<address> |\n");
387 RTStrmPrintf(pStrm,
388 " vrde on|off |\n");
389 RTStrmPrintf(pStrm,
390 " vrdeport <port> |\n"
391 " vrdeproperty <name=[value]> |\n"
392 " vrdevideochannelquality <percent>\n");
393 RTStrmPrintf(pStrm,
394 " setvideomodehint <xres> <yres> <bpp> [display] |\n"
395 " setcredentials <username> <password> <domain>\n"
396 " [--allowlocallogon <yes|no>] |\n"
397 " teleport --host <name> --port <port>\n"
398 " [--maxdowntime <msec>] [--password password]\n"
399 " plugcpu <id>\n"
400 " unplugcpu <id>\n"
401 " cpuexecutioncap <1-100>\n"
402 "\n");
403 }
404
405 if (u64Cmd & USAGE_DISCARDSTATE)
406 RTStrmPrintf(pStrm,
407 "VBoxManage discardstate <uuid>|<name>\n"
408 "\n");
409
410 if (u64Cmd & USAGE_ADOPTSTATE)
411 RTStrmPrintf(pStrm,
412 "VBoxManage adoptstate <uuid>|<name> <state_file>\n"
413 "\n");
414
415 if (u64Cmd & USAGE_SNAPSHOT)
416 RTStrmPrintf(pStrm,
417 "VBoxManage snapshot <uuid>|<name>\n"
418 " take <name> [--description <desc>] [--pause] |\n"
419 " delete <uuid>|<name> |\n"
420 " restore <uuid>|<name> |\n"
421 " restorecurrent |\n"
422 " edit <uuid>|<name>|--current\n"
423 " [--name <name>]\n"
424 " [--description <desc>] |\n"
425 " showvminfo <uuid>|<name>\n"
426 "\n");
427
428 if (u64Cmd & USAGE_CLOSEMEDIUM)
429 RTStrmPrintf(pStrm,
430 "VBoxManage closemedium disk|dvd|floppy <uuid>|<filename>\n"
431 " [--delete]\n"
432 "\n");
433
434 if (u64Cmd & USAGE_STORAGEATTACH)
435 RTStrmPrintf(pStrm,
436 "VBoxManage storageattach <uuid|vmname>\n"
437 " --storagectl <name>\n"
438 " --port <number>\n"
439 " --device <number>\n"
440 " [--type dvddrive|hdd|fdd]\n"
441 " [--medium none|emptydrive|\n"
442 " <uuid>|<filename>|host:<drive>|iscsi]\n"
443 " [--mtype normal|writethrough|immutable|shareable|\n"
444 " readonly|multiattach]\n"
445 " [--comment <text>]\n"
446 " [--passthrough on|off]\n"
447 " [--bandwidthgroup <name>]\n"
448 " [--forceunmount]\n"
449 " [--server <name>|<ip>]\n"
450 " [--target <target>]\n"
451 " [--port <port>]\n"
452 " [--lun <lun>]\n"
453 " [--encodedlun <lun>]\n"
454 " [--username <username>]\n"
455 " [--password <password>]\n"
456 " [--intnet]\n"
457 "\n");
458
459 if (u64Cmd & USAGE_STORAGECONTROLLER)
460 RTStrmPrintf(pStrm,
461 "VBoxManage storagectl <uuid|vmname>\n"
462 " --name <name>\n"
463 " [--add ide|sata|scsi|floppy|sas]\n"
464 " [--controller LSILogic|LSILogicSAS|BusLogic|\n"
465 " IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
466 " [--sataideemulation<1-4> <1-30>]\n"
467 " [--sataportcount <1-30>]\n"
468 " [--hostiocache on|off]\n"
469 " [--bootable on|off]\n"
470 " [--remove]\n"
471 "\n");
472
473 if (u64Cmd & USAGE_BANDWIDTHCONTROL)
474 RTStrmPrintf(pStrm,
475 "VBoxManage bandwidthctl <uuid|vmname>\n"
476 " --name <name>\n"
477 " [--add disk|network]\n"
478 " [--limit <megabytes per second>\n"
479 " [--delete]\n"
480 "\n");
481
482 if (u64Cmd & USAGE_SHOWHDINFO)
483 RTStrmPrintf(pStrm,
484 "VBoxManage showhdinfo <uuid>|<filename>\n"
485 "\n");
486
487 if (u64Cmd & USAGE_CREATEHD)
488 RTStrmPrintf(pStrm,
489 "VBoxManage createhd --filename <filename>\n"
490 " --size <megabytes>|--sizebyte <bytes>\n"
491 " [--format VDI|VMDK|VHD] (default: VDI)\n"
492 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
493 "\n");
494
495 if (u64Cmd & USAGE_MODIFYHD)
496 RTStrmPrintf(pStrm,
497 "VBoxManage modifyhd <uuid>|<filename>\n"
498 " [--type normal|writethrough|immutable|shareable|\n"
499 " readonly|multiattach]\n"
500 " [--autoreset on|off]\n"
501 " [--compact]\n"
502 " [--resize <megabytes>|--resizebyte <bytes>]\n"
503 "\n");
504
505 if (u64Cmd & USAGE_CLONEHD)
506 RTStrmPrintf(pStrm,
507 "VBoxManage clonehd <uuid>|<filename> <outputfile>\n"
508 " [--format VDI|VMDK|VHD|RAW|<other>]\n"
509 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
510 " [--existing]\n"
511 "\n");
512
513 if (u64Cmd & USAGE_CONVERTFROMRAW)
514 RTStrmPrintf(pStrm,
515 "VBoxManage convertfromraw <filename> <outputfile>\n"
516 " [--format VDI|VMDK|VHD]\n"
517 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
518#ifndef RT_OS_WINDOWS
519 "VBoxManage convertfromraw stdin <outputfile> <bytes>\n"
520 " [--format VDI|VMDK|VHD]\n"
521 " [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
522#endif
523 "\n");
524
525 if (u64Cmd & USAGE_GETEXTRADATA)
526 RTStrmPrintf(pStrm,
527 "VBoxManage getextradata global|<uuid>|<name>\n"
528 " <key>|enumerate\n"
529 "\n");
530
531 if (u64Cmd & USAGE_SETEXTRADATA)
532 RTStrmPrintf(pStrm,
533 "VBoxManage setextradata global|<uuid>|<name>\n"
534 " <key>\n"
535 " [<value>] (no value deletes key)\n"
536 "\n");
537
538 if (u64Cmd & USAGE_SETPROPERTY)
539 RTStrmPrintf(pStrm,
540 "VBoxManage setproperty machinefolder default|<folder> |\n"
541 " vrdeauthlibrary default|<library> |\n"
542 " websrvauthlibrary default|null|<library> |\n"
543 " vrdeextpack null|<library> |\n"
544 " loghistorycount <value>\n"
545 "\n");
546
547 if (u64Cmd & USAGE_USBFILTER_ADD)
548 RTStrmPrintf(pStrm,
549 "VBoxManage usbfilter add <index,0-N>\n"
550 " --target <uuid>|<name>|global\n"
551 " --name <string>\n"
552 " --action ignore|hold (global filters only)\n"
553 " [--active yes|no] (yes)\n"
554 " [--vendorid <XXXX>] (null)\n"
555 " [--productid <XXXX>] (null)\n"
556 " [--revision <IIFF>] (null)\n"
557 " [--manufacturer <string>] (null)\n"
558 " [--product <string>] (null)\n"
559 " [--remote yes|no] (null, VM filters only)\n"
560 " [--serialnumber <string>] (null)\n"
561 " [--maskedinterfaces <XXXXXXXX>]\n"
562 "\n");
563
564 if (u64Cmd & USAGE_USBFILTER_MODIFY)
565 RTStrmPrintf(pStrm,
566 "VBoxManage usbfilter modify <index,0-N>\n"
567 " --target <uuid>|<name>|global\n"
568 " [--name <string>]\n"
569 " [--action ignore|hold] (global filters only)\n"
570 " [--active yes|no]\n"
571 " [--vendorid <XXXX>|\"\"]\n"
572 " [--productid <XXXX>|\"\"]\n"
573 " [--revision <IIFF>|\"\"]\n"
574 " [--manufacturer <string>|\"\"]\n"
575 " [--product <string>|\"\"]\n"
576 " [--remote yes|no] (null, VM filters only)\n"
577 " [--serialnumber <string>|\"\"]\n"
578 " [--maskedinterfaces <XXXXXXXX>]\n"
579 "\n");
580
581 if (u64Cmd & USAGE_USBFILTER_REMOVE)
582 RTStrmPrintf(pStrm,
583 "VBoxManage usbfilter remove <index,0-N>\n"
584 " --target <uuid>|<name>|global\n"
585 "\n");
586
587 if (u64Cmd & USAGE_SHAREDFOLDER_ADD)
588 RTStrmPrintf(pStrm,
589 "VBoxManage sharedfolder add <vmname>|<uuid>\n"
590 " --name <name> --hostpath <hostpath>\n"
591 " [--transient] [--readonly] [--automount]\n"
592 "\n");
593
594 if (u64Cmd & USAGE_SHAREDFOLDER_REMOVE)
595 RTStrmPrintf(pStrm,
596 "VBoxManage sharedfolder remove <vmname>|<uuid>\n"
597 " --name <name> [--transient]\n"
598 "\n");
599
600#ifdef VBOX_WITH_GUEST_PROPS
601 if (u64Cmd & USAGE_GUESTPROPERTY)
602 usageGuestProperty(pStrm);
603#endif /* VBOX_WITH_GUEST_PROPS defined */
604
605#ifdef VBOX_WITH_GUEST_CONTROL
606 if (u64Cmd & USAGE_GUESTCONTROL)
607 usageGuestControl(pStrm);
608#endif /* VBOX_WITH_GUEST_CONTROL defined */
609
610 if (u64Cmd & USAGE_DEBUGVM)
611 {
612 RTStrmPrintf(pStrm,
613 "VBoxManage debugvm <uuid>|<name>\n"
614 " dumpguestcore --filename <name> |\n"
615 " info <item> [args] |\n"
616 " injectnmi |\n"
617 " osdetect |\n"
618 " osinfo |\n"
619 " getregisters [--cpu <id>] <reg>|all ... |\n"
620 " setregisters [--cpu <id>] <reg>=<value> ... |\n"
621 " statistics [--reset] [--pattern <pattern>]\n"
622 " [--descriptions]\n"
623 "\n");
624 }
625 if (u64Cmd & USAGE_METRICS)
626 RTStrmPrintf(pStrm,
627 "VBoxManage metrics list [*|host|<vmname> [<metric_list>]]\n"
628 " (comma-separated)\n\n"
629 "VBoxManage metrics setup\n"
630 " [--period <seconds>] (default: 1)\n"
631 " [--samples <count>] (default: 1)\n"
632 " [--list]\n"
633 " [*|host|<vmname> [<metric_list>]]\n\n"
634 "VBoxManage metrics query [*|host|<vmname> [<metric_list>]]\n\n"
635 "VBoxManage metrics enable\n"
636 " [--list]\n"
637 " [*|host|<vmname> [<metric_list>]]\n\n"
638 "VBoxManage metrics disable\n"
639 " [--list]\n"
640 " [*|host|<vmname> [<metric_list>]]\n\n"
641 "VBoxManage metrics collect\n"
642 " [--period <seconds>] (default: 1)\n"
643 " [--samples <count>] (default: 1)\n"
644 " [--list]\n"
645 " [--detach]\n"
646 " [*|host|<vmname> [<metric_list>]]\n"
647 "\n");
648
649#if defined(VBOX_WITH_NETFLT)
650 if (u64Cmd & USAGE_HOSTONLYIFS)
651 {
652 RTStrmPrintf(pStrm,
653 "VBoxManage hostonlyif ipconfig <name>\n"
654 " [--dhcp |\n"
655 " --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |\n"
656 " --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]\n"
657# if !defined(RT_OS_SOLARIS)
658 " create |\n"
659 " remove <name>\n"
660# endif
661 "\n");
662 }
663#endif
664
665 if (u64Cmd & USAGE_DHCPSERVER)
666 {
667 RTStrmPrintf(pStrm,
668 "VBoxManage dhcpserver add|modify --netname <network_name> |\n"
669#if defined(VBOX_WITH_NETFLT)
670 " --ifname <hostonly_if_name>\n"
671#endif
672 " [--ip <ip_address>\n"
673 " --netmask <network_mask>\n"
674 " --lowerip <lower_ip>\n"
675 " --upperip <upper_ip>]\n"
676 " [--enable | --disable]\n\n"
677 "VBoxManage dhcpserver remove --netname <network_name> |\n"
678#if defined(VBOX_WITH_NETFLT)
679 " --ifname <hostonly_if_name>\n"
680#endif
681 "\n");
682 }
683 if (u64Cmd & USAGE_EXTPACK)
684 {
685 RTStrmPrintf(pStrm,
686 "VBoxManage extpack install <tarball> |\n"
687 " uninstall [--force] <name> |\n"
688 " cleanup\n"
689 "\n");
690 }
691}
692
693/**
694 * Print a usage synopsis and the syntax error message.
695 * @returns RTEXITCODE_SYNTAX.
696 */
697RTEXITCODE errorSyntax(USAGECATEGORY u64Cmd, const char *pszFormat, ...)
698{
699 va_list args;
700 showLogo(g_pStdErr); // show logo even if suppressed
701#ifndef VBOX_ONLY_DOCS
702 if (g_fInternalMode)
703 printUsageInternal(u64Cmd, g_pStdErr);
704 else
705 printUsage(u64Cmd, g_pStdErr);
706#endif /* !VBOX_ONLY_DOCS */
707 va_start(args, pszFormat);
708 RTStrmPrintf(g_pStdErr, "\nSyntax error: %N\n", pszFormat, &args);
709 va_end(args);
710 return RTEXITCODE_SYNTAX;
711}
712
713/**
714 * errorSyntax for RTGetOpt users.
715 *
716 * @returns RTEXITCODE_SYNTAX.
717 *
718 * @param fUsageCategory The usage category of the command.
719 * @param rc The RTGetOpt return code.
720 * @param pValueUnion The value union.
721 */
722RTEXITCODE errorGetOpt(USAGECATEGORY fUsageCategory, int rc, union RTGETOPTUNION const *pValueUnion)
723{
724 /*
725 * Check if it is an unhandled standard option.
726 */
727 if (rc == 'V')
728 {
729 RTPrintf("%sr%d\n", VBOX_VERSION_STRING, RTBldCfgRevision());
730 return RTEXITCODE_SUCCESS;
731 }
732
733 if (rc == 'h')
734 {
735 showLogo(g_pStdErr);
736#ifndef VBOX_ONLY_DOCS
737 if (g_fInternalMode)
738 printUsageInternal(fUsageCategory, g_pStdOut);
739 else
740 printUsage(fUsageCategory, g_pStdOut);
741#endif
742 return RTEXITCODE_SUCCESS;
743 }
744
745 /*
746 * General failure.
747 */
748 showLogo(g_pStdErr); // show logo even if suppressed
749#ifndef VBOX_ONLY_DOCS
750 if (g_fInternalMode)
751 printUsageInternal(fUsageCategory, g_pStdErr);
752 else
753 printUsage(fUsageCategory, g_pStdErr);
754#endif /* !VBOX_ONLY_DOCS */
755
756 if (rc == VINF_GETOPT_NOT_OPTION)
757 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid parameter '%s'", pValueUnion->psz);
758 if (rc > 0)
759 {
760 if (RT_C_IS_PRINT(rc))
761 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option -%c", rc);
762 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid option case %i", rc);
763 }
764 if (rc == VERR_GETOPT_UNKNOWN_OPTION)
765 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz);
766 if (pValueUnion->pDef)
767 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc);
768 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%Rrs", rc);
769}
770
771/**
772 * Print an error message without the syntax stuff.
773 *
774 * @returns RTEXITCODE_SYNTAX.
775 */
776RTEXITCODE errorArgument(const char *pszFormat, ...)
777{
778 va_list args;
779 va_start(args, pszFormat);
780 RTMsgErrorV(pszFormat, args);
781 va_end(args);
782 return RTEXITCODE_SYNTAX;
783}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette