VirtualBox

source: vbox/trunk/doc/manual/en_US/SDKRef.xml@ 103052

Last change on this file since 103052 was 103052, checked in by vboxsync, 4 months ago

Docs: Updated changelog. bugref:10579

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 291.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright (C) 2006-2023 Oracle and/or its affiliates.
4
5 This file is part of VirtualBox base platform packages, as
6 available from https://www.virtualbox.org.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation, in version 3 of the
11 License.
12
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <https://www.gnu.org/licenses>.
20
21 SPDX-License-Identifier: GPL-3.0-only
22-->
23<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
24 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
25<!ENTITY % all.entities SYSTEM "all-entities.ent">
26%all.entities;
27]>
28
29<book>
30 <bookinfo>
31 <title>&VBOX_PRODUCT;</title>
32
33 <subtitle>Programming Guide and Reference</subtitle>
34
35 <edition>Version &VBOX_VERSION_STRING;</edition>
36
37 <corpauthor>&VBOX_VENDOR;</corpauthor>
38
39 <address>http://www.virtualbox.org</address>
40
41 <copyright>
42 <year>2004-&VBOX_C_YEAR;</year>
43
44 <holder>&VBOX_VENDOR;</holder>
45 </copyright>
46 </bookinfo>
47
48 <chapter>
49 <title>Introduction</title>
50
51 <para>VirtualBox comes with comprehensive support for third-party
52 developers. This Software Development Kit (SDK) contains all the
53 documentation and interface files that are needed to write code that
54 interacts with VirtualBox.</para>
55
56 <sect1>
57 <title>Modularity: the building blocks of VirtualBox</title>
58
59 <para>VirtualBox is cleanly separated into several layers, which can be
60 visualized like in the picture below:</para>
61
62 <mediaobject>
63 <imageobject>
64 <imagedata align="center" fileref="images/vbox-components.png"
65 width="12cm"/>
66 </imageobject>
67 </mediaobject>
68
69 <para>The orange area represents code that runs in kernel mode, the blue
70 area represents userspace code.</para>
71
72 <para>At the bottom of the stack resides the hypervisor -- the core of
73 the virtualization engine, controlling execution of the virtual machines
74 and making sure they do not conflict with each other or with whatever else
75 the host computer is doing.</para>
76
77 <para>On top of the hypervisor, additional internal modules provide
78 extra functionality. For example, the RDP server, which can deliver the
79 graphical output of a VM remotely to an RDP client, is a separate module
80 that is only loosely tacked onto the virtual graphics device.</para>
81
82 <para>What is primarily of interest for purposes of the SDK is the API
83 layer block that sits on top of all the previously mentioned blocks.
84 This API, which we call the <emphasis role="bold">"Main API"</emphasis>,
85 exposes the entire feature set of the virtualization engine below. It is
86 completely documented in this SDK Reference -- see <xref
87 linkend="sdkref_classes"/> and <xref linkend="sdkref_enums"/> -- and
88 available to anyone who wishes to control VirtualBox programmatically.
89 We chose the name "Main API" to differentiate it from other programming
90 interfaces of VirtualBox that may be publicly accessible.</para>
91
92 <para>With the Main API, you can create, configure, start, stop and
93 delete virtual machines, retrieve performance statistics about running
94 VMs, configure the VirtualBox installation in general, and more. In
95 fact, internally, the front-end programs
96 <computeroutput>VirtualBox</computeroutput> and
97 <computeroutput>VBoxManage</computeroutput> use nothing but this API as
98 well -- there are no hidden backdoors into the virtualization engine for
99 our own front-ends. This ensures the entire Main API is both
100 well-documented and well-tested. (The same applies to
101 <computeroutput>VBoxHeadless</computeroutput>, which is not shown in the
102 image.)</para>
103 </sect1>
104
105 <sect1 id="webservice-or-com">
106 <title>Two guises of the same "Main API": the web service or
107 COM/XPCOM</title>
108
109 <para>There are several ways in which the Main API can be called by
110 other code:<orderedlist>
111 <listitem>
112 <para>VirtualBox comes with a <emphasis role="bold">web
113 service</emphasis> that maps nearly the entire Main API. The web
114 service ships in a stand-alone executable
115 (<computeroutput>vboxwebsrv</computeroutput>) that, when running,
116 acts as an HTTP server, accepts SOAP connections and processes
117 them.</para>
118
119 <para>Since the entire web service API is publicly described in a
120 web service description file (in WSDL format), you can write
121 client programs that call the web service in any language with a
122 toolkit that understands WSDL. These days, that includes most
123 programming languages that are available: Java, C++, .NET, PHP,
124 Python, Perl and probably many more.</para>
125
126 <para>All of this is explained in detail in subsequent chapters of
127 this book.</para>
128
129 <para>There are two ways in which you can write client code that
130 uses the web service:<orderedlist>
131 <listitem>
132 <para>For Java as well as Python, the SDK contains
133 easy-to-use classes that allow you to use the web service in
134 an object-oriented, straightforward manner. We shall refer
135 to this as the <emphasis role="bold">"object-oriented web
136 service (OOWS)"</emphasis>.</para>
137
138 <para>The OO bindings for Java are described in <xref
139 linkend="javaapi"/>, those for Python in <xref
140 linkend="glue-python-ws"/>.</para>
141 </listitem>
142
143 <listitem>
144 <para>Alternatively, you can use the web service directly,
145 without the object-oriented client layer. We shall refer to
146 this as the <emphasis role="bold">"raw web
147 service"</emphasis>.</para>
148
149 <para>You will then have neither native object orientation
150 nor full type safety, since web services are neither
151 object-oriented nor stateful. However, in this way, you can
152 write client code even in languages for which we do not ship
153 object-oriented client code; all you need is a programming
154 language with a toolkit that can parse WSDL and generate
155 client wrapper code from it.</para>
156
157 <para>We describe this further in <xref
158 linkend="raw-webservice"/>, with samples for Java and
159 Perl.</para>
160 </listitem>
161 </orderedlist></para>
162 </listitem>
163
164 <listitem>
165 <para>Internally, for portability and easier maintenance, the Main
166 API is implemented using the <emphasis role="bold">Component
167 Object Model (COM), </emphasis> an interprocess mechanism for
168 software components originally introduced by Microsoft for
169 Microsoft Windows. On a Windows host, VirtualBox will use
170 Microsoft COM; on other hosts where COM is not present, VirtualBox
171 ships with XPCOM, a free software implementation of COM originally
172 created by the Mozilla project for their browsers.</para>
173
174 <para>So if you are familiar with COM and the C++ programming
175 language (or with any other programming language that can handle
176 COM/XPCOM objects, such as Java, Visual Basic or C#), then you can
177 use the COM/XPCOM API directly. VirtualBox comes with all the
178 necessary files and documentation to build fully functional COM
179 applications. For an introduction, please see <xref
180 linkend="api_com"/> below.</para>
181
182 <para>The VirtualBox front-ends (the graphical user interfaces as
183 well as the command line), which are all written in C++, use
184 COM/XPCOM to call the Main API. Technically, the web service is
185 another front-end to this COM API, mapping almost all of it to
186 SOAP clients.</para>
187 </listitem>
188 </orderedlist></para>
189
190 <para>If you are wondering which approach to choose, here are a few
191 comparisons:<table>
192 <title>Comparison web service vs. COM/XPCOM</title>
193
194 <tgroup cols="2">
195 <tbody>
196 <row>
197 <entry><emphasis role="bold">Web service</emphasis></entry>
198
199 <entry><emphasis role="bold">COM/XPCOM</emphasis></entry>
200 </row>
201
202 <row>
203 <entry><emphasis role="bold">Pro:</emphasis> Easy to use with
204 Java and Python with the object-oriented web service;
205 extensive support even with other languages (C++, .NET, PHP,
206 Perl and others)</entry>
207
208 <entry><emphasis role="bold">Con:</emphasis> Usable from
209 languages where COM bridge available (most languages on
210 Windows platform, Python and C++ on other hosts)</entry>
211 </row>
212
213 <row>
214 <entry><emphasis role="bold">Pro:</emphasis> Client can be on
215 remote machine</entry>
216
217 <entry><emphasis role="bold">Con: </emphasis>Client must be on
218 the same host where virtual machine is executed</entry>
219 </row>
220
221 <row>
222 <entry><emphasis role="bold">Con: </emphasis>Significant
223 overhead due to XML marshalling over the wire for each method
224 call</entry>
225
226 <entry><emphasis role="bold">Pro: </emphasis>Relatively low
227 invocation overhead</entry>
228 </row>
229 </tbody>
230 </tgroup>
231 </table></para>
232
233 <para>In the following chapters, we will describe the different ways in
234 which to program VirtualBox, starting with the method that is easiest to
235 use and then increasing in complexity as we go along.</para>
236 </sect1>
237
238 <sect1 id="api_soap_intro">
239 <title>About web services in general</title>
240
241 <para>Web services are a particular type of programming interface.
242 Whereas, with "normal" programming, a program calls an application
243 programming interface (API) defined by another program or the operating
244 system and both sides of the interface have to agree on the calling
245 convention and, in most cases, use the same programming language, web
246 services use Internet standards such as HTTP and XML to
247 communicate.<footnote>
248 <para>In some ways, web services promise to deliver the same thing
249 as CORBA and DCOM did years ago. However, while these previous
250 technologies relied on specific binary protocols and thus proved to
251 be difficult to use between diverging platforms, web services
252 circumvent these incompatibilities by using text-only standards like
253 HTTP and XML. On the downside (and, one could say, typical of things
254 related to XML), a lot of standards are involved before a web
255 service can be implemented. Many of the standards invented around
256 XML are used one way or another. As a result, web services are slow
257 and verbose, and the details can be incredibly messy. The relevant
258 standards here are called SOAP and WSDL, where SOAP describes the
259 format of the messages that are exchanged (an XML document wrapped
260 in an HTTP header), and WSDL is an XML format that describes a
261 complete API provided by a web service. WSDL in turn uses XML Schema
262 to describe types, which is not exactly terse either. However, as
263 you will see from the samples provided in this chapter, the
264 VirtualBox web service shields you from these details and is easy to
265 use.</para>
266 </footnote></para>
267
268 <para>In order to successfully use a web service, a number of things are
269 required -- primarily, a web service accepting connections; service
270 descriptions; and a client that connects to that web service. Connections
271 to the VirtualBox web service are governed by the SOAP standard, which
272 describes how messages are to be exchanged between a service and its
273 clients; the service descriptions are governed by WSDL.</para>
274
275 <para>In the case of VirtualBox, this translates into the following
276 three components:<orderedlist>
277 <listitem>
278 <para>The VirtualBox web service (the "server"): this is the
279 <computeroutput>vboxwebsrv</computeroutput> executable shipped
280 with VirtualBox. Once you start this executable (which acts as an
281 HTTP server on a specific TCP/IP port), clients can connect to the
282 web service and thus control a VirtualBox installation.</para>
283 </listitem>
284
285 <listitem>
286 <para>VirtualBox also comes with WSDL files that describe the
287 services provided by the web service. You can find these files in
288 the <computeroutput>sdk/bindings/webservice/</computeroutput>
289 directory. These files are understood by the web service toolkits
290 that are shipped with most programming languages and enable you to
291 easily access a web service even if you don't use our
292 object-oriented client layers. VirtualBox is shipped with
293 pre-generated web service glue code for several languages (Python,
294 Perl, Java).</para>
295 </listitem>
296
297 <listitem>
298 <para>A client that connects to the web service in order to
299 control the VirtualBox installation.</para>
300
301 <para>Unless you use some of the samples shipped with
302 VirtualBox, this needs to be written by you.</para>
303 </listitem>
304 </orderedlist></para>
305 </sect1>
306
307 <sect1 id="runvboxwebsrv">
308 <title>Running the web service</title>
309
310 <para>The web service ships in a stand-alone executable,
311 <computeroutput>vboxwebsrv</computeroutput>, that, when running, acts as
312 an HTTP server, accepts SOAP connections, remotely or from the same machine,
313 and processes them.<note>
314 <para>The web service executable is not delivered with the
315 VirtualBox SDK, but instead ships with the standard VirtualBox
316 binary package for your specific platform. The SDK contains only
317 platform-independent text files and documentation so thus the vboxwebsrv
318 binary is shipped with the platform-specific packages. Therefore the
319 information on how to run vboxwebsrv as a service is included in the
320 VirtualBox documentation and not the SDK.</para>
321 </note></para>
322
323 <para>The <computeroutput>vboxwebsrv</computeroutput> program, which
324 implements the web service, is a text-mode (console) program which,
325 after being started, simply runs until it is interrupted with Ctrl-C or
326 a kill command.</para>
327
328 <para>Once the web service is started, it acts as a front-end to the
329 VirtualBox installation of the user account that it is running under. In
330 other words, if the web service is run under the user account of
331 <computeroutput>user1</computeroutput>, it will see and manipulate the
332 virtual machines and other data represented by the VirtualBox data of
333 that user (for example, on a Linux machine, under
334 <computeroutput>/home/user1/.config/VirtualBox</computeroutput>; see the
335 VirtualBox User Manual for details on where this data is stored).</para>
336
337 <sect2 id="vboxwebsrv-ref">
338 <title>Command line options of vboxwebsrv</title>
339
340 <para>The web service supports the following command line
341 options:</para>
342
343 <itemizedlist>
344 <listitem>
345 <para><computeroutput>--help</computeroutput> (or
346 <computeroutput>-h</computeroutput>): print a brief summary of
347 command line options.</para>
348 </listitem>
349
350 <listitem>
351 <para><computeroutput>--background</computeroutput> (or
352 <computeroutput>-b</computeroutput>): run the web service as a
353 background daemon. This option is not supported on Windows
354 hosts.</para>
355 </listitem>
356
357 <listitem>
358 <para><computeroutput>--host</computeroutput> (or
359 <computeroutput>-H</computeroutput>): This specifies the host to
360 bind to and defaults to "localhost".</para>
361 </listitem>
362
363 <listitem>
364 <para><computeroutput>--port</computeroutput> (or
365 <computeroutput>-p</computeroutput>): This specifies which port to
366 bind to on the host and defaults to 18083.</para>
367 </listitem>
368
369 <listitem>
370 <para><computeroutput>--ssl</computeroutput> (or
371 <computeroutput>-s</computeroutput>): This enables SSL
372 support.</para>
373 </listitem>
374
375 <listitem>
376 <para><computeroutput>--keyfile</computeroutput> (or
377 <computeroutput>-K</computeroutput>): This specifies the file name
378 containing the server private key and the certificate. This is a
379 mandatory parameter if SSL is enabled.</para>
380 </listitem>
381
382 <listitem>
383 <para><computeroutput>--passwordfile</computeroutput> (or
384 <computeroutput>-a</computeroutput>): This specifies the file name
385 containing the password for the server private key. If unspecified
386 or an empty string is specified this is interpreted as an empty
387 password (i.e. the private key is not protected by a password). If
388 the file name <computeroutput>-</computeroutput> is specified then
389 then the password is read from the standard input stream, otherwise
390 from the specified file. The user is responsible for appropriate
391 access rights to protect the confidential password.</para>
392 </listitem>
393
394 <listitem>
395 <para><computeroutput>--cacert</computeroutput> (or
396 <computeroutput>-c</computeroutput>): This specifies the file name
397 containing the CA certificate appropriate for the server
398 certificate.</para>
399 </listitem>
400
401 <listitem>
402 <para><computeroutput>--capath</computeroutput> (or
403 <computeroutput>-C</computeroutput>): This specifies the directory
404 containing several CA certificates appropriate for the server
405 certificate.</para>
406 </listitem>
407
408 <listitem>
409 <para><computeroutput>--dhfile</computeroutput> (or
410 <computeroutput>-D</computeroutput>): This specifies the file name
411 containing the DH key. Alternatively it can contain the number of
412 bits of the DH key to generate. If left empty, RSA is used.</para>
413 </listitem>
414
415 <listitem>
416 <para><computeroutput>--randfile</computeroutput> (or
417 <computeroutput>-r</computeroutput>): This specifies the file name
418 containing the seed for the random number generator. If left empty,
419 an operating system specific source of the seed.</para>
420 </listitem>
421
422 <listitem>
423 <para><computeroutput>--timeout</computeroutput> (or
424 <computeroutput>-t</computeroutput>): This specifies the session
425 timeout, in seconds, and defaults to 300 (five minutes). A web
426 service client that has logged on but makes no calls to the web
427 service will automatically be disconnected after the number of
428 seconds specified here, as if it had called the
429 <computeroutput>IWebSessionManager::logoff()</computeroutput>
430 method provided by the web service itself.</para>
431
432 <para>It is normally vital that each web service client call this
433 method, as the web service can accumulate large amounts of memory
434 when running, especially if a web service client does not properly
435 release managed object references. As a result, this timeout value
436 should not be set too high, especially on machines with a high
437 load on the web service, or the web service may eventually deny
438 service.</para>
439 </listitem>
440
441 <listitem>
442 <para><computeroutput>--check-interval</computeroutput> (or
443 <computeroutput>-i</computeroutput>): This specifies the interval
444 in which the web service checks for timed-out clients, in seconds,
445 and defaults to 5. This normally does not need to be
446 changed.</para>
447 </listitem>
448
449 <listitem>
450 <para><computeroutput>--threads</computeroutput> (or
451 <computeroutput>-T</computeroutput>): This specifies the maximum
452 number or worker threads, and defaults to 100. This normally does
453 not need to be changed.</para>
454 </listitem>
455
456 <listitem>
457 <para><computeroutput>--keepalive</computeroutput> (or
458 <computeroutput>-k</computeroutput>): This specifies the maximum
459 number of requests which can be sent in one web service connection,
460 and defaults to 100. This normally does not need to be
461 changed.</para>
462 </listitem>
463
464 <listitem>
465 <para><computeroutput>--authentication</computeroutput> (or
466 <computeroutput>-A</computeroutput>): This specifies the desired
467 web service authentication method. If the parameter is not
468 specified or the empty string is specified it does not change the
469 authentication method, otherwise it is set to the specified value.
470 Using this parameter is a good measure against accidental
471 misconfiguration, as the web service ensures periodically that it
472 isn't changed.</para>
473 </listitem>
474
475 <listitem>
476 <para><computeroutput>--verbose</computeroutput> (or
477 <computeroutput>-v</computeroutput>): Normally, the web service
478 outputs only brief messages to the console each time a request is
479 served. With this option, the web service prints much more detailed
480 data about every request and the COM methods that those requests
481 are mapped to internally, which can be useful for debugging client
482 programs.</para>
483 </listitem>
484
485 <listitem>
486 <para><computeroutput>--pidfile</computeroutput> (or
487 <computeroutput>-P</computeroutput>): Name of the PID file which is
488 created when the daemon was started.</para>
489 </listitem>
490
491 <listitem>
492 <para><computeroutput>--logfile</computeroutput> (or
493 <computeroutput>-F</computeroutput>)
494 <computeroutput>&lt;file&gt;</computeroutput>: If this is
495 specified, the web service not only prints its output to the
496 console, but also writes it to the specified file. The file is
497 created if it does not exist; if it does exist, new output is
498 appended to it. This is useful if you run the web service
499 unattended and need to debug problems after they have
500 occurred.</para>
501 </listitem>
502
503 <listitem>
504 <para><computeroutput>--logrotate</computeroutput> (or
505 <computeroutput>-R</computeroutput>): Number of old log files to
506 keep, defaults to 10. Log rotation is disabled if set to 0.</para>
507 </listitem>
508
509 <listitem>
510 <para><computeroutput>--logsize</computeroutput> (or
511 <computeroutput>-S</computeroutput>): Maximum size of log file in
512 bytes, defaults to 100MB. Log rotation is triggered if the file
513 grows beyond this limit.</para>
514 </listitem>
515
516 <listitem>
517 <para><computeroutput>--loginterval</computeroutput> (or
518 <computeroutput>-I</computeroutput>): Maximum time interval to be
519 put in a log file before rotation is triggered, in seconds, and
520 defaults to one day.</para>
521 </listitem>
522 </itemizedlist>
523 </sect2>
524
525 <sect2 id="websrv_authenticate">
526 <title>Authenticating at web service logon</title>
527
528 <para>As opposed to the COM/XPCOM variant of the Main API, a client
529 that wants to use the web service must first log on by calling the
530 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
531 API that is specific to the
532 web service. Logon is necessary for the web service to be stateful;
533 internally, it maintains a session for each client that connects to
534 it.</para>
535
536 <para>The <computeroutput>IWebsessionManager::logon()</computeroutput>
537 API takes a user name and a password as arguments, which the web
538 service then passes to a customizable authentication plugin that
539 performs the actual authentication.</para>
540
541 <para>For testing purposes, it is recommended that you first disable
542 authentication with the command:
543 <screen>VBoxManage setproperty websrvauthlibrary null</screen></para>
544
545 <para><warning>
546 <para>This will cause all logons to succeed, regardless of user
547 name or password. This should of course not be used in a
548 production environment.</para>
549 </warning>Generally, the mechanism by which clients are
550 authenticated is configurable by way of the
551 <computeroutput>VBoxManage</computeroutput> command:</para>
552
553 <para><screen>VBoxManage setproperty websrvauthlibrary default|null|&lt;library&gt;</screen></para>
554
555 <para>This way you can specify any shared object/dynamic link module
556 that conforms with the specifications for VirtualBox external
557 authentication modules as laid out in section <emphasis
558 role="bold">VRDE authentication</emphasis> of the VirtualBox User
559 Manual; the web service uses the same kind of modules as the
560 VirtualBox VRDE server. For technical details on VirtualBox external
561 authentication modules see <xref linkend="vbox-auth"/></para>
562
563 <para>By default, after installation, the web service uses the
564 VBoxAuth module that ships with VirtualBox. This module uses PAM on
565 FreeBSD, Linux, and Solaris hosts to authenticate users. Any valid
566 username/password combination is accepted, it does not have to be the
567 username and password of the user running the web service daemon. If
568 <computeroutput>vboxwebsrv</computeroutput> doesn't run as root PAM
569 authentication can fail, because the
570 <computeroutput>/etc/shadow</computeroutput> file, which is used by PAM,
571 is only readable by root. On most Linux distributions PAM uses a suid
572 root helper internally, so make sure you test this before deploying it.
573 One can override authentication failures due to lack of read privileges
574 of the shadow password file by setting the environment variable
575 <computeroutput>VBOX_PAM_ALLOW_INACTIVE</computeroutput>.
576 Please use this variable carefully and only if you fully understand what
577 you're doing.</para>
578 </sect2>
579 </sect1>
580 </chapter>
581
582 <chapter>
583 <title>Environment-specific notes</title>
584
585 <para>The Main API described in <xref linkend="sdkref_classes"/> and
586 <xref linkend="sdkref_enums"/> is mostly identical in all the supported
587 programming environments which have been briefly mentioned in the
588 introduction of this book. As a result, the Main API's general concepts
589 described in <xref linkend="concepts"/> are the same whether you use the
590 object-oriented web service (OOWS) for JAX-WS or a raw web service
591 connection via, say, Perl, or whether you use C++ COM bindings.</para>
592
593 <para>Some things are different depending on your environment, however.
594 These differences are explained in this chapter.</para>
595
596 <sect1 id="glue">
597 <title>Using the object-oriented web service (OOWS)</title>
598
599 <para>As explained in <xref linkend="webservice-or-com"/>, VirtualBox
600 ships with client-side libraries for Java, Python and PHP that allow you
601 to use the VirtualBox web service in an intuitive, object-oriented way.
602 These libraries shield you from the client-side complications of managed
603 object references and other implementation details that come with the
604 VirtualBox web service. (If you are interested in these complications,
605 have a look at <xref linkend="raw-webservice"/>).</para>
606
607 <para>We recommend that you start your experiments with the VirtualBox
608 web service by using our object-oriented client libraries for JAX-WS, a
609 web service toolkit for Java, which enables you to write code to
610 interact with VirtualBox in the simplest manner possible.</para>
611
612 <para>As "interfaces", "attributes" and "methods" are COM concepts,
613 please read the documentation in <xref linkend="sdkref_classes"/> and
614 <xref linkend="sdkref_enums"/> with the following notes in mind.</para>
615
616 <para>The OOWS bindings attempt to map the Main API as closely as
617 possible to the Java, Python and PHP languages. In other words, objects
618 are objects, interfaces become classes, and you can call methods on
619 objects as you would on local objects.</para>
620
621 <para>The main difference remains with attributes: to read an attribute,
622 call a "getXXX" method, with "XXX" being the attribute name with a
623 capitalized first letter. So when the Main API Reference says that
624 <computeroutput>IMachine</computeroutput> has a "name" attribute (see
625 <link linkend="IMachine__name">IMachine::name</link>), call
626 <computeroutput>getName()</computeroutput> on an IMachine object to
627 obtain a machine's name. Unless the attribute is marked as read-only in
628 the documentation, there will also be a corresponding "set"
629 method.</para>
630
631 <sect2 id="glue-jax-ws">
632 <title>The object-oriented web service for JAX-WS</title>
633
634 <para>JAX-WS is a powerful toolkit by Sun Microsystems to build both
635 server and client code with Java. It is part of Java 6 (JDK 1.6), but
636 can also be obtained separately for Java 5 (JDK 1.5). The VirtualBox
637 SDK comes with precompiled OOWS bindings working with both Java 5 and
638 6.</para>
639
640 <para>The following sections explain how to get the JAX-WS sample code
641 running and explain a few common practices when using the JAX-WS
642 object-oriented web service.</para>
643
644 <sect3>
645 <title>Preparations</title>
646
647 <para>Since JAX-WS is already integrated into Java 6, no additional
648 preparations are needed for Java 6.</para>
649
650 <para>If you are using Java 5 (JDK 1.5.x), you will first need to
651 download and install an external JAX-WS implementation, as Java 5
652 does not support JAX-WS out of the box; for example, you can
653 download one from here: <ulink
654 url="https://jax-ws.dev.java.net/2.1.4/JAXWS2.1.4-20080502.jar">https://jax-ws.dev.java.net/2.1.4/JAXWS2.1.4-20080502.jar</ulink>.
655 Then perform the installation (<computeroutput>java -jar
656 JAXWS2.1.4-20080502.jar</computeroutput>).</para>
657 </sect3>
658
659 <sect3>
660 <title>Getting started: running the sample code</title>
661
662 <para>To run the OOWS for JAX-WS samples that we ship with the SDK,
663 perform the following steps: <orderedlist>
664 <listitem>
665 <para>Open a terminal and change to the directory where the
666 JAX-WS samples reside.<footnote>
667 <para>In
668 <computeroutput>sdk/bindings/glue/java/</computeroutput>.</para>
669 </footnote> Examine the header of
670 <computeroutput>Makefile</computeroutput> to see if the
671 supplied variables (Java compiler, Java executable) and a few
672 other details match your system settings.</para>
673 </listitem>
674
675 <listitem>
676 <para>To start the VirtualBox web service, open a second
677 terminal and change to the directory where the VirtualBox
678 executables are located. Then type:
679 <screen>./vboxwebsrv -v</screen></para>
680
681 <para>The web service now waits for connections and will run
682 until you press Ctrl+C in this second terminal. The -v
683 argument causes it to log all connections to the terminal.
684 (See <xref linkend="runvboxwebsrv"/> for details on how
685 to run the web service.)</para>
686 </listitem>
687
688 <listitem>
689 <para>Back in the first terminal and still in the samples
690 directory, to start a simple client example just type:
691 <screen>make run16</screen></para>
692
693 <para>if you're on a Java 6 system; on a Java 5 system, run
694 <computeroutput>make run15</computeroutput> instead.</para>
695
696 <para>This should work on all Unix-like systems such as Linux
697 and Solaris. For Windows systems, use commands similar to what
698 is used in the Makefile.</para>
699
700 <para>This will compile the
701 <computeroutput>clienttest.java</computeroutput> code on the
702 first call and then execute the resulting
703 <computeroutput>clienttest</computeroutput> class to show the
704 locally installed VMs (see below).</para>
705 </listitem>
706 </orderedlist></para>
707
708 <para>The <computeroutput>clienttest</computeroutput> sample
709 imitates a few typical command line tasks that
710 <computeroutput>VBoxManage</computeroutput>, VirtualBox's regular
711 command-line front-end, would provide (see the VirtualBox User
712 Manual for details). In particular, you can run:<itemizedlist>
713 <listitem>
714 <para><computeroutput>java clienttest show
715 vms</computeroutput>: show the virtual machines that are
716 registered locally.</para>
717 </listitem>
718
719 <listitem>
720 <para><computeroutput>java clienttest list
721 hostinfo</computeroutput>: show various information about the
722 host this VirtualBox installation runs on.</para>
723 </listitem>
724
725 <listitem>
726 <para><computeroutput>java clienttest startvm
727 &lt;vmname|uuid&gt;</computeroutput>: start the given virtual
728 machine.</para>
729 </listitem>
730 </itemizedlist></para>
731
732 <para>The <computeroutput>clienttest.java</computeroutput> sample
733 code illustrates common basic practices how to use the VirtualBox
734 OOWS for JAX-WS, which we will explain in more detail in the
735 following chapters.</para>
736 </sect3>
737
738 <sect3>
739 <title>Logging on to the web service</title>
740
741 <para>Before a web service client can do anything useful, two
742 objects need to be created, as can be seen in the
743 <computeroutput>clienttest</computeroutput> constructor:<orderedlist>
744 <listitem>
745 <para>An instance of
746 <link linkend="IWebsessionManager">IWebsessionManager</link>,
747 which is an interface provided by the web service to manage
748 "web sessions" -- that is, stateful connections to the web
749 service with persistent objects upon which methods can be
750 invoked.</para>
751
752 <para>In the OOWS for JAX-WS, the IWebsessionManager class
753 must be constructed explicitly, and a URL must be provided in
754 the constructor that specifies where the web service (the
755 server) awaits connections. The code in
756 <computeroutput>clienttest.java</computeroutput> connects to
757 "http://localhost:18083/", which is the default.</para>
758
759 <para>The port number, by default 18083, must match the port
760 number given to the
761 <computeroutput>vboxwebsrv</computeroutput> command line; see
762 <xref linkend="vboxwebsrv-ref"/>.</para>
763 </listitem>
764
765 <listitem>
766 <para>After that, the code calls
767 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>,
768 which is the first call that actually communicates with the
769 server. This authenticates the client with the web service and
770 returns an instance of
771 <link linkend="IVirtualBox">IVirtualBox</link>,
772 the most fundamental interface of the VirtualBox web service,
773 from which all other functionality can be derived.</para>
774
775 <para>If logon doesn't work, please take another look at <xref
776 linkend="websrv_authenticate"/>.</para>
777 </listitem>
778 </orderedlist></para>
779 </sect3>
780
781 <sect3>
782 <title>Object management</title>
783
784 <para>The current OOWS for JAX-WS has certain memory management
785 related limitations. When you no longer need an object, call its
786 <link linkend="IManagedObjectRef__release">IManagedObjectRef::release()</link>
787 method explicitly, which
788 frees appropriate managed reference, as is required by the raw
789 web service; see <xref linkend="managed-object-references"/> for
790 details. This limitation may be reconsidered in a future version of
791 the VirtualBox SDK.</para>
792 </sect3>
793 </sect2>
794
795 <sect2 id="glue-python-ws">
796 <title>The object-oriented web service for Python</title>
797
798 <para>VirtualBox comes with two flavors of a Python API: one for web
799 service, discussed here, and one for the COM/XPCOM API discussed in
800 <xref linkend="pycom"/>. The client code is mostly similar, except
801 for the initialization part, so it is up to the application developer
802 to choose the appropriate technology. Moreover, a common Python glue
803 layer exists, abstracting out concrete platform access details, see
804 <xref linkend="glue-python"/>.</para>
805
806 <para>The minimum supported Python version is 2.6.</para>
807
808 <para>As indicated in <xref linkend="webservice-or-com"/>, the
809 COM/XPCOM API gives better performance without the SOAP overhead, and
810 does not require a web server to be running. On the other hand, the
811 COM/XPCOM Python API requires a suitable Python bridge for your Python
812 installation (VirtualBox ships the most important ones for each
813 platform<footnote>
814 <para>On Mac OS X only the Python versions bundled with the OS
815 are officially supported.</para>
816 </footnote>). On Windows, you can use the Main API from Python if the
817 Win32 extensions package for Python<footnote>
818 <para>See <ulink
819 url="http://sourceforge.net/project/showfiles.php?group_id=78018">http://sourceforge.net/project/showfiles.php?group_id=78018</ulink>.</para>
820 </footnote> is installed. Versions of Python Win32 extensions earlier
821 than 2.16 are known to have bugs, leading to issues with VirtualBox
822 Python bindings, so please make sure to use latest available Python
823 and Win32 extensions.</para>
824
825 <para>The VirtualBox OOWS for Python relies on the Python ZSI SOAP
826 implementation (see <ulink
827 url="http://pywebsvcs.sourceforge.net/zsi.html">http://pywebsvcs.sourceforge.net/zsi.html</ulink>),
828 which you will need to install locally before trying the examples.
829 Most Linux distributions come with a package for ZSI, such as
830 <computeroutput>python-zsi</computeroutput> in Ubuntu.</para>
831
832 <para>To get started, open a terminal and change to the
833 <computeroutput>sdk/bindings/glue/python/sample</computeroutput>
834 directory, which contains an example of a simple interactive shell
835 able to control a VirtualBox instance. The shell is written using the
836 API layer, thereby hiding different implementation details, so it is
837 actually an example of code shared among XPCOM, MSCOM and web services.
838 If you are interested in how to interact with the web services layer
839 directly, have a look at
840 <computeroutput>install/vboxapi/__init__.py</computeroutput> which
841 contains the glue layer for all target platforms (i.e. XPCOM, MSCOM
842 and web services).</para>
843
844 <para>To start the shell, run the following commands:
845 <screen>/opt/VirtualBox/vboxwebsrv -t 0 # start web service with object autocollection disabled
846export VBOX_PROGRAM_PATH=/opt/VirtualBox # your VirtualBox installation directory
847export VBOX_SDK_PATH=/home/youruser/vbox-sdk # where you've extracted the SDK
848./vboxshell.py -w </screen>
849 See <xref linkend="vboxshell"/> for more
850 details on the shell's functionality. For you, as a VirtualBox
851 application developer, the vboxshell sample could be interesting as an
852 example of how to write code targeting both local and remote cases
853 (COM/XPCOM and SOAP). The common part of the shell is the same -- the
854 only difference is how it interacts with the invocation layer. You can
855 use the <computeroutput>connect</computeroutput> shell command to
856 connect to remote VirtualBox servers; in this case you can skip
857 starting the local web server.</para>
858 </sect2>
859
860 <sect2>
861 <title>The object-oriented web service for PHP</title>
862
863 <para>VirtualBox also comes with object-oriented web service (OOWS)
864 wrappers for PHP5. These wrappers rely on the PHP SOAP
865 Extension<footnote>
866 <para>See
867 <ulink url="https://www.php.net/soap">https://www.php.net/soap</ulink>.</para>
868 </footnote>, which can be installed by configuring PHP with
869 <computeroutput>--enable-soap</computeroutput>.</para>
870 </sect2>
871 </sect1>
872
873 <sect1 id="raw-webservice">
874 <title>Using the raw web service with any language</title>
875
876 <para>The following examples show you how to use the raw web service,
877 without the object-oriented client-side code that was described in the
878 previous chapter.</para>
879
880 <para>Due to the limitations of SOAP and WSDL outlined in
881 <xref linkend="rawws-conventions"/>, keep the following notes in
882 mind when reading the documentation in <xref linkend="sdkref_classes"/>
883 and <xref linkend="sdkref_enums"/>:</para>
884
885 <para><orderedlist>
886 <listitem>
887 <para>Any COM method call becomes a <emphasis role="bold">plain
888 function call</emphasis> in the raw web service, with the object
889 as an additional first parameter (before the "real" parameters
890 listed in the documentation). So when the documentation says that
891 the <computeroutput>IVirtualBox</computeroutput> interface
892 supports the <computeroutput>createMachine()</computeroutput>
893 method (see
894 <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>),
895 the web service operation is
896 <computeroutput>IVirtualBox_createMachine(...)</computeroutput>,
897 and a managed object reference to an
898 <computeroutput>IVirtualBox</computeroutput> object must be passed
899 as the first argument.</para>
900 </listitem>
901
902 <listitem>
903 <para>For <emphasis role="bold">attributes</emphasis> in
904 interfaces, there will be at least one "get" function; there will
905 also be a "set" function, unless the attribute is "readonly". The
906 attribute name will be appended to the "get" or "set" prefix, with
907 a capitalized first letter. So, the "version" readonly attribute
908 of the <computeroutput>IVirtualBox</computeroutput> interface can
909 be retrieved by calling
910 <computeroutput>IVirtualBox_getVersion(vbox)</computeroutput>,
911 with <computeroutput>vbox</computeroutput> being the VirtualBox
912 object.</para>
913 </listitem>
914
915 <listitem>
916 <para>Whenever the API documentation says that a method (or an
917 attribute getter) returns an <emphasis
918 role="bold">object</emphasis>, it will returned a managed object
919 reference in the web service instead. As said above, managed
920 object references should be released if the web service client
921 does not log off again immediately!</para>
922 </listitem>
923 </orderedlist></para>
924
925 <para></para>
926
927 <sect2 id="webservice-java-sample">
928 <title>Raw web service example for Java with Axis</title>
929
930 <para>Axis is an older web service toolkit created by the Apache
931 foundation. If your distribution does not have it installed, you can
932 get a binary from <ulink
933 url="http://axis.apache.org">http://axis.apache.org</ulink>. The
934 following examples assume that you have Axis 1.4 installed.</para>
935
936 <para>The VirtualBox SDK ships with an example for Axis that, again,
937 is called <computeroutput>clienttest.java</computeroutput> and that
938 imitates a few <computeroutput>VBoxManage</computeroutput> commands
939 and sends them to the VirtualBox web service.</para>
940
941 <para>To try out the raw web service with Axis complete the following
942 steps:<orderedlist>
943 <listitem>
944 <para>Create a working directory somewhere. Under your
945 VirtualBox installation directory, find the
946 <computeroutput>sdk/webservice/samples/java/axis/</computeroutput>
947 directory and copy the file
948 <computeroutput>clienttest.java</computeroutput> to your working
949 directory.</para>
950 </listitem>
951
952 <listitem>
953 <para>Open a terminal in your working directory. Execute the
954 following command:
955 <screen>java org.apache.axis.wsdl.WSDL2Java /path/to/vboxwebService.wsdl</screen></para>
956
957 <para>The <computeroutput>vboxwebService.wsdl</computeroutput>
958 file should be located in the
959 <computeroutput>sdk/webservice/</computeroutput>
960 directory.</para>
961
962 <para>If this fails, your Apache Axis may not be located on your
963 system classpath, and you may have to adjust the CLASSPATH
964 environment variable. Something like this:
965 <screen>export CLASSPATH="/path-to-axis-1_4/lib/*":$CLASSPATH</screen></para>
966
967 <para>Use the directory where the Axis JAR files are located.
968 Mind the quotes so that your shell passes the "*" character to
969 the java executable without expanding. Alternatively, add a
970 corresponding <computeroutput>-classpath</computeroutput>
971 argument to the "java" call above.</para>
972
973 <para>If the command executes successfully, you should see an
974 "org" directory with subdirectories containing Java source files
975 in your working directory. These classes represent the
976 interfaces that the VirtualBox web service offers, as described
977 by the WSDL file.</para>
978
979 <para>This is the bit that makes using web services so
980 attractive to client developers: if a language's toolkit
981 understands WSDL, it can generate large amounts of support code
982 automatically. Clients can then easily use this support code and
983 can be done with just a few lines of code.</para>
984 </listitem>
985
986 <listitem>
987 <para>Next, compile the
988 <computeroutput>clienttest.java</computeroutput>
989 source:<screen>javac clienttest.java </screen></para>
990
991 <para>This should yield a "clienttest.class" file.</para>
992 </listitem>
993
994 <listitem>
995 <para>To start the VirtualBox web service, open a second
996 terminal and change to the directory where the VirtualBox
997 executables are located. Then type:
998 <screen>./vboxwebsrv -v</screen></para>
999
1000 <para>The web service now waits for connections and will run
1001 until you press Ctrl+C in this second terminal. The -v argument
1002 causes it to log all connections to the terminal. (See <xref
1003 linkend="runvboxwebsrv"/> for details on how to run the
1004 web service.)</para>
1005 </listitem>
1006
1007 <listitem>
1008 <para>Back in the original terminal where you compiled the Java
1009 source, run the resulting binary, which will then connect to the
1010 web service:<screen>java clienttest</screen></para>
1011
1012 <para>The client sample will connect to the web service (on
1013 localhost, but the code could be changed to connect remotely if
1014 the web service was running on a different machine) and make a
1015 number of method calls. It will output the version number of
1016 your VirtualBox installation and a list of all virtual machines
1017 that are currently registered (with a bit of seemingly random
1018 data, which will be explained later).</para>
1019 </listitem>
1020 </orderedlist></para>
1021 </sect2>
1022
1023 <sect2 id="raw-webservice-perl">
1024 <title>Raw web service example for Perl</title>
1025
1026 <para>We also ship a small sample for Perl. It uses the SOAP::Lite
1027 perl module to communicate with the VirtualBox web service.</para>
1028
1029 <para>The
1030 <computeroutput>sdk/bindings/webservice/perl/lib/</computeroutput>
1031 directory contains a pre-generated Perl module that allows for
1032 communicating with the web service from Perl. You can generate such a
1033 module yourself using the "stubmaker" tool that comes with SOAP::Lite,
1034 but since that tool is slow as well as sometimes unreliable, we ship a
1035 working module with the SDK for your convenience.</para>
1036
1037 <para>Perform the following steps:<orderedlist>
1038 <listitem>
1039 <para>If SOAP::Lite is not yet installed on your system, you
1040 will need to install the package first. On Debian-based systems,
1041 the package is called
1042 <computeroutput>libsoap-lite-perl</computeroutput>; on Gentoo,
1043 it's <computeroutput>dev-perl/SOAP-Lite</computeroutput>.</para>
1044 </listitem>
1045
1046 <listitem>
1047 <para>Open a terminal in the
1048 <computeroutput>sdk/bindings/webservice/perl/samples/</computeroutput>
1049 directory.</para>
1050 </listitem>
1051
1052 <listitem>
1053 <para>To start the VirtualBox web service, open a second
1054 terminal and change to the directory where the VirtualBox
1055 executables are located. Then type:
1056 <screen>./vboxwebsrv -v</screen></para>
1057
1058 <para>The web service now waits for connections and will run
1059 until you press Ctrl+C in this second terminal. The -v argument
1060 causes it to log all connections to the terminal. (See <xref
1061 linkend="runvboxwebsrv"/> for details on how to run the
1062 web service.)</para>
1063 </listitem>
1064
1065 <listitem>
1066 <para>In the first terminal with the Perl sample, run the
1067 clienttest.pl script:
1068 <screen>perl -I ../lib clienttest.pl</screen></para>
1069 </listitem>
1070 </orderedlist></para>
1071 </sect2>
1072
1073 <sect2>
1074 <title>Programming considerations for the raw web service</title>
1075
1076 <para>If you use the raw web service, you need to keep a number of
1077 things in mind, or you will sooner or later run into issues that are
1078 not immediately obvious. By contrast, the object-oriented client-side
1079 libraries described in <xref linkend="glue"/> take care of these
1080 things automatically and thus greatly simplify using the web
1081 service.</para>
1082
1083 <sect3 id="rawws-conventions">
1084 <title>Fundamental conventions</title>
1085
1086 <para>If you are familiar with other web services, you may find that the
1087 VirtualBox web service behaves a bit differently to accommodate
1088 for the fact that the VirtualBox web service more or less maps the
1089 VirtualBox Main COM API. The primary challenges in mapping the VirtualBox
1090 Main COM API to the web service are as follows:<itemizedlist>
1091 <listitem>
1092 <para>Web services, as expressed by WSDL, are not
1093 object-oriented. Even worse, they are normally stateless (or,
1094 in web services terminology, "loosely coupled"). Web service
1095 operations are entirely procedural, and one cannot normally
1096 make assumptions about the state of a web service between
1097 function calls.</para>
1098
1099 <para>In particular, this normally means that you cannot work
1100 on objects in one method call that were created by another
1101 call.</para>
1102 </listitem>
1103
1104 <listitem>
1105 <para>By contrast, the VirtualBox Main API, being expressed in
1106 COM, is object-oriented and works entirely on objects, which
1107 are grouped into public interfaces, which in turn have
1108 attributes and methods associated with them.</para>
1109 </listitem>
1110 </itemizedlist> For the VirtualBox web service, this results in
1111 three fundamental conventions:<orderedlist>
1112 <listitem>
1113 <para>All <emphasis role="bold">function names</emphasis> in
1114 the VirtualBox web service consist of an interface name and a
1115 method name, joined together by an underscore. This is because
1116 there are only functions ("operations") in WSDL, but no
1117 classes, interfaces, or methods.</para>
1118 </listitem>
1119
1120 <listitem>
1121 <para>All calls to the VirtualBox web service (except for logon, see
1122 below) take a <emphasis role="bold">managed object reference</emphasis>
1123 as the first argument, representing the object upon which the underlying
1124 method is invoked. (Managed object references are explained in detail
1125 below; see <xref linkend="managed-object-references"/>.)</para>
1126
1127 <para>So, when one would normally code, in the pseudo-code of
1128 an object-oriented language, to invoke a method upon an
1129 object:<screen>IMachine machine;
1130result = machine.getName();</screen></para>
1131
1132 <para>In the VirtualBox web service, this looks something like
1133 this (again, pseudo-code):<screen>IMachineRef machine;
1134result = IMachine_getName(machine);</screen></para>
1135 </listitem>
1136
1137 <listitem>
1138 <para>To make the web service stateful, and objects persistent
1139 between method calls, the VirtualBox web service introduces a
1140 <emphasis role="bold">session manager</emphasis> (by way of the
1141 <link linkend="IWebsessionManager">IWebsessionManager</link>
1142 interface), which manages object references. Any client wishing
1143 to interact with the web service must first log on to the
1144 session manager and in turn receives a managed object reference
1145 to an object that supports the
1146 <link linkend="IVirtualBox">IVirtualBox</link>
1147 interface (the basic interface in the Main API).</para>
1148 </listitem>
1149 </orderedlist></para>
1150
1151 <para>In other words, as opposed to other web services, <emphasis
1152 role="bold">the VirtualBox web service is both object-oriented and
1153 stateful.</emphasis></para>
1154 </sect3>
1155
1156 <sect3>
1157 <title>Example: A typical web service client session</title>
1158
1159 <para>A typical short web service session to retrieve the version
1160 number of the VirtualBox web service (to be precise, the underlying
1161 Main API version number) looks like this:<orderedlist>
1162 <listitem>
1163 <para>A client logs on to the web service by calling
1164 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
1165 with a valid user name and password. See
1166 <xref linkend="websrv_authenticate"/>
1167 for details about how authentication works.</para>
1168 </listitem>
1169
1170 <listitem>
1171 <para>On the server side,
1172 <computeroutput>vboxwebsrv</computeroutput> creates a session,
1173 which persists until the client calls
1174 <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>
1175 or the session times out after a configurable period of
1176 inactivity (see <xref linkend="vboxwebsrv-ref"/>).</para>
1177
1178 <para>For the new session, the web service creates an instance
1179 of <link linkend="IVirtualBox">IVirtualBox</link>.
1180 This interface is the most central one in the Main API and
1181 allows access to all other interfaces, either through
1182 attributes or method calls. For example, IVirtualBox contains
1183 a list of all virtual machines that are currently registered
1184 (as they would be listed on the left side of the VirtualBox
1185 main program).</para>
1186
1187 <para>The web service then creates a managed object reference
1188 for this instance of IVirtualBox and returns it to the calling
1189 client, which receives it as the return value of the logon
1190 call. Something like this:</para>
1191
1192 <screen>string oVirtualBox;
1193oVirtualBox = webservice.IWebsessionManager_logon("user", "pass");</screen>
1194
1195 <para>(The managed object reference "oVirtualBox" is just a
1196 string consisting of digits and dashes. However, it is a
1197 string with a meaning and will be checked by the web service.
1198 For details, see below. As hinted above,
1199 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
1200 is the <emphasis>only</emphasis> operation provided by the web
1201 service which does not take a managed object reference as the
1202 first argument!)</para>
1203 </listitem>
1204
1205 <listitem>
1206 <para>The VirtualBox Main API documentation explains that the
1207 <computeroutput>IVirtualBox</computeroutput> interface has a
1208 <link linkend="IVirtualBox__version">version</link>
1209 attribute, which is a string. For each attribute, there is a
1210 "get" and a "set" method in COM, which maps to the corresponding
1211 operations in the web service. So, to retrieve the "version"
1212 attribute of this <computeroutput>IVirtualBox</computeroutput>
1213 object, the web service client does this:
1214 <screen>string version;
1215version = webservice.IVirtualBox_getVersion(oVirtualBox);
1216
1217print version;</screen></para>
1218
1219 <para>And it will print
1220 "&VBOX_VERSION_MAJOR;.&VBOX_VERSION_MINOR;.&VBOX_VERSION_BUILD;".</para>
1221 </listitem>
1222
1223 <listitem>
1224 <para>The web service client calls
1225 <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>
1226 with the VirtualBox managed object reference. This will clean
1227 up all allocated resources.</para>
1228 </listitem>
1229 </orderedlist></para>
1230 </sect3>
1231
1232 <sect3 id="managed-object-references">
1233 <title>Managed object references</title>
1234
1235 <para>To a web service client, a managed object reference looks like
1236 a string: two 64-bit hex numbers separated by a dash. This string,
1237 however, represents a COM object that "lives" in the web service
1238 process. The two 64-bit numbers encoded in the managed object
1239 reference represent a session ID (which is the same for all objects
1240 in the same web service session, i.e. for all objects after one
1241 logon) and a unique object ID within that session.</para>
1242
1243 <para>Managed object references are created in two
1244 situations:<orderedlist>
1245 <listitem>
1246 <para>When a client logs on, by calling
1247 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>.</para>
1248
1249 <para>Upon logon, the websession manager creates one instance
1250 of <link linkend="IVirtualBox">IVirtualBox</link>,
1251 which can be used for directly performing calls to its
1252 methods, or used as a parameter for calling some methods of
1253 <link linkend="IWebsessionManager">IWebsessionManager</link>.
1254 Creating Main API session objects is performed using
1255 <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>.</para>
1256
1257 <para>(Technically, there is always only one
1258 <link linkend="IVirtualBox">IVirtualBox</link> object, which
1259 is shared between all websessions and clients, as it is a COM
1260 singleton. However, each session receives its own managed
1261 object reference to it.)</para>
1262 </listitem>
1263
1264 <listitem>
1265 <para>Whenever a web service clients invokes an operation
1266 whose COM implementation creates COM objects.</para>
1267
1268 <para>For example,
1269 <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
1270 creates a new instance of
1271 <link linkend="IMachine">IMachine</link>;
1272 the COM object returned by the COM method call is then wrapped
1273 into a managed object reference by the web server, and this
1274 reference is returned to the web service client.</para>
1275 </listitem>
1276 </orderedlist></para>
1277
1278 <para>Internally, in the web service process, each managed object
1279 reference is simply a small data structure, containing a COM pointer
1280 to the "real" COM object, the web session ID and the object ID. This
1281 structure is allocated on creation and stored efficiently in hashes,
1282 so that the web service can look up the COM object quickly whenever
1283 a web service client wishes to make a method call. The random
1284 session ID also ensures that one web service client cannot intercept
1285 the objects of another.</para>
1286
1287 <para>Managed object references are not destroyed automatically and
1288 must be released by explicitly calling
1289 <link linkend="IManagedObjectRef__release">IManagedObjectRef::release()</link>.
1290 This is important, as
1291 otherwise hundreds or thousands of managed object references (and
1292 corresponding COM objects, which can consume much more memory!) can
1293 pile up in the web service process and eventually cause it to deny
1294 service.</para>
1295
1296 <para>To reiterate: The underlying COM object, which the reference
1297 points to, is only freed if the managed object reference is
1298 released. It is therefore vital that web service clients properly
1299 clean up after the managed object references that are returned to
1300 them.</para>
1301
1302 <para>When a web service client calls
1303 <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>,
1304 all managed object references created during the session are
1305 automatically freed. For short-lived sessions that do not create a
1306 lot of objects, logging off may therefore be sufficient, although it
1307 is certainly not "best practice".</para>
1308 </sect3>
1309
1310 <sect3>
1311 <title>Some more detail about web service operation</title>
1312
1313 <sect4 id="soap">
1314 <title>SOAP messages</title>
1315
1316 <para>Whenever a client makes a call to a web service, this
1317 involves a complicated procedure internally. These calls are
1318 remote procedure calls. Each such procedure call typically
1319 consists of two "message" being passed, where each message is a
1320 plain-text HTTP request with a standard HTTP header and a special
1321 XML document following. This XML document encodes the name of the
1322 procedure to call and the argument names and values passed to
1323 it.</para>
1324
1325 <para>To give you an idea of what such a message looks like,
1326 assuming that a web service provides a procedure called
1327 "SayHello", which takes a string "name" as an argument and returns
1328 "Hello" with a space and that name appended, the request message
1329 could look like this:</para>
1330
1331 <para><screen>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
1332&lt;SOAP-ENV:Envelope
1333 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
1334 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
1335 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1336 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
1337 xmlns:test="http://test/"&gt;
1338&lt;SOAP-ENV:Body&gt;
1339 &lt;test:SayHello&gt;
1340 &lt;name&gt;Peter&lt;/name&gt;
1341 &lt;/test:SayHello&gt;
1342 &lt;/SOAP-ENV:Body&gt;
1343&lt;/SOAP-ENV:Envelope&gt;</screen>A similar message -- the "response" message
1344 -- would be sent back from the web service to the client,
1345 containing the return value "Hello Peter".</para>
1346
1347 <para>Most programming languages provide automatic support to
1348 generate such messages whenever code in that programming language
1349 makes such a request. In other words, these programming languages
1350 allow for writing something like this (in pseudo-C++ code):</para>
1351
1352 <para><screen>webServiceClass service("localhost", 18083); // server and port
1353string result = service.SayHello("Peter"); // invoke remote procedure</screen>
1354 and would, for these two pseudo-lines, automatically perform these
1355 steps:</para>
1356
1357 <para><orderedlist>
1358 <listitem>
1359 <para>Prepare a connection to the web service running on port
1360 18083 of "localhost".</para>
1361 </listitem>
1362
1363 <listitem>
1364 <para>Generate a SOAP message similar to the above example for the
1365 <computeroutput>SayHello()</computeroutput> function of the web service
1366 by encoding all arguments of the remote procedure call (which could
1367 involve all kinds of type conversions and complex marshalling for arrays
1368 and structures).</para>
1369 </listitem>
1370
1371 <listitem>
1372 <para>Connect to the web service via HTTP and then send that
1373 message.</para>
1374 </listitem>
1375
1376 <listitem>
1377 <para>Wait for the web service to send a response message.</para>
1378 </listitem>
1379
1380 <listitem>
1381 <para>Decode that response message and put the return value
1382 of the remote procedure into the "result" variable.</para>
1383 </listitem>
1384 </orderedlist></para>
1385 </sect4>
1386
1387 <sect4 id="wsdl">
1388 <title>Service descriptions in WSDL</title>
1389
1390 <para>In the above explanations about SOAP, it wasn't explained how
1391 the programming language learns about how to translate function
1392 calls in its own syntax into proper SOAP messages. In other words,
1393 the programming language needs to know what operations the web
1394 service supports and what types of arguments are required for the
1395 operation's data in order to be able to properly serialize and
1396 deserialize the data to and from the web service. For example, if
1397 a web service operation expects a number in "double" floating
1398 point format for a particular parameter, the programming language
1399 cannot send it a string instead.</para>
1400
1401 <para>For this, the Web Service Definition Language (WSDL) was
1402 invented, another XML substandard that describes exactly what
1403 operations the web service supports and, for each operation, which
1404 parameters and types are needed with each request and response
1405 message. WSDL descriptions can be incredibly verbose, and one of
1406 the few good things that can be said about this standard is that
1407 it is indeed supported by most programming languages.</para>
1408
1409 <para>So, if it is said that a programming language "supports" web
1410 services, this typically means that a programming language has
1411 support for parsing WSDL files and somehow integrating the remote
1412 procedure calls into the native language syntax -- for example, as
1413 shown in the Java sample in <xref
1414 linkend="webservice-java-sample"/>.</para>
1415
1416 <para>For details about how programming languages support web
1417 services, please refer to the documentation that comes with the
1418 individual language. Here are a few pointers:</para>
1419
1420 <orderedlist>
1421 <listitem>
1422 <para>For <emphasis role="bold">C++, </emphasis> among many
1423 others, the gSOAP toolkit is a good option. Parts of gSOAP are
1424 also used in VirtualBox to implement the VirtualBox web
1425 service.</para>
1426 </listitem>
1427
1428 <listitem>
1429 <para>For <emphasis role="bold">Java, </emphasis> there are
1430 several implementations already described in this document
1431 (see <xref linkend="glue-jax-ws"/> and <xref
1432 linkend="webservice-java-sample"/>).</para>
1433 </listitem>
1434
1435 <listitem>
1436 <para><emphasis role="bold">Perl</emphasis> supports WSDL via
1437 the SOAP::Lite package. This in turn comes with a tool called
1438 <computeroutput>stubmaker.pl</computeroutput> that allows you
1439 to turn any WSDL file into a Perl package that you can import.
1440 (You can also import any WSDL file "live" by having it parsed
1441 every time the script runs, but that can take a while.) You
1442 can then code (again, assuming the above example):
1443 <screen>my $result = servicename-&gt;sayHello("Peter");</screen>
1444 </para>
1445
1446 <para>A sample that uses SOAP::Lite was described in <xref
1447 linkend="raw-webservice-perl"/>.</para>
1448 </listitem>
1449 </orderedlist>
1450 </sect4>
1451 </sect3>
1452 </sect2>
1453 </sect1>
1454
1455 <sect1 id="api_com">
1456 <title>Using COM/XPCOM directly</title>
1457
1458 <para>If you do not require <emphasis>remote</emphasis> procedure calls
1459 such as those offered by the VirtualBox web service, and if you know
1460 Python or C++ as well as COM, you might find it preferable to program
1461 VirtualBox's Main API directly via COM.</para>
1462
1463 <para>COM stands for "Component Object Model" and is a standard
1464 originally introduced by Microsoft in the 1990s for Microsoft Windows.
1465 It allows for organizing software in an object-oriented way and across
1466 processes; code in one process may access objects that live in another
1467 process.</para>
1468
1469 <para>COM has several advantages: it is language-neutral, meaning that
1470 even though all of VirtualBox is internally written in C++, programs
1471 written in other languages can communicate with it. COM also cleanly
1472 separates interface from implementation, so that external programs do
1473 not need to know anything about the messy and complicated details of
1474 VirtualBox internals.</para>
1475
1476 <para>On a Windows host, all parts of VirtualBox will use the COM
1477 functionality that is native to Windows. On other hosts (including
1478 Linux), VirtualBox comes with a built-in implementation of XPCOM, as
1479 originally created by the Mozilla project, which we have enhanced to
1480 support interprocess communication on a level comparable to Microsoft
1481 COM. Internally, VirtualBox has an abstraction layer that allows the
1482 same VirtualBox code to work both with native COM as well as our XPCOM
1483 implementation.</para>
1484
1485 <sect2 id="pycom">
1486 <title>Python COM API</title>
1487
1488 <para>On Windows, Python scripts can use COM and VirtualBox interfaces
1489 to control almost all aspects of virtual machine execution. For example,
1490 you can use the following commands to instantiate the VirtualBox object
1491 and start a VM: <screen>
1492 vbox = win32com.client.Dispatch("VirtualBox.VirtualBox")
1493 session = win32com.client.Dispatch("VirtualBox.Session")
1494 mach = vbox.findMachine("uuid or name of machine to start")
1495 progress = mach.launchVMProcess(session, "gui", "")
1496 progress.waitForCompletion(-1)
1497 </screen> Also, see
1498 <computeroutput>sdk/bindings/glue/python/samples/vboxshell.py</computeroutput>
1499 for more advanced usage scenarious. However, unless you have specific
1500 requirements, we strongly recommend that you use the generic glue layer
1501 described in the next section to access MS COM objects.</para>
1502 </sect2>
1503
1504 <sect2 id="glue-python">
1505 <title>Common Python bindings layer</title>
1506
1507 <para>As different wrappers ultimately provide access to the same
1508 underlying API, and to simplify porting and development of Python
1509 applications using the VirtualBox Main API, we developed a common glue
1510 layer that abstracts out most platform-specific details from the
1511 application and allows the developer to focus on application logic.
1512 The VirtualBox installer automatically sets up this glue layer for the
1513 system default Python installation.</para>
1514
1515 <para>See <xref linkend="glue-python-setup"/> for details on how to
1516 set up the glue layer if you want to use a different Python installation,
1517 or if the VirtualBox installer failed to detect and set it up accordingly.</para>
1518
1519 <para>The minimum supported Python version is 2.6.</para>
1520
1521 <para>In this layer, the class
1522 <computeroutput>VirtualBoxManager</computeroutput> hides most
1523 platform-specific details. It can be used to access both the local
1524 (COM) and the web service based API. The following code can be used by
1525 an application to use the glue layer.</para>
1526
1527 <screen># This code assumes vboxapi.py from VirtualBox distribution
1528# being in PYTHONPATH, or installed system-wide
1529from vboxapi import VirtualBoxManager
1530
1531# This code initializes VirtualBox manager with default style
1532# and parameters
1533virtualBoxManager = VirtualBoxManager(None, None)
1534
1535# Alternatively, one can be more verbose, and initialize
1536# glue with web service backend, and provide authentication
1537# information
1538virtualBoxManager = VirtualBoxManager("WEBSERVICE",
1539 {'url':'http://myhost.com::18083/',
1540 'user':'me',
1541 'password':'secret'}) </screen>
1542
1543 <para>We supply the <computeroutput>VirtualBoxManager</computeroutput>
1544 constructor with 2 arguments: style and parameters. Style defines
1545 which bindings style to use (could be "MSCOM", "XPCOM" or
1546 "WEBSERVICE"), and if set to <computeroutput>None</computeroutput>
1547 defaults to usable platform bindings (MS COM on Windows, XPCOM on
1548 other platforms). The second argument defines parameters, passed to
1549 the platform-specific module, as we do in the second example, where we
1550 pass a username and password to be used to authenticate against the web
1551 service.</para>
1552
1553 <para>After obtaining the
1554 <computeroutput>VirtualBoxManager</computeroutput> instance, one can
1555 perform operations on the IVirtualBox class. For example, the
1556 following code will a start virtual machine by name or ID:</para>
1557
1558 <screen>from vboxapi import VirtualBoxManager
1559mgr = VirtualBoxManager(None, None)
1560vbox = mgr.getVirtualBox()
1561name = "Linux"
1562mach = vbox.findMachine(name)
1563session = mgr.getSessionObject(vbox)
1564progress = mach.launchVMProcess(session, "gui", "")
1565progress.waitForCompletion(-1)
1566mgr.closeMachineSession(session)
1567 </screen>
1568 <para>
1569 The following code will print all registered machines and their log
1570 folders:
1571 </para>
1572 <screen>from vboxapi import VirtualBoxManager
1573mgr = VirtualBoxManager(None, None)
1574vbox = mgr.getVirtualBox()
1575
1576for m in mgr.getArray(vbox, 'machines'):
1577 print "Machine '%s' logs in '%s'" %(m.name, m.logFolder)
1578 </screen>
1579
1580 <para>The code above demonstrates cross-platform access to array
1581 properties (certain limitations prevent one from using
1582 <computeroutput>vbox.machines</computeroutput> to access a list of
1583 available virtual machines in the case of XPCOM), and a mechanism for
1584 uniform session creation and closure
1585 (<computeroutput>mgr.getSessionObject()</computeroutput>).</para>
1586
1587 <sect3 id="glue-python-setup">
1588 <title>Manual or subsequent setup</title>
1589
1590 <para>If you want to use the glue layer with a different Python
1591 installation or the installer failed to set it up, then use these steps
1592 in a shell to install the necessary files:</para>
1593
1594 <screen> # cd VBOX_INSTALL_PATH/sdk/installer
1595 # python vboxapisetup.py install</screen>
1596
1597 <note> <para>On Windows hosts, a Python distribution along with the
1598 win32api bindings package need to be installed as a prerequisite. </para></note>
1599 </sect3>
1600
1601 </sect2>
1602
1603 <sect2 id="cppcom">
1604 <title>C++ COM API</title>
1605
1606 <para>C++ is the language that VirtualBox itself is written in, so C++
1607 is the most direct way to use the Main API -- but it is not
1608 necessarily the easiest, as using COM and XPCOM has its own set of
1609 complications.</para>
1610
1611 <para>VirtualBox ships with sample programs that demonstrate how to
1612 use the Main API to implement a number of tasks on your host platform.
1613 These samples can be found in the
1614 <computeroutput>sdk/bindings/xpcom/samples</computeroutput> directory for
1615 Linux, Mac OS X and Solaris and
1616 <computeroutput>sdk/bindings/mscom/samples</computeroutput> for Windows.
1617 The two samples are actually different, because the one for Windows
1618 uses native COM, whereas the other uses our XPCOM implementation, as
1619 described above.</para>
1620
1621 <para>Since COM and XPCOM are conceptually very similar but vary in
1622 the implementation details, we have created a "glue" layer that
1623 shields COM client code from these differences. All VirtualBox uses is
1624 this glue layer, so the same code written once works on both Windows
1625 hosts (with native COM) as well as on other hosts (with our XPCOM
1626 implementation). It is recommended to always use this glue code
1627 instead of using the COM and XPCOM APIs directly, as it is very easy
1628 to make your code completely independent from the platform it is
1629 running on.<!-- A third sample,
1630 <computeroutput>tstVBoxAPIGlue.cpp</computeroutput>, illustrates how to
1631 use the glue layer.
1632--></para>
1633
1634 <para>In order to encapsulate platform differences between Microsoft
1635 COM and XPCOM, the following items should be kept in mind when using
1636 the glue layer:</para>
1637
1638 <para><orderedlist>
1639 <listitem>
1640 <para><emphasis role="bold">Attribute getters and
1641 setters.</emphasis> COM has the notion of "attributes" in
1642 interfaces, which roughly compare to C++ member variables in
1643 classes. The difference is that for each attribute declared in
1644 an interface, COM automatically provides a "get" method to
1645 return the attribute's value. Unless the attribute has been
1646 marked as "readonly", a "set" attribute is also provided.</para>
1647
1648 <para>To illustrate, the IVirtualBox interface has a "version"
1649 attribute, which is read-only and of the "wstring" type (the
1650 standard string type in COM). As a result, you can call the
1651 "get" method for this attribute to retrieve the version number
1652 of VirtualBox.</para>
1653
1654 <para>Unfortunately, the implementation differs between COM and
1655 XPCOM. Microsoft COM names the "get" method like this:
1656 <computeroutput>get_Attribute()</computeroutput>, whereas XPCOM
1657 uses this syntax:
1658 <computeroutput>GetAttribute()</computeroutput> (and accordingly
1659 for "set" methods). To hide these differences, the VirtualBox
1660 glue code provides the
1661 <computeroutput>COMGETTER(attrib)</computeroutput> and
1662 <computeroutput>COMSETTER(attrib)</computeroutput> macros. So,
1663 <computeroutput>COMGETTER(version)()</computeroutput> (note, two
1664 pairs of brackets) expands to
1665 <computeroutput>get_Version()</computeroutput> on Windows and
1666 <computeroutput>GetVersion()</computeroutput> on other
1667 platforms.</para>
1668 </listitem>
1669
1670 <listitem>
1671 <para><emphasis role="bold">Unicode conversions.</emphasis>
1672 While the rest of the modern world has pretty much settled on
1673 encoding strings in UTF-8, COM, unfortunately, uses UCS-16
1674 encoding. This requires a lot of conversions, in particular
1675 between the VirtualBox Main API and the Qt GUI, which, like the
1676 rest of Qt, likes to use UTF-8.</para>
1677
1678 <para>To facilitate these conversions, VirtualBox provides the
1679 <computeroutput>com::Bstr</computeroutput> and
1680 <computeroutput>com::Utf8Str</computeroutput> classes, which
1681 support all kinds of conversions back and forth.</para>
1682 </listitem>
1683
1684 <listitem>
1685 <para><emphasis role="bold">COM autopointers.</emphasis>
1686 Possibly the greatest pain of using COM -- reference counting --
1687 is alleviated by the
1688 <computeroutput>ComPtr&lt;&gt;</computeroutput> template
1689 provided by the <computeroutput>ptr.h</computeroutput> file in
1690 the glue layer.</para>
1691 </listitem>
1692 </orderedlist></para>
1693 </sect2>
1694
1695 <sect2 id="event-queue">
1696 <title>Event queue processing</title>
1697
1698 <para>Both VirtualBox client programs and front-ends should
1699 periodically perform processing of the main event queue, and do that
1700 on the application's main thread. In the case of a typical GUI
1701 Windows/Mac OS application this happens automatically in the GUI's
1702 dispatch loop. However, for CLI only application, the appropriate actions
1703 have to be taken. For C++ applications, the VirtualBox SDK provided glue
1704 method
1705 <screen>
1706 int EventQueue::processEventQueue(uint32_t cMsTimeout)
1707 </screen> can be used for both blocking and non-blocking operations.
1708 For the Python bindings, a common layer provides the method <screen>
1709 VirtualBoxManager.waitForEvents(ms)
1710 </screen> with similar semantics.</para>
1711
1712 <para>Things get somewhat more complicated for situations where an
1713 application using VirtualBox cannot directly control the main event
1714 loop and the main event queue is separated from the event queue of the
1715 programming library (for example in case of Qt on Unix platforms). In
1716 such a case, the application developer is advised to use a
1717 platform/toolkit specific event injection mechanism to force event
1718 queue checks either based on periodic timer events delivered to the
1719 main thread, or by using custom platform messages to notify the main
1720 thread when events are available. See the Qt (VirtualBox) front-end as
1721 an example.</para>
1722 </sect2>
1723
1724 <sect2 id="vbcom">
1725 <title>Visual Basic and Visual Basic Script (VBS) on Windows
1726 hosts</title>
1727
1728 <para>On Windows hosts, one can control some of the VirtualBox Main
1729 API functionality from VBS scripts, and pretty much everything from
1730 Visual Basic programs.<footnote>
1731 <para>The difference results from the way VBS treats COM
1732 safearrays, which are used to keep lists in the Main API. VBS
1733 expects every array element to be a
1734 <computeroutput>VARIANT</computeroutput>, which is too strict a
1735 limitation for any high performance API. We may lift this
1736 restriction for interface APIs in a future version, or
1737 alternatively provide conversion APIs.</para>
1738 </footnote></para>
1739
1740 <para>VBS is a scripting language available in any recent Windows
1741 environment. As an example, the following VBS code will print the
1742 VirtualBox version: <screen>
1743 set vb = CreateObject("VirtualBox.VirtualBox")
1744 Wscript.Echo "VirtualBox version " &amp; vb.version
1745 </screen> See
1746 <computeroutput>sdk/bindings/mscom/vbs/sample/vboxinfo.vbs</computeroutput>
1747 for the complete sample.</para>
1748
1749 <para>Visual Basic is a popular high level language capable of
1750 accessing COM objects. The following VB code will iterate over all
1751 available virtual machines:<screen>
1752 Dim vb As VirtualBox.IVirtualBox
1753
1754 vb = CreateObject("VirtualBox.VirtualBox")
1755 machines = ""
1756 For Each m In vb.Machines
1757 m = m &amp; " " &amp; m.Name
1758 Next
1759 </screen> See
1760 <computeroutput>sdk/bindings/mscom/vb/sample/vboxinfo.vb</computeroutput>
1761 for the complete sample.</para>
1762 </sect2>
1763
1764 <sect2 id="cbinding">
1765 <title>C bindings to the VirtualBox API</title>
1766
1767 <para>The VirtualBox API was originally designed to be object oriented
1768 and leverages XPCOM or COM as the middleware to natively map the API to
1769 C++. This means that in order to use the VirtualBox API from C there
1770 needs to be some helper code to bridge the language differences and
1771 reduce the differences between platforms.</para>
1772
1773 <sect3 id="capi_glue">
1774 <title>Cross-platform C bindings to the VirtualBox API</title>
1775
1776 <para>Starting with version 4.3, VirtualBox offers C bindings
1777 which allows using the same C client sources for all platforms,
1778 covering Windows, Linux, Mac OS X and Solaris. It is the
1779 preferred way to write API clients, even though the old style
1780 is still available.</para>
1781
1782 </sect3>
1783
1784 <sect3 id="c-gettingstarted">
1785 <title>Getting started</title>
1786
1787 <para>The following sections describe how to use the VirtualBox API
1788 in a C program. The necessary files are included in the SDK, in the
1789 directories <computeroutput>sdk/bindings/c/include</computeroutput>
1790 and <computeroutput>sdk/bindings/c/glue</computeroutput>.</para>
1791
1792 <para>As part of the SDK, a sample program
1793 <computeroutput>tstCAPIGlue.c</computeroutput> is provided in the
1794 directory <computeroutput>sdk/bindings/c/samples</computeroutput>
1795 which demonstrates
1796 using the C bindings to initialize the API, get handles for
1797 VirtualBox and Session objects, make calls to list and start virtual
1798 machines, monitor events, and uninitialize resources when done. The
1799 sample program is trying to illustrate all relevant concepts, so it
1800 is a great source of detail information. Among many other generally
1801 useful code sequences it contains a function which shows how to
1802 retrieve error details in C code if they are available from the API
1803 call.</para>
1804
1805 <para>The sample program <computeroutput>tstCAPIGlue</computeroutput>
1806 can be built using the provided
1807 <computeroutput>Makefile</computeroutput> and can be run without
1808 arguments.</para>
1809
1810 <para>It uses the VBoxCAPIGlue library (source code is in directory
1811 <computeroutput>sdk/bindings/c/glue</computeroutput>, to be used in
1812 your API client code) to open the C binding layer during runtime,
1813 which is preferred to other means as it isolates the code which
1814 locates the necessary dynamic library, using a known working way
1815 which works on all platforms. If you encounter problems with this
1816 glue code in <computeroutput>VBoxCAPIGlue.c</computeroutput>, let the
1817 VirtualBox developers know, rather than inventing incompatible
1818 solutions.</para>
1819
1820 <para>The following sections document the important concepts needed
1821 to correctly use the C bindings, as it is vital for developing API
1822 client code which manages memory correctly, updates the reference
1823 counters correctly, and avoids crashes and memory leaks. Often API
1824 clients need to handle events, so the C API specifics are also
1825 described below.</para>
1826 </sect3>
1827
1828 <sect3 id="c-initialization">
1829 <title>VirtualBox C API initialization</title>
1830
1831 <para>Just like in C++, the API and the underlying middleware needs
1832 to be initialized before it can be used. The
1833 <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>
1834 header file provides the interface to the C bindings, but you can
1835 alternatively and more conveniently just include
1836 <computeroutput>VBoxCAPIGlue.h</computeroutput>,
1837 as this avoids the VirtualBox version dependent header file name and
1838 makes sure that the global variable <code>g_pVBoxFuncs</code> contains a
1839 pointer to the structure which contains the helper function pointers.
1840 Here's how to initialize the C API:<screen>#include "VBoxCAPIGlue.h"
1841...
1842IVirtualBoxClient *vboxclient = NULL;
1843
1844/*
1845 * VBoxCGlueInit() loads the necessary dynamic library, handles errors
1846 * (producing an error message hinting what went wrong) and gives you
1847 * the pointer to the function table (g_pVBoxFuncs).
1848 *
1849 * Once you get the function table, then how and which functions
1850 * to use is explained below.
1851 *
1852 * g_pVBoxFuncs-&gt;pfnClientInitialize does all the necessary startup
1853 * action and provides us with pointers to an IVirtualBoxClient instance.
1854 * It should be matched by a call to g_pVBoxFuncs-&gt;pfnClientUninitialize()
1855 * when done.
1856 */
1857
1858if (VBoxCGlueInit())
1859{
1860 fprintf(stderr, "s: FATAL: VBoxCGlueInit failed: %s\n",
1861 argv[0], g_szVBoxErrMsg);
1862 return EXIT_FAILURE;
1863}
1864
1865g_pVBoxFuncs-&gt;pfnClientInitialize(NULL, &amp;vboxclient);
1866if (!vboxclient)
1867{
1868 fprintf(stderr, "%s: FATAL: could not get VirtualBoxClient reference\n",
1869 argv[0]);
1870 return EXIT_FAILURE;
1871}</screen></para>
1872
1873 <para>If <computeroutput>vboxclient</computeroutput> is still
1874 <computeroutput>NULL</computeroutput> this means the initializationi
1875 failed and the VirtualBox C API cannot be used.</para>
1876
1877 <para>It is possible to write C applications using multiple threads
1878 which all use the VirtualBox API, as long as you're initializing
1879 the C API in each thread which your application creates. This is done
1880 with <code>g_pVBoxFuncs->pfnClientThreadInitialize()</code> and
1881 likewise before the thread is terminated the API must be
1882 uninitialized with
1883 <code>g_pVBoxFuncs->pfnClientThreadUninitialize()</code>. You don't
1884 have to use these functions in worker threads created by COM/XPCOM
1885 (which you might utilize if your code uses active event handling),
1886 since everything is initialized correctly already. On Windows the C
1887 bindings create a marshaller which supports a wide range of COM
1888 threading models, from Single-Threaded Apartments (STA) to
1889 Multithreaded Apartments (MTA), so you don't have to worry about
1890 these details unless you plan to use active event handlers. See
1891 the sample code for how to get this to work reliably (in other words
1892 think twice if passive event handling isn't the better solution after
1893 you looked at the sample code).</para>
1894 </sect3>
1895
1896 <sect3 id="c-invocation">
1897 <title>C API attribute and method invocation</title>
1898
1899 <para>Method invocation is straightforward. It looks very similar
1900 to the C++ mechanism since it also uses a macro which internally
1901 accesses the vtable and additionally needs to be passed a pointer to the
1902 object as the first argument to serve as the
1903 <computeroutput>this</computeroutput> pointer.</para>
1904
1905 <para>Using the C bindings all method invocations return a numeric
1906 result code of type <code>HRESULT</code> (with a few exceptions
1907 which normally are not relevant).</para>
1908
1909 <para>If an interface is specified as returning an object, a pointer
1910 to a pointer to the appropriate object must be passed as the last
1911 argument. The method will then store an object pointer in that
1912 location.</para>
1913
1914 <para>Likewise, attributes (properties) can be queried or set using
1915 method invocations, using specially named methods. For each
1916 attribute there exists a getter method, the name of which is composed
1917 of <computeroutput>get_</computeroutput> followed by the capitalized
1918 attribute name. Unless the attribute is read-only, an analogous
1919 <computeroutput>set_</computeroutput> method exists. Let's apply
1920 these rules to get the <computeroutput>IVirtualBox</computeroutput>
1921 reference, an <computeroutput>ISession</computeroutput> instance
1922 reference and read the
1923 <link linkend="IVirtualBox__revision">IVirtualBox::revision</link>
1924 attribute:
1925 <screen>
1926IVirtualBox *vbox = NULL;
1927ISession *session = NULL;
1928HRESULT rc;
1929ULONG revision;
1930
1931rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &amp;vbox);
1932
1933if (FAILED(rc) || !vbox)
1934{
1935 PrintErrorInfo(argv[0], "FATAL: could not get VirtualBox reference", rc);
1936 return EXIT_FAILURE;
1937}
1938rc = IVirtualBoxClient_get_Session(vboxclient, &amp;session);
1939if (FAILED(rc) || !session)
1940{
1941 PrintErrorInfo(argv[0], "FATAL: could not get Session reference", rc);
1942 return EXIT_FAILURE;
1943}
1944
1945rc = IVirtualBox_get_Revision(vbox, &amp;revision);
1946if (SUCCEEDED(rc))
1947{
1948 printf("Revision: %u\n", revision);
1949}</screen></para>
1950
1951 <para>The convenience macros for calling a method are named by prepending
1952 the method name with the interface name (using <code>_</code> as the
1953 separator).</para>
1954
1955 <para>So far only attribute getters were illustrated, but generic
1956 method calls are straightforward, too:
1957 <screen>IMachine *machine = NULL;
1958BSTR vmname = ...;
1959...
1960/*
1961 * Calling IMachine::findMachine(...)
1962 */
1963rc = IVirtualBox_FindMachine(vbox, vmname, &amp;machine);</screen></para>
1964
1965 <para>As a more complicated example of a method invocation, let's
1966 call
1967 <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess</link>
1968 which returns an IProgress object. Note again that the method name is
1969 capitalized:
1970 <screen>IProgress *progress;
1971...
1972rc = IMachine_LaunchVMProcess(
1973 machine, /* this */
1974 session, /* arg 1 */
1975 sessionType, /* arg 2 */
1976 env, /* arg 3 */
1977 &amp;progress /* Out */
1978);</screen></para>
1979
1980 <para>All objects with their methods and attributes are documented
1981 in <xref linkend="sdkref_classes"/>.</para>
1982 </sect3>
1983
1984 <sect3 id="c-string-handling">
1985 <title>String handling</title>
1986
1987 <para>When dealing with strings you have to be aware of a string's
1988 encoding and ownership.</para>
1989
1990 <para>Internally, the API uses UTF-16 encoded strings. A set of
1991 conversion functions is provided to convert other encodings to and
1992 from UTF-16. The type of a UTF-16 character is
1993 <computeroutput>BSTR</computeroutput> (or its constant counterpart
1994 <computeroutput>CBSTR</computeroutput>), which is an array type,
1995 represented by a pointer to the start of the zero-terminated string.
1996 There are functions for converting between UTF-8 and UTF-16 strings
1997 available through <code>g_pVBoxFuncs</code>:
1998 <screen>int (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
1999int (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);</screen></para>
2000
2001 <para>The ownership of a string determines who is responsible for
2002 releasing resources associated with the string. Whenever the API
2003 creates a string (essentially for output parameters), ownership is
2004 transferred to the caller. To avoid resource leaks, the caller
2005 should release resources once the string is no longer needed.
2006 There are plenty of examples in the sample code.</para>
2007 </sect3>
2008
2009 <sect3 id="c-safearray">
2010 <title>Array handling</title>
2011
2012 <para>Arrays are handled somewhat similarly to strings, with the
2013 additional information of the number of elements in the array. The
2014 exact details of string passing depends on the platform middleware
2015 (COM/XPCOM), and therefore the C binding offers helper functions to
2016 gloss over these differences.</para>
2017
2018 <para>Passing arrays as input parameters to API methods is usually
2019 done by the following sequence, calling a hypothetical
2020 <code>IArrayDemo_PassArray</code> API method:
2021 <screen>static const ULONG aElements[] = { 1, 2, 3, 4 };
2022ULONG cElements = sizeof(aElements) / sizeof(aElements[0]);
2023SAFEARRAY *psa = NULL;
2024psa = g_pVBoxFuncs->pfnSafeArrayCreateVector(VT_I4, 0, cElements);
2025g_pVBoxFuncs->pfnSafeArrayCopyInParamHelper(psa, aElements, sizeof(aElements));
2026IArrayDemo_PassArray(pThis, ComSafeArrayAsInParam(psa));
2027g_pVBoxFuncs->pfnSafeArrayDestroy(psa);</screen></para>
2028
2029 <para>Likewise, getting arrays results from output parameters is done
2030 using helper functions which manage memory allocations as part of
2031 their other functionality:
2032 <screen>SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
2033ULONG *pData;
2034ULONG cElements;
2035IArrayDemo_ReturnArray(pThis, ComSafeArrayAsOutTypeParam(psa, ULONG));
2036g_pVBoxFuncs->pfnSafeArrayCopyOutParamHelper((void **)&amp;pData, &amp;cElements, VT_I4, psa);
2037g_pVBoxFuncs->pfnSafeArrayDestroy(psa);</screen></para>
2038
2039 <para>This covers the necessary functionality for all array element
2040 types except interface references. These need special helpers to
2041 manage the reference counting correctly. The following code snippet
2042 gets the list of VMs, and passes the first IMachine reference to
2043 another API function (assuming that there is at least one element
2044 in the array, to simplify the example):
2045 <screen>SAFEARRAY psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
2046IMachine **machines = NULL;
2047ULONG machineCnt = 0;
2048ULONG i;
2049IVirtualBox_get_Machines(virtualBox, ComSafeArrayAsOutIfaceParam(machinesSA, IMachine *));
2050g_pVBoxFuncs->pfnSafeArrayCopyOutIfaceParamHelper((IUnknown ***)&amp;machines, &amp;machineCnt, machinesSA);
2051g_pVBoxFuncs->pfnSafeArrayDestroy(machinesSA);
2052/* Now "machines" contains the IMachine references, and machineCnt the
2053 * number of elements in the array. */
2054...
2055SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayCreateVector(VT_IUNKNOWN, 0, 1);
2056g_pVBoxFuncs->pfnSafeArrayCopyInParamHelper(psa, (void *)&amp;machines[0], sizeof(machines[0]));
2057IVirtualBox_GetMachineStates(ComSafeArrayAsInParam(psa), ...);
2058...
2059g_pVBoxFuncs->pfnSafeArrayDestroy(psa);
2060for (i = 0; i &lt; machineCnt; ++i)
2061{
2062 IMachine *machine = machines[i];
2063 IMachine_Release(machine);
2064}
2065free(machines);</screen></para>
2066
2067 <para>Handling output parameters needs more special handling than
2068 input parameters, thus only for the former are there special helpers
2069 while the latter is handled through the generic array support.</para>
2070 </sect3>
2071
2072 <sect3 id="c-eventhandling">
2073 <title>Event handling</title>
2074
2075 <para>The VirtualBox API offers two types of event handling, active
2076 and passive, and consequently there is support for both with the
2077 C API binding. Active event handling (based on asynchronous
2078 callback invocation for event delivery) is more difficult, as it
2079 requires the construction of valid C++ objects in C, which is
2080 inherently platform and compiler dependent. Passive event handling
2081 is much simpler, it relies on an event loop, fetching events and
2082 triggering the necessary handlers explicitly in the API client code.
2083 Both approaches depend on an event loop to make sure that events
2084 get delivered in a timely manner but otherwise differ in what
2085 else is required to implement the respective event handler type.</para>
2086
2087 <para>The C API sample contains code for both event handling styles,
2088 and one has to modify the appropriate <code>#define</code> to select
2089 which style is actually used by the compiled program. It allows a
2090 good comparison between the two variants and the code sequences are
2091 probably worth reusing without much change in other API clients
2092 with only minor adaptions.</para>
2093
2094 <para>Active event handling needs to ensure that the following helper
2095 function is called frequently enough in the primary thread:
2096 <screen>g_pVBoxFuncs->pfnProcessEventQueue(cTimeoutMS);</screen></para>
2097
2098 <para>The actual event handler implementation is quite tedious, as
2099 it has to implement a complete API interface. Especially on Windows
2100 it is a lot of work to implement the complicated
2101 <code>IDispatch</code> interface, requiring loading COM type
2102 information and using it in the <code>IDispatch</code> method
2103 implementation. Overall this is quite tedious compared to passive
2104 event handling.</para>
2105
2106 <para>Passive event handling uses a similar event loop structure,
2107 which requires calling the following function in a loop, and
2108 processing the returned event appropriately:
2109 <screen>rc = IEventSource_GetEvent(pEventSource, pListener, cTimeoutMS, &amp;pEvent);</screen></para>
2110
2111 <para>After processing the event it needs to be marked as processed
2112 with the following method call:
2113 <screen>rc = IEventSource_EventProcessed(pEventSource, pListener, pEvent);</screen></para>
2114
2115 <para>This is vital for vetoable events, as they would be stuck
2116 otherwise, waiting on whether the veto comes or not. It does not do any
2117 harm for other event types, and in the end is cheaper than checking
2118 if the event at hand is vetoable or not.</para>
2119
2120 <para>The general event handling concepts are described in the API
2121 specification (see <xref linkend="events"/>), including how to
2122 aggregate multiple event sources for processing in one event loop.
2123 As mentioned, the sample illustrates the practical aspects of how to
2124 use both types of event handling, active and passive, from a C
2125 application. Additional hints are in the comments documenting
2126 the helper methods in
2127 <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>.
2128 The code complexity of active event handling (and its inherently
2129 platform/compiler specific aspects) should be motivation to use passive
2130 event handling wherever possible.</para>
2131 </sect3>
2132
2133 <sect3 id="c-uninitialization">
2134 <title>C API uninitialization</title>
2135
2136 <para>Uninitialization is performed by
2137 <computeroutput>g_pVBoxFuncs-&gt;pfnClientUninitialize().</computeroutput>
2138 If your program can exit in more than one place, it is a good idea
2139 to install this function as an exit handler using the C library function
2140 <computeroutput>atexit()</computeroutput> just after calling
2141 <computeroutput>g_pVBoxFuncs-&gt;pfnClientInitialize()</computeroutput>
2142 , e.g. <screen>#include &lt;stdlib.h&gt;
2143#include &lt;stdio.h&gt;
2144
2145...
2146
2147/*
2148 * Make sure g_pVBoxFuncs-&gt;pfnClientUninitialize() is called at exit, no
2149 * matter if we return from the initial call to main or call exit()
2150 * somewhere else. Note that atexit registered functions are not
2151 * called upon abnormal termination, i.e. when calling abort() or
2152 * signal().
2153 */
2154
2155if (atexit(g_pVBoxFuncs-&gt;pfnClientUninitialize()) != 0) {
2156 fprintf(stderr, "failed to register g_pVBoxFuncs-&gt;pfnClientUninitialize()\n");
2157 exit(EXIT_FAILURE);
2158}</screen></para>
2159
2160 <para>Another idea would be to write your own <computeroutput>void
2161 myexit(int status)</computeroutput> function, calling
2162 <computeroutput>g_pVBoxFuncs-&gt;pfnClientUninitialize()</computeroutput>
2163 followed by the real <computeroutput>exit()</computeroutput>, and
2164 use it instead of <computeroutput>exit()</computeroutput> throughout
2165 your program and at the end of
2166 <computeroutput>main.</computeroutput></para>
2167
2168 <para>If you expect your program to be terminated by a signal (e.g. a
2169 user types CTRL-C sending SIGINT) you might want to install a signal
2170 handler setting a flag noting that a signal was sent and then
2171 calling
2172 <computeroutput>g_pVBoxFuncs-&gt;pfnClientUninitialize()</computeroutput>
2173 later on, <emphasis>not</emphasis> from the handler itself.</para>
2174
2175 <para>That said, if a client program forgets to call
2176 <computeroutput>g_pVBoxFuncs-&gt;pfnClientUninitialize()</computeroutput>
2177 before it terminates, there is a mechanism in place which will
2178 eventually release references held by the client. On Windows it can
2179 take quite a while, on the order of 6-7 minutes.</para>
2180 </sect3>
2181
2182 <sect3 id="c-linking">
2183 <title>Compiling and linking</title>
2184
2185 <para>A program using the C binding has to open the library during
2186 runtime using the help of the glue code provided and as shown in the
2187 example <computeroutput>tstCAPIGlue.c</computeroutput>.
2188 Compilation and linking can be achieved with a makefile fragment
2189 similar to:<screen># Where is the SDK directory?
2190PATH_SDK = ../../..
2191CAPI_INC = -I$(PATH_SDK)/bindings/c/include
2192ifdef ProgramFiles
2193PLATFORM_INC = -I$(PATH_SDK)/bindings/mscom/include
2194PLATFORM_LIB = $(PATH_SDK)/bindings/mscom/lib
2195else
2196PLATFORM_INC = -I$(PATH_SDK)/bindings/xpcom/include
2197PLATFORM_LIB = $(PATH_SDK)/bindings/xpcom/lib
2198endif
2199GLUE_DIR = $(PATH_SDK)/bindings/c/glue
2200GLUE_INC = -I$(GLUE_DIR)
2201
2202# Compile Glue Library
2203VBoxCAPIGlue.o: $(GLUE_DIR)/VBoxCAPIGlue.c
2204 $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $&lt;
2205
2206# Compile interface ID list
2207VirtualBox_i.o: $(PLATFORM_LIB)/VirtualBox_i.c
2208 $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $&lt;
2209
2210# Compile program code
2211program.o: program.c
2212 $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $&lt;
2213
2214# Link program.
2215program: program.o VBoxCAPICGlue.o VirtualBox_i.o
2216 $(CC) -o $@ $^ -ldl -lpthread</screen></para>
2217 </sect3>
2218
2219 <sect3 id="capi_conversion">
2220 <title>Conversion of code using legacy C bindings</title>
2221
2222 <para>This section aims to make the task of converting code using the
2223 legacy C bindings to the new style a breeze by following these key
2224 steps.</para>
2225
2226 <para>One necessary change is adjusting your Makefile to reflect the
2227 different include paths. As shown in the makefile fragment above, there
2228 are now three relevant include directories. The XPCOM include directory
2229 is still relevant for platforms where the XPCOM middleware is used but
2230 most of its include files live elsewhere now so it's good to have it
2231 last. Additionally the <computeroutput>VirtualBox_i.c</computeroutput>
2232 file needs to be compiled and linked to the program since it contains
2233 the interface IDs (IIDs) relevant for the VirtualBox API, making sure
2234 they are not replicated endlessly if the code refers to them
2235 frequently.</para>
2236
2237 <para>The C API client code should include
2238 <computeroutput>VBoxCAPIGlue.h</computeroutput> instead of
2239 <computeroutput>VBoxXPCOMCGlue.h</computeroutput> or
2240 <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>,
2241 as this makes sure the correct macros and internal translations are
2242 selected.</para>
2243
2244 <para>All API method calls (anything mentioning <code>vtbl</code>)
2245 should be rewritten using the convenience macros for calling methods,
2246 as these hide the internal details, are generally easier to
2247 use, and are shorter to type. You should remove as many as possible
2248 <code>(nsISupports **)</code> or similar typecasts, as the new style
2249 should use the correct type in most places, increasing the type
2250 safety in case of an error in the source code.</para>
2251
2252 <para>To gloss over the platform differences, API client code should
2253 no longer rely on XPCOM specific interface names such as
2254 <code>nsISupports</code>, <code>nsIException</code> and
2255 <code>nsIEventQueue</code>, and replace them by the platform
2256 independent interface names <code>IUnknown</code> and
2257 <code>IErrorInfo</code> for the first two respectively. Event queue
2258 handling should be replaced by using the platform independent way
2259 described in <xref linkend="c-eventhandling"/>.</para>
2260
2261 <para>Finally adjust the string and array handling to use the new
2262 helpers, as these make sure the code works without changes with
2263 both COM and XPCOM, which are significantly different in this area.
2264 The code should be double checked to see that it uses the correct way to
2265 manage memory and is freeing it only after the last use.</para>
2266 </sect3>
2267
2268 <sect3 id="xpcom_cbinding">
2269 <title>Legacy C bindings to VirtualBox API for XPCOM</title>
2270
2271 <note>
2272 <para>This section applies to Linux, Mac OS X and Solaris
2273 hosts only and describes deprecated use of the API from C.</para>
2274 </note>
2275
2276 <para>Starting with version 2.2, VirtualBox offers C bindings for
2277 its API which works only on platforms using XPCOM. Refer to the
2278 old SDK documentation (included in the SDK packages for version 4.3.6
2279 or earlier) since it still applies unchanged. The fundamental concepts
2280 are similar (but the syntactical details are quite different) to the
2281 newer cross-platform C bindings which should be used for all new code,
2282 as the support for the old C bindings will go away in a major release
2283 after version 4.3.</para>
2284 </sect3>
2285 </sect2>
2286 </sect1>
2287 </chapter>
2288
2289 <chapter id="concepts">
2290 <title>Basic VirtualBox concepts; some examples</title>
2291
2292 <para>The following explains some basic VirtualBox concepts such as the
2293 VirtualBox object, sessions and how virtual machines are manipulated and
2294 launched using the Main API. The coding examples use a pseudo-code style
2295 closely related to the object-oriented web service (OOWS) for JAX-WS.
2296 Depending on which environment you are using, you will need to adjust the
2297 examples.</para>
2298
2299 <sect1>
2300 <title>Obtaining basic machine information. Reading attributes</title>
2301
2302 <para>Any program using the Main API will first need access to the
2303 global VirtualBox object (see
2304 <link linkend="IVirtualBox">IVirtualBox</link>), from which all other
2305 functionality of the API is derived. With the OOWS for JAX-WS, this is
2306 returned from the
2307 <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
2308 call.</para>
2309
2310 <para>To enumerate virtual machines, one would look at the "machines"
2311 array attribute in the VirtualBox object (see
2312 <link linkend="IVirtualBox__machines">IVirtualBox::machines</link>).
2313 This array contains all virtual machines currently registered with the
2314 host, each of them being an instance of
2315 <link linkend="IMachine">IMachine</link>.
2316 From each such instance, one can query additional information, such as
2317 the UUID, the name, memory, operating system and more by looking at the
2318 attributes; see the attributes list in
2319 <link linkend="IMachine">IMachine</link> documentation.</para>
2320
2321 <para>As mentioned in the preceding chapters, depending on your
2322 programming environment, attributes are mapped to corresponding "get"
2323 and (if the attribute is not read-only) "set" methods. So when the
2324 documentation says that IMachine has a
2325 "<link linkend="IMachine__name">name</link>" attribute, this means you
2326 need to code something
2327 like the following to get the machine's name:
2328 <screen>IMachine machine = ...;
2329String name = machine.getName();</screen>
2330 Boolean attribute getters can sometimes be called
2331 <computeroutput>isAttribute()</computeroutput> due to JAX-WS naming
2332 conventions.</para>
2333 </sect1>
2334
2335 <sect1>
2336 <title>Changing machine settings: Sessions</title>
2337
2338 <para>As described in the previous section, to read a machine's attribute,
2339 one invokes the corresponding "get" method. One would think that to
2340 change settings of a machine, it would suffice to call the corresponding
2341 "set" method -- for example, to set a VM's memory to 1024 MB, one would
2342 call <computeroutput>setMemorySize(1024)</computeroutput>. Try that, and
2343 you will get an error: "The machine is not mutable."</para>
2344
2345 <para>So unfortunately, things are not that easy. VirtualBox is a
2346 complicated environment in which multiple processes compete for possibly
2347 the same resources, especially machine settings. As a result, machines
2348 must be "locked" before they can either be modified or started. This is
2349 to prevent multiple processes from making conflicting changes to a
2350 machine: it should, for example, not be allowed to change the memory
2351 size of a virtual machine while it is running. (You can't add more
2352 memory to a real computer while it is running either, at least not to an
2353 ordinary PC.) Also, two processes must not change settings at the same
2354 time, or start a machine at the same time.</para>
2355
2356 <para>These requirements are implemented in the Main API by way of
2357 "sessions", in particular, the <link linkend="ISession">ISession</link>
2358 interface. Each process which talks to
2359 VirtualBox needs its own instance of ISession. In the web service, you
2360 can request the creation of such an object by calling
2361 <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>.
2362 More complex management tasks might need multiple instances of ISession,
2363 and each call returns a new one.</para>
2364
2365 <para>This session object must then be used like a mutex semaphore in
2366 common programming environments. Before you can change machine settings,
2367 you must write-lock the machine by calling
2368 <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
2369 with your process's session object.</para>
2370
2371 <para>After the machine has been locked, the
2372 <link linkend="ISession__machine">ISession::machine</link> attribute
2373 contains a copy of the original IMachine object upon which the session
2374 was opened, but this copy is "mutable": you can invoke "set" methods on
2375 it.</para>
2376
2377 <para>When done making the changes to the machine, you must call
2378 <link linkend="IMachine__saveSettings">IMachine::saveSettings()</link>,
2379 which will copy the changes you have made from your "mutable" machine
2380 back to the real machine and write them out to the machine settings XML
2381 file. This will make your changes permanent.</para>
2382
2383 <para>Finally, it is important to always unlock the machine again, by
2384 calling
2385 <link linkend="ISession__unlockMachine">ISession::unlockMachine()</link>.
2386 Otherwise, when the calling process exits, the machine will be moved to the
2387 "aborted" state, which can lead to loss of data.</para>
2388
2389 <para>So, as an example, the sequence to change a machine's memory to
2390 1024 MB is something like this:<screen>IWebsessionManager mgr ...;
2391IVirtualBox vbox = mgr.logon(user, pass);
2392...
2393IMachine machine = ...; // read-only machine
2394ISession session = mgr.getSessionObject();
2395machine.lockMachine(session, LockType.Write); // machine is now locked for writing
2396IMachine mutable = session.getMachine(); // obtain the mutable machine copy
2397mutable.setMemorySize(1024);
2398mutable.saveSettings(); // write settings to XML
2399session.unlockMachine();</screen></para>
2400 </sect1>
2401
2402 <sect1>
2403 <title>Launching virtual machines</title>
2404
2405 <para>To launch a virtual machine, you call
2406 <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>.
2407 This instructs the VirtualBox engine to start a new process containing the
2408 virtual machine. The host system sees each virtual machine as a single
2409 process, even if the virtual machine has hundreds of its own processes
2410 running inside it. (This new VM process in turn obtains a write lock on
2411 the machine, as described above, to prevent conflicting changes from
2412 other processes; this is why opening another session will fail while the
2413 VM is running.)</para>
2414
2415 <para>Starting a machine looks something like this:
2416 <screen>IWebsessionManager mgr ...;
2417IVirtualBox vbox = mgr.logon(user, pass);
2418...
2419IMachine machine = ...; // read-only machine
2420ISession session = mgr.getSessionObject();
2421IProgress prog = machine.launchVMProcess(session,
2422 "gui", // session type
2423 ""); // possibly environment setting
2424prog.waitForCompletion(10000); // give the process 10 secs
2425if (prog.getResultCode() != 0) // check success
2426 System.out.println("Cannot launch VM!")</screen></para>
2427
2428 <para>The caller's session object can then be used as a sort of remote
2429 control to the VM process that was launched. It contains a "console"
2430 object (see <link linkend="ISession__console">ISession::console</link>)
2431 with which the VM can be paused,
2432 stopped, snapshotted or other things.</para>
2433 </sect1>
2434
2435 <sect1 id="events">
2436 <title>VirtualBox events</title>
2437
2438 <para>In VirtualBox, "events" provide a uniform mechanism to register
2439 for and consume specific events. A VirtualBox client can register an
2440 "event listener" (represented by the
2441 <link linkend="IEventListener">IEventListener</link> interface), which
2442 will then get notified by the server when an event (represented by the
2443 <link linkend="IEvent">IEvent</link> interface) happens.</para>
2444
2445 <para>The IEvent interface is an abstract parent interface for all
2446 events that can occur in VirtualBox. The actual events that the server
2447 sends out belong to one of the specific subclasses, for example
2448 <link linkend="IMachineStateChangedEvent">IMachineStateChangedEvent</link>
2449 or
2450 <link linkend="IMediumChangedEvent">IMediumChangedEvent</link>.</para>
2451
2452 <para>As an example, the VirtualBox GUI waits for machine events so it can
2453 update its display when the machine state changes or machine settings are
2454 modified, even if this happens in another client. This is how the GUI can
2455 automatically refresh its display even if you manipulate a machine from
2456 a different client such as VBoxManage.</para>
2457
2458 <para>To register an event listener to listen for events, you would use code
2459 similar to the following:<screen>EventSource es = console.getEventSource();
2460IEventListener listener = es.createListener();
2461VBoxEventType aTypes[] = (VBoxEventType.OnMachineStateChanged);
2462 // list of event types to listen for
2463es.registerListener(listener, aTypes, false /* active */);
2464 // register passive listener
2465IEvent ev = es.getEvent(listener, 1000);
2466 // wait up to one second for event to happen
2467if (ev != null)
2468{
2469 // downcast to specific event interface (in this case we have only registered
2470 // for one type, otherwise IEvent::type would tell us)
2471 IMachineStateChangedEvent mcse = IMachineStateChangedEvent.queryInterface(ev);
2472 ... // inspect and do something
2473 es.eventProcessed(listener, ev);
2474}
2475...
2476es.unregisterListener(listener); </screen></para>
2477
2478 <para>A graphical user interface application would most likely want to start
2479 its own thread to wait for events and then process these in a loop.</para>
2480
2481 <para>The events mechanism was introduced with VirtualBox 3.3 and
2482 replaces various callback interfaces which were called for each event in
2483 the interface. The callback mechanism was not compatible with scripting
2484 languages, local Java bindings, and remote web services as they do not
2485 support callbacks. The new mechanism with events and event listeners
2486 works with all of these.</para>
2487
2488 <para>To simplify development of applications using events, the concept of
2489 an event aggregator was introduced. Essentially it's a mechanism to
2490 aggregate multiple event sources into one single event source, and then work
2491 with this single aggregated event source instead of the original sources. As
2492 an example, one can try out the VirtualBox Python shell's
2493 <computeroutput>recordDemo</computeroutput> option which records mouse and
2494 keyboard events using an event aggregator and displays them as separate event
2495 sources. The VirtualBox Python shell (vboxshell.py) is shipped with the SDK.
2496 The <computeroutput>recordDemo</computeroutput> code is essentially:<screen>
2497 listener = console.eventSource.createListener()
2498 agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource])
2499 agg.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], False)
2500 registered = True
2501 end = time.time() + dur
2502 while time.time() &lt; end:
2503 ev = agg.getEvent(listener, 1000)
2504 processEent(ev)
2505 agg.unregisterListener(listener)</screen> Without using aggregators
2506 consumers would have to either poll on both sources or start multiple
2507 threads to block on those sources.</para>
2508 </sect1>
2509 </chapter>
2510
2511 <chapter id="vboxshell">
2512 <title>The VirtualBox shell</title>
2513
2514 <para>VirtualBox comes with an extensible shell which allows you to
2515 control your virtual machines from the command line. It is also a
2516 non-trivial example of how to use the VirtualBox APIs from Python for all
2517 three styles of the API (COM/XPCOM/WS).</para>
2518
2519 <para>You can easily extend this shell with your own commands. Simply create
2520 a subdirectory named
2521 <computeroutput>.config/VirtualBox/shexts</computeroutput> in your home
2522 directory (<computeroutput>.VirtualBox/shexts</computeroutput>
2523 on Windows systems and
2524 <computeroutput>Library/VirtualBox/shexts</computeroutput> on macOS systems)
2525 and put a Python file implementing your shell extension commands in this
2526 directory. This file must have an array named
2527 <computeroutput>commands</computeroutput> which contains your command
2528 definitions: <screen>
2529 commands = {
2530 'cmd1': ['Command cmd1 help', cmd1],
2531 'cmd2': ['Command cmd2 help', cmd2]
2532 }
2533 </screen> For example, to create a command for creating hard drive
2534 images, the following code can be used: <screen>
2535 def createHdd(ctx,args):
2536 # Show some meaningful error message on wrong input
2537 if (len(args) &lt; 3):
2538 print "usage: createHdd sizeM location type"
2539 return 0
2540
2541 # Get arguments
2542 size = int(args[1])
2543 loc = args[2]
2544 if len(args) &gt; 3:
2545 format = args[3]
2546 else:
2547 # And provide some meaningful defaults
2548 format = "vdi"
2549
2550 # Call VirtualBox API, using context's fields
2551 hdd = ctx['vb'].createMedium(format, loc, ctx['global'].constants.AccessMode_ReadWrite, \
2552 ctx['global'].constants.DeviceType_HardDisk)
2553 # Access constants using ctx['global'].constants
2554 progress = hdd.createBaseStorage(size, (ctx['global'].constants.MediumVariant_Standard, ))
2555 # use standard progress bar mechanism
2556 ctx['progressBar'](progress)
2557
2558
2559 # Report errors
2560 if not hdd.id:
2561 print "cannot create disk (file %s exist?)" %(loc)
2562 return 0
2563
2564 # Give user some feedback on success too
2565 print "created HDD with id: %s" %(hdd.id)
2566
2567 # 0 means continue execution, other values mean exit from the interpreter
2568 return 0
2569
2570 commands = {
2571 'myCreateHDD': ['Create virtual HDD, createHdd size location type', createHdd]
2572 }
2573 </screen> Just store the above text in a file named
2574 <computeroutput>createHdd</computeroutput> (or any other meaningful name)
2575 in the <computeroutput>shexts</computeroutput> directory located as
2576 described above and then start the VirtualBox shell or just issue the
2577 <computeroutput>reloadExts</computeroutput> command if the shell is
2578 already running. Your new command will now be available.</para>
2579 </chapter>
2580
2581 <xi:include href="SDKRef_apiref.xml" xpointer="xpointer(/book/*)"
2582 xmlns:xi="http://www.w3.org/2001/XInclude" />
2583
2584 <chapter id="cloud">
2585 <title>Working with the Cloud</title>
2586
2587 <para>VirtualBox supports and goes towards the Oracle tendencies like "move to the Cloud".</para>
2588
2589 <sect1>
2590 <title>OCI features</title>
2591 <para>VirtualBox supports the Oracle Cloud Infrastructure (OCI). See the interfaces:
2592 <link linkend="ICloudClient">ICloudClient</link>,
2593 <link linkend="ICloudProvider">ICloudProvider</link>,
2594 <link linkend="ICloudProfile">ICloudProfile</link>,
2595 <link linkend="ICloudProviderManager">ICloudProviderManager</link>.
2596 </para>
2597 <para>Each cloud interface has own implementation to support OCI features. There are everal functions in the implementation
2598 which should be explained in details because OCI requires some special data or settings.
2599 </para>
2600 <para>
2601 Also see the enumeration <link linkend="VirtualSystemDescriptionType">VirtualSystemDescriptionType</link> for the possible values.
2602 </para>
2603 </sect1>
2604
2605 <sect1>
2606 <title>Function ICloudClient::exportVM</title>
2607 <para>
2608 See the <link linkend="ICloudClient__exportVM">ICloudClient::exportVM</link>.
2609 The function exports an existing virtual machine into OCI. The final result of this operation is creation a custom image
2610 from the bootable image of VM. The Id of created image is returned in the parameter "description" (which is
2611 <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>) as an entry with the type
2612 VirtualSystemDescriptionType::CloudImageId. The standard steps here are:
2613 <itemizedlist>
2614 <listitem>
2615 <para>Upload VBox image to OCI Object Storage.</para>
2616 </listitem>
2617 <listitem>
2618 <para>Create OCI custom image from the uploaded object.</para>
2619 </listitem>
2620 </itemizedlist>
2621 Parameter "description" must contain all information and settings needed for creation a custom image in OCI.
2622 At least next entries must be presented there before the call:
2623 <itemizedlist>
2624 <listitem>
2625 <para>VirtualSystemDescriptionType::Name - Name of new instance in OCI.</para>
2626 </listitem>
2627 <listitem>
2628 <para>VirtualSystemDescriptionType::HardDiskImage - The local path or id of bootable VM image.</para>
2629 </listitem>
2630 <listitem>
2631 <para>VirtualSystemDescriptionType::CloudBucket - A cloud bucket name where the exported image is uploaded.</para>
2632 </listitem>
2633 <listitem>
2634 <para>VirtualSystemDescriptionType::CloudImageDisplayName - A name which is assigned to a new custom image in the OCI.</para>
2635 </listitem>
2636 <listitem>
2637 <para>VirtualSystemDescriptionType::CloudKeepObject - Whether keep or delete an uploaded object after its usage.</para>
2638 </listitem>
2639 <listitem>
2640 <para>VirtualSystemDescriptionType::CloudLaunchInstance - Whether launch or not a new instance.</para>
2641 </listitem>
2642 </itemizedlist>
2643 </para>
2644 </sect1>
2645
2646 <sect1>
2647 <title>Function ICloudClient::launchVM</title>
2648 <para>
2649 See the <link linkend="ICloudClient__launchVM">ICloudClient::launchVM</link>.
2650 The function launches a new instance in OCI with a bootable volume previously created from a custom image in OCI or
2651 as the source may be used an existing bootable volume which shouldn't be attached to any instance.
2652 For launching instance from a custom image use the parameter VirtualSystemDescriptionType::CloudImageId.
2653 For launching instance from a bootable volume use the parameter VirtualSystemDescriptionType::CloudBootVolumeId.
2654 Only one of them must be presented otherwise the error will occur.
2655 The final result of this operation is a running instance. The id of created instance is returned
2656 in the parameter "description" (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
2657 as an entry with the type VirtualSystemDescriptionType::CloudInstanceId. Parameter "description" must contain all information
2658 and settings needed for creation a new instance in OCI. At least next entries must be presented there before the call:
2659 <itemizedlist>
2660 <listitem>
2661 <para>VirtualSystemDescriptionType::Name - Name of new instance in OCI.</para>
2662 </listitem>
2663 <listitem>
2664 <para>VirtualSystemDescriptionType::CloudOCISubnet - OCID of existing subnet in OCI which will be used by the instance.</para>
2665 </listitem>
2666 <listitem>
2667 <para>
2668 Use VirtualSystemDescriptionType::CloudImageId - OCID of custom image used as a bootable image for the instance
2669 or
2670 VirtualSystemDescriptionType::CloudBootVolumeId - OCID of existing and non-attached bootable volume used as a bootable volume for the instance.
2671 </para>
2672 </listitem>
2673 <listitem>
2674 <para>Add VirtualSystemDescriptionType::CloudBootDiskSize - The size of instance bootable volume in GB,
2675 If you use VirtualSystemDescriptionType::CloudImageId.</para>
2676 </listitem>
2677 <listitem>
2678 <para>VirtualSystemDescriptionType::CloudInstanceShape - The shape of instance according to OCI documentation,
2679 defines the number of CPUs and RAM memory.</para>
2680 </listitem>
2681 <listitem>
2682 <para>VirtualSystemDescriptionType::CloudLaunchInstance - Whether launch or not a new instance.</para>
2683 </listitem>
2684 <listitem>
2685 <para>VirtualSystemDescriptionType::CloudDomain - Availability domain in OCI where new instance is created.</para>
2686 </listitem>
2687 <listitem>
2688 <para>VirtualSystemDescriptionType::CloudPublicIP - Whether the instance will have a public IP or not.</para>
2689 </listitem>
2690 <listitem>
2691 <para>VirtualSystemDescriptionType::CloudPublicSSHKey - Public SSH key which is used to connect to an instance via SSH.
2692 It may be one or more records with the type VirtualSystemDescriptionType::CloudPublicSSHKey in the VirtualSystemDescription.
2693 But at least one should be presented otherwise user won't be able to connect to the instance via SSH.
2694 </para>
2695 </listitem>
2696 </itemizedlist>
2697 </para>
2698 </sect1>
2699
2700 <sect1>
2701 <title>Function ICloudClient::getInstanceInfo</title>
2702 <para>
2703 See the <link linkend="ICloudClient__getInstanceInfo">ICloudClient::getInstanceInfo</link>.
2704 The function takes an instance id (parameter "uid"), finds the requested instance in OCI and gets back information
2705 about the found instance in the parameter "description" (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
2706 The entries with next types will be presented in the object:
2707 <itemizedlist>
2708 <listitem>
2709 <para>VirtualSystemDescriptionType::Name - Displayed name of the instance.</para>
2710 </listitem>
2711 <listitem>
2712 <para>VirtualSystemDescriptionType::CloudDomain - Availability domain in OCI.</para>
2713 </listitem>
2714 <listitem>
2715 <para>VirtualSystemDescriptionType::CloudImageId - Name of custom image used for creation this instance.</para>
2716 </listitem>
2717 <listitem>
2718 <para>VirtualSystemDescriptionType::CloudInstanceId - The OCID of the instance.</para>
2719 </listitem>
2720 <listitem>
2721 <para>VirtualSystemDescriptionType::OS - Guest OS type of the instance.</para>
2722 </listitem>
2723 <listitem>
2724 <para>VirtualSystemDescriptionType::CloudBootDiskSize - Size of instance bootable image.</para>
2725 </listitem>
2726 <listitem>
2727 <para>VirtualSystemDescriptionType::CloudInstanceState - The instance state according to OCI documentation.</para>
2728 </listitem>
2729 <listitem>
2730 <para>VirtualSystemDescriptionType::CloudInstanceShape - The instance shape according to OCI documentation</para>
2731 </listitem>
2732 <listitem>
2733 <para>VirtualSystemDescriptionType::Memory - RAM memory in GB allocated for the instance.</para>
2734 </listitem>
2735 <listitem>
2736 <para>VirtualSystemDescriptionType::CPU - Number of virtual CPUs allocated for the instance.</para>
2737 </listitem>
2738 </itemizedlist>
2739 </para>
2740 </sect1>
2741
2742 <sect1>
2743 <title>Function ICloudClient::importInstance</title>
2744 <para>
2745 See the <link linkend="ICloudClient__importInstance">ICloudClient::importInstance</link>.
2746 The API function imports an existing instance from the OCI to the local host.
2747 The standard steps here are:
2748 <itemizedlist>
2749 <listitem>
2750 <para>Create a custom image from an existing OCI instance.</para>
2751 </listitem>
2752 <listitem>
2753 <para>Export the custom image to OCI object (the object is created in the OCI Object Storage).</para>
2754 </listitem>
2755 <listitem>
2756 <para>Download the OCI object to the local host.</para>
2757 </listitem>
2758 </itemizedlist>
2759 As the result of operation user will have a file with the suffix ".oci" on the local host. This file is a TAR archive which
2760 contains a bootable instance image in QCOW2 format and a JSON file with some metadata related to
2761 the imported instance. The function takes the parameter "description"
2762 (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
2763 Parameter "description" must contain all information and settings needed for successful operation result.
2764 At least next entries must be presented there before the call:
2765 <itemizedlist>
2766 <listitem>
2767 <para>VirtualSystemDescriptionType::Name is used for the several purposes:
2768 <itemizedlist>
2769 <listitem>
2770 <para>As a custom image name. A custom image is created from an instance.</para>
2771 </listitem>
2772 <listitem>
2773 <para>As OCI object name. An object is a file in OCI Object Storage. The object is created from the custom image.</para>
2774 </listitem>
2775 <listitem>
2776 <para>Name of imported instance on the local host. Because the result of import is a file, the file will have this
2777 name and extension ".oci".</para>
2778 </listitem>
2779 </itemizedlist>
2780 </para>
2781 </listitem>
2782 <listitem>
2783 <para>VirtualSystemDescriptionType::CloudInstanceId - The OCID of the existing instance.</para>
2784 </listitem>
2785 <listitem>
2786 <para>VirtualSystemDescriptionType::CloudBucket - a cloud bucket name in OCI Object Storage where created an OCI object
2787 from a custom image.
2788 </para>
2789 </listitem>
2790 </itemizedlist>
2791 </para>
2792 </sect1>
2793
2794 </chapter>
2795
2796 <chapter id="hgcm">
2797 <title>Host-Guest Communication Manager</title>
2798
2799 <para>The VirtualBox Host-Guest Communication Manager (HGCM) allows a
2800 guest application or a guest driver to call a host shared library. The
2801 following features of VirtualBox are implemented using HGCM: <itemizedlist>
2802 <listitem>
2803 <para>Shared Folders</para>
2804 </listitem>
2805
2806 <listitem>
2807 <para>Shared Clipboard</para>
2808 </listitem>
2809
2810 <listitem>
2811 <para>Guest configuration interface</para>
2812 </listitem>
2813 </itemizedlist></para>
2814
2815 <para>The shared library on the host contains a so called HGCM service.
2816 The guest HGCM client establishes a connection to the HGCM service on the
2817 host in order to call that HGCM service's entry point. When calling an
2818 HGCM service the client supplies a function code, the number of parameters
2819 for the function, and an array of the parameter arguments.</para>
2820
2821 <sect1>
2822 <title>Virtual hardware implementation</title>
2823
2824 <para>HGCM uses the Virtual Machine Monitor (VMM) virtual PCI device to
2825 exchange data between the guest and the host. The guest always acts as an
2826 initiator of requests. A request is constructed in the guest's physical
2827 memory which must be locked by the guest. The physical address is passed
2828 to the VMM device using a 32-bit
2829 <computeroutput>out edx, eax</computeroutput>
2830 instruction. The physical memory must be allocated below 4GB on 64-bit
2831 guests.</para>
2832
2833 <para>The host parses the request header and data and queues the request
2834 for the corresponding host HGCM service type. The guest continues
2835 execution and usually waits on an HGCM event semaphore.</para>
2836
2837 <para>When the request has been processed by the HGCM service, the VMM
2838 device sets the completion flag in the request header, sets the HGCM
2839 event and raises an IRQ for the guest. The IRQ handler signals the HGCM
2840 event semaphore and all HGCM callers check the completion flag in the
2841 corresponding request header. If the flag is set, the request is
2842 considered completed.</para>
2843 </sect1>
2844
2845 <sect1>
2846 <title>Protocol specification</title>
2847
2848 <para>The HGCM protocol definitions are contained in the
2849 <computeroutput>VBox/VBoxGuest.h</computeroutput> header file.</para>
2850
2851 <sect2>
2852 <title>Request header</title>
2853
2854 <para>HGCM request structures contains a generic header
2855 (VMMDevHGCMRequestHeader): <table>
2856 <title>HGCM Request Generic Header</title>
2857
2858 <tgroup cols="2">
2859 <tbody>
2860 <row>
2861 <entry><emphasis role="bold">Name</emphasis></entry>
2862
2863 <entry><emphasis role="bold">Description</emphasis></entry>
2864 </row>
2865
2866 <row>
2867 <entry>size</entry>
2868
2869 <entry>Size of the entire request.</entry>
2870 </row>
2871
2872 <row>
2873 <entry>version</entry>
2874
2875 <entry>Version of the header, must be set to
2876 <computeroutput>0x10001</computeroutput>.</entry>
2877 </row>
2878
2879 <row>
2880 <entry>type</entry>
2881
2882 <entry>Type of the request.</entry>
2883 </row>
2884
2885 <row>
2886 <entry>rc</entry>
2887
2888 <entry>HGCM return code, which will be set by the VMM
2889 device.</entry>
2890 </row>
2891
2892 <row>
2893 <entry>reserved1</entry>
2894
2895 <entry>A reserved field 1.</entry>
2896 </row>
2897
2898 <row>
2899 <entry>reserved2</entry>
2900
2901 <entry>A reserved field 2.</entry>
2902 </row>
2903
2904 <row>
2905 <entry>flags</entry>
2906
2907 <entry>HGCM flags, set by the VMM device.</entry>
2908 </row>
2909
2910 <row>
2911 <entry>result</entry>
2912
2913 <entry>The HGCM result code, set by the VMM device.</entry>
2914 </row>
2915 </tbody>
2916 </tgroup>
2917 </table> <note>
2918 <itemizedlist>
2919 <listitem>
2920 <para>All fields are 32-bit.</para>
2921 </listitem>
2922
2923 <listitem>
2924 <para>Fields from <computeroutput>size</computeroutput> to
2925 <computeroutput>reserved2</computeroutput> are a standard VMM
2926 device request header, which is used for other interfaces as
2927 well.</para>
2928 </listitem>
2929 </itemizedlist>
2930 </note></para>
2931
2932 <para>The <emphasis role="bold">type</emphasis> field indicates the
2933 type of the HGCM request: <table>
2934 <title>Request Types</title>
2935
2936 <tgroup cols="2">
2937 <tbody>
2938 <row>
2939 <entry><emphasis role="bold">Name (decimal
2940 value)</emphasis></entry>
2941
2942 <entry><emphasis role="bold">Description</emphasis></entry>
2943 </row>
2944
2945 <row>
2946 <entry>VMMDevReq_HGCMConnect
2947 (<computeroutput>60</computeroutput>)</entry>
2948
2949 <entry>Connect to an HGCM service.</entry>
2950 </row>
2951
2952 <row>
2953 <entry>VMMDevReq_HGCMDisconnect
2954 (<computeroutput>61</computeroutput>)</entry>
2955
2956 <entry>Disconnect from the service.</entry>
2957 </row>
2958
2959 <row>
2960 <entry>VMMDevReq_HGCMCall32
2961 (<computeroutput>62</computeroutput>)</entry>
2962
2963 <entry>Call an HGCM function using the 32-bit
2964 interface.</entry>
2965 </row>
2966
2967 <row>
2968 <entry>VMMDevReq_HGCMCall64
2969 (<computeroutput>63</computeroutput>)</entry>
2970
2971 <entry>Call an HGCM function using the 64-bit
2972 interface.</entry>
2973 </row>
2974
2975 <row>
2976 <entry>VMMDevReq_HGCMCancel
2977 (<computeroutput>64</computeroutput>)</entry>
2978
2979 <entry>Cancel an HGCM request currently being processed by a
2980 host HGCM service.</entry>
2981 </row>
2982 </tbody>
2983 </tgroup>
2984 </table></para>
2985
2986 <para>The <emphasis role="bold">flags</emphasis> field may contain:
2987 <table>
2988 <title>Flags</title>
2989
2990 <tgroup cols="2">
2991 <tbody>
2992 <row>
2993 <entry><emphasis role="bold">Name (hexadecimal
2994 value)</emphasis></entry>
2995
2996 <entry><emphasis role="bold">Description</emphasis></entry>
2997 </row>
2998
2999 <row>
3000 <entry>VBOX_HGCM_REQ_DONE
3001 (<computeroutput>0x00000001</computeroutput>)</entry>
3002
3003 <entry>The request has been processed by the host
3004 service.</entry>
3005 </row>
3006
3007 <row>
3008 <entry>VBOX_HGCM_REQ_CANCELLED
3009 (<computeroutput>0x00000002</computeroutput>)</entry>
3010
3011 <entry>This request was cancelled.</entry>
3012 </row>
3013 </tbody>
3014 </tgroup>
3015 </table></para>
3016 </sect2>
3017
3018 <sect2>
3019 <title>Connect</title>
3020
3021 <para>The connection request must be issued by the guest HGCM client
3022 before it can call the HGCM service (VMMDevHGCMConnect): <table>
3023 <title>Connect request</title>
3024
3025 <tgroup cols="2">
3026 <tbody>
3027 <row>
3028 <entry><emphasis role="bold">Name</emphasis></entry>
3029
3030 <entry><emphasis role="bold">Description</emphasis></entry>
3031 </row>
3032
3033 <row>
3034 <entry>header</entry>
3035
3036 <entry>The generic HGCM request header with type equal to
3037 VMMDevReq_HGCMConnect
3038 (<computeroutput>60</computeroutput>).</entry>
3039 </row>
3040
3041 <row>
3042 <entry>type</entry>
3043
3044 <entry>The type of the service location information (32
3045 bit).</entry>
3046 </row>
3047
3048 <row>
3049 <entry>location</entry>
3050
3051 <entry>The service location information (128 bytes).</entry>
3052 </row>
3053
3054 <row>
3055 <entry>clientId</entry>
3056
3057 <entry>The client identifier assigned to the connecting
3058 client by the HGCM subsystem (32-bit).</entry>
3059 </row>
3060 </tbody>
3061 </tgroup>
3062 </table> The <emphasis role="bold">type</emphasis> field tells the
3063 HGCM how to look for the requested service: <table>
3064 <title>Location Information Types</title>
3065
3066 <tgroup cols="2">
3067 <tbody>
3068 <row>
3069 <entry><emphasis role="bold">Name (hexadecimal
3070 value)</emphasis></entry>
3071
3072 <entry><emphasis role="bold">Description</emphasis></entry>
3073 </row>
3074
3075 <row>
3076 <entry>VMMDevHGCMLoc_LocalHost
3077 (<computeroutput>0x1</computeroutput>)</entry>
3078
3079 <entry>The requested service is a shared library located on
3080 the host and the location information contains the library
3081 name.</entry>
3082 </row>
3083
3084 <row>
3085 <entry>VMMDevHGCMLoc_LocalHost_Existing
3086 (<computeroutput>0x2</computeroutput>)</entry>
3087
3088 <entry>The requested service is a preloaded one and the
3089 location information contains the service name.</entry>
3090 </row>
3091 </tbody>
3092 </tgroup>
3093 </table> <note>
3094 <para>Currently preloaded HGCM services are hard-coded in
3095 VirtualBox: <itemizedlist>
3096 <listitem>
3097 <para>VBoxSharedFolders</para>
3098 </listitem>
3099
3100 <listitem>
3101 <para>VBoxSharedClipboard</para>
3102 </listitem>
3103
3104 <listitem>
3105 <para>VBoxGuestPropSvc</para>
3106 </listitem>
3107
3108 <listitem>
3109 <para>VBoxSharedOpenGL</para>
3110 </listitem>
3111 </itemizedlist></para>
3112 </note> There is no difference between both types of HGCM services,
3113 only the location mechanism is different.</para>
3114
3115 <para>The client identifier is returned by the host and must be used
3116 in all subsequent requests by the client.</para>
3117 </sect2>
3118
3119 <sect2>
3120 <title>Disconnect</title>
3121
3122 <para>This request disconnects the client and makes the client
3123 identifier invalid (VMMDevHGCMDisconnect): <table>
3124 <title>Disconnect request</title>
3125
3126 <tgroup cols="2">
3127 <tbody>
3128 <row>
3129 <entry><emphasis role="bold">Name</emphasis></entry>
3130
3131 <entry><emphasis role="bold">Description</emphasis></entry>
3132 </row>
3133
3134 <row>
3135 <entry>header</entry>
3136
3137 <entry>The generic HGCM request header with type equal to
3138 VMMDevReq_HGCMDisconnect
3139 (<computeroutput>61</computeroutput>).</entry>
3140 </row>
3141
3142 <row>
3143 <entry>clientId</entry>
3144
3145 <entry>The client identifier previously returned by the
3146 connect request (32-bit).</entry>
3147 </row>
3148 </tbody>
3149 </tgroup>
3150 </table></para>
3151 </sect2>
3152
3153 <sect2>
3154 <title>Call32 and Call64</title>
3155
3156 <para>Calls the HGCM service entry point (VMMDevHGCMCall) using 32-bit
3157 or 64-bit addresses: <table>
3158 <title>Call request</title>
3159
3160 <tgroup cols="2">
3161 <tbody>
3162 <row>
3163 <entry><emphasis role="bold">Name</emphasis></entry>
3164
3165 <entry><emphasis role="bold">Description</emphasis></entry>
3166 </row>
3167
3168 <row>
3169 <entry>header</entry>
3170
3171 <entry>The generic HGCM request header with type equal to
3172 either VMMDevReq_HGCMCall32
3173 (<computeroutput>62</computeroutput>) or
3174 VMMDevReq_HGCMCall64
3175 (<computeroutput>63</computeroutput>).</entry>
3176 </row>
3177
3178 <row>
3179 <entry>clientId</entry>
3180
3181 <entry>The client identifier previously returned by the
3182 connect request (32-bit).</entry>
3183 </row>
3184
3185 <row>
3186 <entry>function</entry>
3187
3188 <entry>The function code to be processed by the service (32
3189 bit).</entry>
3190 </row>
3191
3192 <row>
3193 <entry>cParms</entry>
3194
3195 <entry>The number of following parameters (32-bit). This
3196 value is 0 if the function requires no parameters.</entry>
3197 </row>
3198
3199 <row>
3200 <entry>parms</entry>
3201
3202 <entry>An array of parameter description structures
3203 (HGCMFunctionParameter32 or
3204 HGCMFunctionParameter64).</entry>
3205 </row>
3206 </tbody>
3207 </tgroup>
3208 </table></para>
3209
3210 <para>The 32-bit parameter description (HGCMFunctionParameter32)
3211 consists of a 32-bit type field and 8 bytes of an opaque value, so 12
3212 bytes in total. The 64-bit variant (HGCMFunctionParameter64) consists
3213 of the 32-bit type and 12 bytes of a value, so 16 bytes in total.</para>
3214
3215 <para><table>
3216 <title>Parameter types</title>
3217
3218 <tgroup cols="2">
3219 <tbody>
3220 <row>
3221 <entry><emphasis role="bold">Type</emphasis></entry>
3222
3223 <entry><emphasis role="bold">Format of the
3224 value</emphasis></entry>
3225 </row>
3226
3227 <row>
3228 <entry>VMMDevHGCMParmType_32bit (1)</entry>
3229
3230 <entry>A 32-bit value.</entry>
3231 </row>
3232
3233 <row>
3234 <entry>VMMDevHGCMParmType_64bit (2)</entry>
3235
3236 <entry>A 64-bit value.</entry>
3237 </row>
3238
3239 <row>
3240 <entry>VMMDevHGCMParmType_PhysAddr (3)</entry>
3241
3242 <entry>A 32-bit size followed by a 32-bit or 64-bit guest
3243 physical address.</entry>
3244 </row>
3245
3246 <row>
3247 <entry>VMMDevHGCMParmType_LinAddr (4)</entry>
3248
3249 <entry>A 32-bit size followed by a 32-bit or 64-bit guest
3250 linear address. The buffer is used both for guest to host
3251 and for host to guest data.</entry>
3252 </row>
3253
3254 <row>
3255 <entry>VMMDevHGCMParmType_LinAddr_In (5)</entry>
3256
3257 <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
3258 used only for host to guest data.</entry>
3259 </row>
3260
3261 <row>
3262 <entry>VMMDevHGCMParmType_LinAddr_Out (6)</entry>
3263
3264 <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
3265 used only for guest to host data.</entry>
3266 </row>
3267
3268 <row>
3269 <entry>VMMDevHGCMParmType_LinAddr_Locked (7)</entry>
3270
3271 <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
3272 already locked by the guest.</entry>
3273 </row>
3274
3275 <row>
3276 <entry>VMMDevHGCMParmType_LinAddr_Locked_In (1)</entry>
3277
3278 <entry>Same as VMMDevHGCMParmType_LinAddr_In but the buffer
3279 is already locked by the guest.</entry>
3280 </row>
3281
3282 <row>
3283 <entry>VMMDevHGCMParmType_LinAddr_Locked_Out (1)</entry>
3284
3285 <entry>Same as VMMDevHGCMParmType_LinAddr_Out but the buffer
3286 is already locked by the guest.</entry>
3287 </row>
3288 </tbody>
3289 </tgroup>
3290 </table></para>
3291
3292 </sect2>
3293
3294 <sect2>
3295 <title>Cancel</title>
3296
3297 <para>This request cancels a call request (VMMDevHGCMCancel): <table>
3298 <title>Cancel request</title>
3299
3300 <tgroup cols="2">
3301 <tbody>
3302 <row>
3303 <entry><emphasis role="bold">Name</emphasis></entry>
3304
3305 <entry><emphasis role="bold">Description</emphasis></entry>
3306 </row>
3307
3308 <row>
3309 <entry>header</entry>
3310
3311 <entry>The generic HGCM request header with type equal to
3312 VMMDevReq_HGCMCancel
3313 (<computeroutput>64</computeroutput>).</entry>
3314 </row>
3315 </tbody>
3316 </tgroup>
3317 </table></para>
3318 </sect2>
3319 </sect1>
3320
3321 <sect1>
3322 <title>Guest software interface</title>
3323
3324 <para>Guest HGCM clients can call HGCM services from both drivers
3325 and applications.</para>
3326
3327 <sect2>
3328 <title>The guest driver interface</title>
3329
3330 <para>The driver interface is implemented in the VirtualBox guest
3331 additions driver (VBoxGuest) which works with the VMM virtual device.
3332 Drivers must use the VBox Guest Library (VBGL) which provides an API
3333 for HGCM clients (<computeroutput>VBox/VBoxGuestLib.h</computeroutput>
3334 and <computeroutput>VBox/VBoxGuest.h</computeroutput>). The key VBGL API
3335 routines are as follows:</para>
3336
3337 <para><screen>
3338DECLR0VBGL(int) VbglR0HGCMConnect(VBGLHGCMHANDLE *pHandle, const char *pszServiceName, HGCMCLIENTID *pidClient);
3339 </screen> VbglR0HGCMConnect() connects to the HGCM service on the host. An
3340 example of a guest driver connecting to the VirtualBox Shared Folder
3341 HGCM service follows:<screen>
3342 VBoxGuestHGCMConnectInfo data;
3343
3344 memset(&amp;data, sizeof(VBoxGuestHGCMConnectInfo));
3345
3346 data.result = VINF_SUCCESS;
3347 data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
3348 strcpy(data.Loc.u.host.achName, "VBoxSharedFolders");
3349
3350 rc = VbglR0HGCMConnect(&amp;handle, "VBoxSharedFolders"&amp;, data);
3351
3352 if (RT_SUCCESS(rc))
3353 {
3354 rc = data.result;
3355 }
3356
3357 if (RT_SUCCESS(rc))
3358 {
3359 /* Get the assigned client identifier. */
3360 ulClientID = data.u32ClientID;
3361 }
3362 </screen></para>
3363
3364 <para><screen>
3365DECLVBGL(int) VbglR0HGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
3366 </screen> VbglR0HGCMDisconnect() disconnects from the HGCM service on the
3367 host. An example of a guest driver disconnecting from an HGCM service
3368 using the client identifier from an earlier call to VbglR0HGCMConnect()
3369 follows:<screen>
3370 VBoxGuestHGCMDisconnectInfo data;
3371
3372 RtlZeroMemory(&amp;data, sizeof (VBoxGuestHGCMDisconnectInfo));
3373
3374 data.result = VINF_SUCCESS;
3375 data.u32ClientID = ulClientID;
3376
3377 rc = VbglR0HGCMDisconnect(handle, &amp;data);
3378 </screen></para>
3379
3380 <para><screen>
3381DECLVBGL(int) VbglR0HGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
3382 </screen> VbglR0HGCMCall() calls a function specified in the
3383 VBoxGuestHGCMCallInfo argument in the HGCM service on the host. An
3384 example of a guest driver calling the Shared Folders HGCM service to
3385 issue a read of an object in a shared folder follows:<screen>
3386typedef struct _VBoxSFRead
3387{
3388 VBoxGuestHGCMCallInfo callInfo;
3389
3390 /** pointer, in: SHFLROOT
3391 * Root handle of the mapping which name is queried.
3392 */
3393 HGCMFunctionParameter root;
3394
3395 /** value64, in:
3396 * SHFLHANDLE of object to read from.
3397 */
3398 HGCMFunctionParameter handle;
3399
3400 /** value64, in:
3401 * Offset to read from.
3402 */
3403 HGCMFunctionParameter offset;
3404
3405 /** value64, in/out:
3406 * Bytes to read/How many were read.
3407 */
3408 HGCMFunctionParameter cb;
3409
3410 /** pointer, out:
3411 * Buffer to place data to.
3412 */
3413 HGCMFunctionParameter buffer;
3414
3415} VBoxSFRead;
3416
3417/** Number of parameters */
3418#define SHFL_CPARMS_READ (5)
3419
3420...
3421
3422 VBoxSFRead data;
3423
3424 /* The call information. */
3425 data.callInfo.result = VINF_SUCCESS; /* Will be returned by HGCM. */
3426 data.callInfo.u32ClientID = ulClientID; /* Client identifier. */
3427 data.callInfo.u32Function = SHFL_FN_READ; /* The function code. */
3428 data.callInfo.cParms = SHFL_CPARMS_READ; /* Number of parameters. */
3429
3430 /* Initialize parameters. */
3431 data.root.type = VMMDevHGCMParmType_32bit;
3432 data.root.u.value32 = pMap-&gt;root;
3433
3434 data.handle.type = VMMDevHGCMParmType_64bit;
3435 data.handle.u.value64 = hFile;
3436
3437 data.offset.type = VMMDevHGCMParmType_64bit;
3438 data.offset.u.value64 = offset;
3439
3440 data.cb.type = VMMDevHGCMParmType_32bit;
3441 data.cb.u.value32 = *pcbBuffer;
3442
3443 data.buffer.type = VMMDevHGCMParmType_LinAddr_Out;
3444 data.buffer.u.Pointer.size = *pcbBuffer;
3445 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
3446
3447 rc = VbglR0HGCMCall(handle, &amp;data.callInfo, sizeof (data));
3448
3449 if (RT_SUCCESS(rc))
3450 {
3451 rc = data.callInfo.result;
3452 *pcbBuffer = data.cb.u.value32; /* This is returned by the HGCM service. */
3453 }
3454 </screen></para>
3455 </sect2>
3456
3457 <sect2>
3458 <title>Guest application interface</title>
3459
3460 <para>Applications call the VirtualBox Guest Additions driver to
3461 utilize the HGCM interface. The following IOCTLs correspond to the
3462 <computeroutput>VbglR0HGCM*</computeroutput> functions listed above:
3463 <itemizedlist>
3464 <listitem>
3465 <para><computeroutput>VBGL_IOCTL_HGCM_CONNECT =>
3466 VbglR0HGCMConnect()</computeroutput></para>
3467 </listitem>
3468
3469 <listitem>
3470 <para><computeroutput>VBGL_IOCTL_HGCM_DISCONNECT =>
3471 VbglR0HGCMDisconnect()</computeroutput></para>
3472 </listitem>
3473
3474 <listitem>
3475 <para><computeroutput>VBGL_IOCTL_HGCM_CALL =>
3476 VbglR0HGCMCall()</computeroutput></para>
3477 </listitem>
3478 </itemizedlist></para>
3479
3480 <para>These IOCTLs get the same input buffer as the
3481 <computeroutput>VbglR0HGCM*</computeroutput> functions and the output
3482 buffer has the same format as the input buffer. The same address can
3483 be used for both the input and output buffers.</para>
3484 </sect2>
3485 </sect1>
3486
3487 <sect1>
3488 <title>HGCM Service Implementation</title>
3489
3490 <para>The HGCM service is a shared library with a specific set of entry
3491 points. The library must export the
3492 <computeroutput>VBoxHGCMSvcLoad</computeroutput> entry point: <screen>
3493extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad(VBOXHGCMSVCFNTABLE *ptable)
3494 </screen></para>
3495
3496 <para>The service must check the
3497 <computeroutput>ptable-&gt;cbSize</computeroutput> and
3498 <computeroutput>ptable-&gt;u32Version</computeroutput> fields of the
3499 input structure and fill in the remaining fields with function pointers of
3500 service entry points (listed below) and the size of the required client
3501 buffer size.</para>
3502
3503 <para>The HGCM service gets a dedicated thread which calls service
3504 entry points synchronously, thus the service entry point will only be called
3505 again once a previous call has returned. However, the guest calls can be
3506 processed asynchronously. Therefore the service must call a completion
3507 callback when the operation is actually completed. The callback can be
3508 issued from another thread as well.</para>
3509
3510 <para>Service entry points are listed in the
3511 <computeroutput>VBox/hgcmsvc.h</computeroutput> in the
3512 <computeroutput>VBOXHGCMSVCFNTABLE</computeroutput> structure. <table>
3513 <title>Service entry points</title>
3514
3515 <tgroup cols="2">
3516 <tbody>
3517 <row>
3518 <entry><emphasis role="bold">Entry Point</emphasis></entry>
3519
3520 <entry><emphasis role="bold">Description</emphasis></entry>
3521 </row>
3522
3523 <row>
3524 <entry>int pfnUnload(void *pvService)</entry>
3525
3526 <entry>The service is being unloaded.</entry>
3527 </row>
3528
3529 <row>
3530 <entry>int pfnConnect(void *pvService, uint32_t u32ClientID, void *pvClient,
3531 uint32_t fRequestor, bool fRestoring)</entry>
3532
3533 <entry>A client <computeroutput>u32ClientID</computeroutput>
3534 is connected to the service. The
3535 <computeroutput>pvClient</computeroutput> parameter points to
3536 an allocated memory buffer which can be used by the service to
3537 store the client information.</entry>
3538 </row>
3539
3540 <row>
3541 <entry>int pfnDisconnect(void *pvService, uint32_t u32ClientID,
3542 void *pvClient)</entry>
3543
3544 <entry>A client is being disconnected.</entry>
3545 </row>
3546
3547 <row>
3548 <entry>void pfnCall(void *pvService, VBOXHGCMCALLHANDLE callHandle,
3549 uint32_t u32ClientID, void *pvClient, uint32_t function,
3550 uint32_t cParms, VBOXHGCMSVCPARM paParms[],
3551 uint64_t tsArrival)</entry>
3552
3553 <entry>A guest client calls a service function. The
3554 <computeroutput>callHandle</computeroutput> must be used in
3555 the VBOXHGCMSVCHELPERS::pfnCallComplete callback when the call
3556 has been processed.</entry>
3557 </row>
3558
3559 <row>
3560 <entry>int pfnHostCall(void *pvService, uint32_t function, uint32_t cParms,
3561 VBOXHGCMSVCPARM paParms[])</entry>
3562
3563 <entry>Called by the VirtualBox host components to perform
3564 functions which should be not accessible by the guest. Usually
3565 this entry point is used by VirtualBox to configure the
3566 service.</entry>
3567 </row>
3568
3569 <row>
3570 <entry>int pfnSaveState(void *pvService, uint32_t u32ClientID, void *pvClient,
3571 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM)</entry>
3572
3573 <entry>The VM state is being saved and the service must save
3574 relevant information using the SSM API
3575 (<computeroutput>VBox/ssm.h</computeroutput>).</entry>
3576 </row>
3577
3578 <row>
3579 <entry>int pfnLoadState(void *pvService, uint32_t u32ClientID, void *pvClient,
3580 PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion)</entry>
3581
3582 <entry>The VM is being restored from the saved state and the
3583 service must load the saved information and be able to
3584 continue operations from the saved state.</entry>
3585 </row>
3586 </tbody>
3587 </tgroup>
3588 </table></para>
3589 </sect1>
3590 </chapter>
3591
3592 <chapter id="rdpweb">
3593 <title>RDP Web Control</title>
3594
3595 <para>The VirtualBox <emphasis>RDP Web Control</emphasis> (RDPWeb)
3596 provides remote access to a running VM. RDPWeb is an RDP (Remote Desktop
3597 Protocol) client based on Flash technology and can be used from a Web
3598 browser with a Flash plugin.</para>
3599
3600 <sect1>
3601 <title>RDPWeb features</title>
3602
3603 <para>RDPWeb is embedded into a Web page and connects to a VRDP server
3604 in order to display the remote VM screen and pass keyboard and mouse events
3605 to the VM.</para>
3606 </sect1>
3607
3608 <sect1>
3609 <title>RDPWeb reference</title>
3610
3611 <para>RDPWeb consists of two required components:<itemizedlist>
3612 <listitem>
3613 <para>Flash movie file
3614 <computeroutput>RDPClientUI.swf</computeroutput></para>
3615 </listitem>
3616
3617 <listitem>
3618 <para>JavaScript helpers contained in
3619 <computeroutput>webclient.js</computeroutput></para>
3620 </listitem>
3621 </itemizedlist></para>
3622
3623 <para>The VirtualBox SDK contains sample HTML code
3624 including:<itemizedlist>
3625 <listitem>
3626 <para>A JavaScript library for embedding Flash content:
3627 <computeroutput>SWFObject.js</computeroutput></para>
3628 </listitem>
3629
3630 <listitem>
3631 <para>A sample HTML page:
3632 <computeroutput>webclient3.html</computeroutput></para>
3633 </listitem>
3634 </itemizedlist></para>
3635
3636 <sect2>
3637 <title>RDPWeb functions</title>
3638
3639 <para><computeroutput>RDPClientUI.swf</computeroutput> and
3640 <computeroutput>webclient.js</computeroutput> work together to provide the
3641 RDP Web Control functionality. The JavaScript code is responsible for
3642 proper Flash initialization, delivering mouse events to the Flash object,
3643 and processing resize requests from the Flash object. On the other hand,
3644 the SWF file contains a few JavaScript callable methods, which are used
3645 both from <computeroutput>webclient.js</computeroutput> and the user HTML
3646 page.</para>
3647
3648 <sect3>
3649 <title>JavaScript functions</title>
3650
3651 <para>The <computeroutput>webclient.js</computeroutput> file contains
3652 several helper JavaScript functions. In the following table ElementId
3653 refers to an HTML element name or attribute, and Element to the HTML
3654 element itself.
3655 The HTML code<programlisting>
3656 &lt;div id="FlashRDP"&gt;
3657 &lt;/div&gt;
3658</programlisting> would have ElementId equal to FlashRDP and Element equal to
3659 the div element.</para>
3660
3661 <para><itemizedlist>
3662 <listitem>
3663 <programlisting>RDPWebClient.embedSWF(SWFFileName, ElementId)</programlisting>
3664
3665 <para>Uses the open-source SWFObject library to replace the HTML
3666 element with the Flash movie.</para>
3667 </listitem>
3668
3669 <listitem>
3670 <programlisting>RDPWebClient.isRDPWebControlById(ElementId)</programlisting>
3671
3672 <para>Returns true if the given ElementId refers to an RDPWeb
3673 Flash element.</para>
3674 </listitem>
3675
3676 <listitem>
3677 <programlisting>RDPWebClient.isRDPWebControlByElement(Element)</programlisting>
3678
3679 <para>Returns true if the given Element is an RDPWeb Flash
3680 element.</para>
3681 </listitem>
3682
3683 <listitem>
3684 <programlisting>RDPWebClient.getFlashById(ElementId)</programlisting>
3685
3686 <para>Returns an element, which is referenced by the given
3687 ElementId. This function will try to resolve any element, even if
3688 it is not a Flash movie.</para>
3689 </listitem>
3690 </itemizedlist></para>
3691 </sect3>
3692
3693 <sect3>
3694 <title>Flash methods callable from JavaScript</title>
3695
3696 <para>The <computeroutput>RDPWebClienUI.swf</computeroutput> methods can
3697 be called directly from JavaScript code on an HTML page:</para>
3698
3699 <itemizedlist>
3700 <listitem>
3701 <para>getProperty(Name)</para>
3702 </listitem>
3703
3704 <listitem>
3705 <para>setProperty(Name)</para>
3706 </listitem>
3707
3708 <listitem>
3709 <para>connect()</para>
3710 </listitem>
3711
3712 <listitem>
3713 <para>disconnect()</para>
3714 </listitem>
3715
3716 <listitem>
3717 <para>keyboardSendCAD()</para>
3718 </listitem>
3719 </itemizedlist>
3720 </sect3>
3721
3722 <sect3>
3723 <title>Flash JavaScript callbacks</title>
3724
3725 <para><computeroutput>RDPWebClienUI.swf</computeroutput> calls
3726 JavaScript functions provided by the HTML page.</para>
3727 </sect3>
3728 </sect2>
3729
3730 <sect2>
3731 <title>Embedding RDPWeb in an HTML page</title>
3732
3733 <para>It is necessary to include the
3734 <computeroutput>webclient.js</computeroutput> helper script. If
3735 the SWFObject library is used, the
3736 <computeroutput>swfobject.js</computeroutput> must also be included.
3737 Using the SWFObject library allows RDPWeb flash content to be embedded in
3738 a Web page using dynamic HTML. The HTML must include a "placeholder",
3739 which consists of 2 <computeroutput>div</computeroutput> elements.</para>
3740 </sect2>
3741 </sect1>
3742
3743 <sect1>
3744 <title>RDPWeb change log</title>
3745
3746 <sect2>
3747 <title>Version 1.2.28</title>
3748
3749 <itemizedlist>
3750 <listitem>
3751 <para><computeroutput>keyboardLayout</computeroutput>,
3752 <computeroutput>keyboardLayouts</computeroutput>,
3753 <computeroutput>UUID</computeroutput> properties.</para>
3754 </listitem>
3755
3756 <listitem>
3757 <para>Support for German keyboard layout on the client.</para>
3758 </listitem>
3759
3760 <listitem>
3761 <para>Rebranding to Oracle.</para>
3762 </listitem>
3763 </itemizedlist>
3764 </sect2>
3765
3766 <sect2>
3767 <title>Version 1.1.26</title>
3768
3769 <itemizedlist>
3770 <listitem>
3771 <para><computeroutput>webclient.js</computeroutput> is a part of
3772 the distribution package.</para>
3773 </listitem>
3774
3775 <listitem>
3776 <para><computeroutput>lastError</computeroutput> property.</para>
3777 </listitem>
3778
3779 <listitem>
3780 <para><computeroutput>keyboardSendScancodes</computeroutput> and
3781 <computeroutput>keyboardSendCAD</computeroutput> methods.</para>
3782 </listitem>
3783 </itemizedlist>
3784 </sect2>
3785
3786 <sect2>
3787 <title>Version 1.0.24</title>
3788
3789 <itemizedlist>
3790 <listitem>
3791 <para>Initial release.</para>
3792 </listitem>
3793 </itemizedlist>
3794 </sect2>
3795 </sect1>
3796 </chapter>
3797
3798 <chapter id="dnd">
3799 <title>Drag and Drop</title>
3800
3801 <para>As of VirtualBox 4.2 it's possible to transfer files from the host to
3802 Linux, Solaris, and macOS guests by dragging files, directories, or text
3803 from the host into the guest's screen. This is called <emphasis>drag and drop
3804 (DnD)</emphasis>.</para>
3805
3806 <para>VirtualBox 5.0 added support for Windows guests as well as the ability
3807 to transfer data in the opposite direction, that is, from the guest to the
3808 host.</para>
3809
3810 <note><para>Currently only the VirtualBox Manager front-end supports drag and
3811 drop.</para></note>
3812
3813 <para>This chapter will show how to use the required interfaces provided
3814 by VirtualBox for adding drag and drop functionality to third-party
3815 front-ends.</para>
3816
3817 <sect1>
3818 <title>Basic concepts</title>
3819
3820 <para>In order to use the interfaces provided by VirtualBox, some basic
3821 concepts need to be understood first: a drag and drop operation logically
3822 contains both a <emphasis>source</emphasis> and a
3823 <emphasis>target</emphasis>:</para>
3824
3825 <para>The <emphasis>source</emphasis> provides the data, i.e., it is the
3826 origin of data. This data can be stored within the source directly or it can
3827 be retrieved on-demand by the source itself.</para>
3828
3829 <para>The <emphasis>target</emphasis> on the other hand provides a visual
3830 representation to the source where the user can drop the data the source
3831 offers. This representation can be a window (or just a certain part of
3832 it), for example.</para>
3833
3834 <para>The source and the target have abstract interfaces called
3835 <link linkend="IDnDSource">IDnDSource</link> and
3836 <link linkend="IDnDTarget">IDnDTarget</link>. VirtualBox also
3837 provides implementations of both interfaces, called
3838 <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
3839 <link linkend="IGuestDnDTarget">IGuestDnDTarget</link>. Both
3840 implementations are used in the VirtualBox Manager front-end.</para>
3841 </sect1>
3842
3843 <sect1>
3844 <title>Supported formats</title>
3845
3846 <para>As the target needs to perform specific actions depending on the
3847 data the source provided, the target first needs to know what type of
3848 data it is actually going to retrieve. It might be that the source offers
3849 data the target cannot (or intentionally does not want to)
3850 support.</para>
3851
3852 <para>VirtualBox describes the data types using
3853 <emphasis>MIME types</emphasis> -- which were originally defined in
3854 <ulink url="https://tools.ietf.org/html/rfc2046">RFC 2046</ulink> and
3855 are also called <emphasis>Content-types</emphasis> or
3856 <emphasis>media types</emphasis>.
3857 <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
3858 <link linkend="IGuestDnDTarget">IGuestDnDTarget</link> support
3859 the following MIME types by default:<itemizedlist>
3860 <listitem>
3861 <para><emphasis role="bold">text/uri-list</emphasis> - A list of
3862 URIs (Uniform Resource Identifier, see
3863 <ulink url="https://tools.ietf.org/html/rfc3986">RFC 3986</ulink>)
3864 pointing to the file and/or directory paths already transferred
3865 from the source to the target.</para>
3866 </listitem>
3867 <listitem>
3868 <para><emphasis role="bold">text/plain;charset=utf-8</emphasis> and
3869 <emphasis role="bold">UTF8_STRING</emphasis> - text in UTF-8
3870 format.</para>
3871 </listitem>
3872 <listitem>
3873 <para><emphasis role="bold">text/plain, TEXT</emphasis>
3874 and <emphasis role="bold">STRING</emphasis> - plain ASCII text,
3875 depending on the source's active ANSI page (if any).</para>
3876 </listitem>
3877 </itemizedlist>
3878 </para>
3879
3880 <para>If, for whatever reason, a certain default format should not be
3881 supported or a new format should be registered,
3882 <link linkend="IDnDSource">IDnDSource</link> and
3883 <link linkend="IDnDTarget">IDnDTarget</link> have methods derived from
3884 <link linkend="IDnDBase">IDnDBase</link> which provide adding,
3885 removing and enumerating specific formats.
3886 <note><para>Registering new or removing default formats on the guest side
3887 is not currently implemented.</para></note></para>
3888 </sect1>
3889
3890 </chapter>
3891
3892 <chapter id="vbox-auth">
3893 <title>VirtualBox external authentication modules</title>
3894
3895 <para>VirtualBox supports arbitrary external modules to perform
3896 authentication. External authentication modules are used for remote
3897 desktop access to a VM when the VRDE authentication type is set to
3898 "external". VRDE authentication will then use the authentication module
3899 which was specified with
3900 <computeroutput>VBoxManage setproperty vrdeauthlibrary</computeroutput>.
3901 The web service will use the external authentication module specified with
3902 <computeroutput>VBoxManage setproperty websrvauthlibrary</computeroutput>.
3903 </para>
3904
3905 <para>This library will be loaded by the VM or web service process on
3906 demand, i.e. when the first remote desktop connection is made by a client
3907 or when a client that wants to use the web service logs on.</para>
3908
3909 <para>External authentication is the most flexible authentication type
3910 since the external handler can choose to both grant access to everyone
3911 (like the "null" authentication method) as well as delegate the request to
3912 the guest authentication component. When delegating the request to the guest
3913 component the external handler will still be called afterwards with the
3914 option to override the result.</para>
3915
3916 <para>An authentication library is required to implement exactly one entry
3917 point:</para>
3918
3919 <screen>#include "VBoxAuth.h"
3920
3921/**
3922 * Authentication library entry point.
3923 *
3924 * Parameters:
3925 *
3926 * szCaller The name of the component which calls the library (UTF8).
3927 * pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
3928 * guestJudgement Result of the guest authentication.
3929 * szUser User name passed in by the client (UTF8).
3930 * szPassword Password passed in by the client (UTF8).
3931 * szDomain Domain passed in by the client (UTF8).
3932 * fLogon Boolean flag. Indicates whether the entry point is called
3933 * for a client logon or the client disconnect.
3934 * clientId Server side unique identifier of the client.
3935 *
3936 * Return code:
3937 *
3938 * AuthResultAccessDenied Client access has been denied.
3939 * AuthResultAccessGranted Client has the right to use the
3940 * virtual machine.
3941 * AuthResultDelegateToGuest Guest operating system must
3942 * authenticate the client and the
3943 * library must be called again with
3944 * the result of the guest
3945 * authentication.
3946 *
3947 * Note: When 'fLogon' is 0, only pszCaller, pUuid and clientId are valid and the return
3948 * code is ignored.
3949 */
3950AuthResult AUTHCALL AuthEntry(
3951 const char *szCaller,
3952 PAUTHUUID pUuid,
3953 AuthGuestJudgement guestJudgement,
3954 const char *szUser,
3955 const char *szPassword
3956 const char *szDomain
3957 int fLogon,
3958 unsigned clientId)
3959{
3960 /* Process request against your authentication source of choice. */
3961 // if (authSucceeded(...))
3962 // return AuthResultAccessGranted;
3963 return AuthResultAccessDenied;
3964}</screen>
3965
3966 <para>A note regarding the UUID implementation of the
3967 <computeroutput>pUuid</computeroutput> argument: VirtualBox uses a
3968 consistent binary representation of UUIDs on all platforms. For this
3969 reason the integer fields comprising the UUID are stored as little endian
3970 values. If you want to pass such UUIDs to code which assumes that
3971 integer fields are big endian (often also called network byte order), you
3972 need to adjust the contents of the UUID to achieve the same string
3973 representation. The required changes are:<itemizedlist>
3974 <listitem>
3975 <para>reverse the order of bytes 0, 1, 2 and 3</para>
3976 </listitem>
3977
3978 <listitem>
3979 <para>reverse the order of bytes 4 and 5</para>
3980 </listitem>
3981
3982 <listitem>
3983 <para>reverse the order of bytes 6 and 7.</para>
3984 </listitem>
3985 </itemizedlist>Using this conversion you will get identical results when
3986 converting the binary UUID to the string representation.</para>
3987
3988 <para>The <computeroutput>guestJudgement</computeroutput> argument
3989 contains information about the guest authentication status. For the first
3990 call, it is always set to
3991 <computeroutput>AuthGuestNotAsked</computeroutput>. If the
3992 <computeroutput>AuthEntry</computeroutput> function returns
3993 <computeroutput>AuthResultDelegateToGuest</computeroutput>, a guest
3994 authentication will be attempted and another call to the
3995 <computeroutput>AuthEntry</computeroutput> is made with its result. The
3996 guest authentication can return either granted, denied, or no judgement
3997 (the guest component chose for whatever reason to not make a decision).
3998 In case there is a problem with the guest authentication module (e.g. the
3999 Guest Additions are not installed or not running or the guest did not
4000 respond within a timeout), the "not reacted" status will be returned.</para>
4001 </chapter>
4002
4003 <chapter id="javaapi">
4004 <title>Using the Java API</title>
4005
4006 <sect1>
4007 <title>Introduction</title>
4008
4009 <para>VirtualBox can be controlled by a Java API, both locally using
4010 COM/XPCOM and remotely using SOAP. As with the Python bindings,
4011 a generic glue layer tries to hide all platform differences, allowing
4012 for source and binary compatibility on different platforms.</para>
4013 </sect1>
4014
4015 <sect1>
4016 <title>Requirements</title>
4017
4018 <para>To use the Java bindings, there are certain requirements depending
4019 on the platform. First of all, you need JDK 1.5 (Java 5) or later. Also
4020 please make sure that the version of the VirtualBox API .jar file
4021 exactly matches the version of VirtualBox in use. To avoid confusion,
4022 the VirtualBox API provides versioning in the Java package name, e.g.
4023 the package is named <computeroutput>org.virtualbox_3_2</computeroutput>
4024 for VirtualBox version 3.2. <itemizedlist>
4025 <listitem>
4026 <para><emphasis role="bold">XPCOM</emphasis> - for all platforms
4027 except Microsoft Windows. A Java bridge based on JavaXPCOM is shipped
4028 with VirtualBox. The classpath must contain
4029 <computeroutput>vboxjxpcom.jar</computeroutput> and the
4030 <computeroutput>vbox.home</computeroutput> property must be set to the
4031 location where the VirtualBox binaries are. Please make sure that
4032 the JVM bitness matches the bitness of VirtualBox in use as the XPCOM
4033 bridge relies on native libraries.</para>
4034
4035 <para>Start your application like this: <programlisting>
4036 java -cp vboxjxpcom.jar -Dvbox.home=/opt/virtualbox MyProgram
4037 </programlisting></para>
4038 </listitem>
4039
4040 <listitem>
4041 <para><emphasis role="bold">COM</emphasis> - for Microsoft
4042 Windows. We rely on <computeroutput>Jacob</computeroutput> - a
4043 generic Java to COM bridge - which has to be installed separately.
4044 See <ulink
4045 url="http://sourceforge.net/projects/jacob-project/">http://sourceforge.net/projects/jacob-project/</ulink>
4046 for installation instructions. Also, the VirtualBox provided
4047 <computeroutput>vboxjmscom.jar</computeroutput> file must be in the
4048 class path.</para>
4049
4050 <para>Start your application like this:
4051 <programlisting>java -cp vboxjmscom.jar;c:\jacob\jacob.jar -Djava.library.path=c:\jacob MyProgram</programlisting></para>
4052 </listitem>
4053
4054 <listitem>
4055 <para><emphasis role="bold">SOAP</emphasis> - all platforms. Java
4056 6 is required as it comes with built-in support for SOAP via the
4057 JAX-WS library. Also, the VirtualBox provided
4058 <computeroutput>vbojws.jar</computeroutput> must be in the class
4059 path. In the SOAP case it's possible to create several
4060 VirtualBoxManager instances to communicate with multiple
4061 VirtualBox hosts.</para>
4062
4063 <para>Start your application like this: <programlisting>
4064 java -cp vboxjws.jar MyProgram
4065 </programlisting></para>
4066 </listitem>
4067 </itemizedlist></para>
4068
4069 <para>Exception handling is also generalized by the generic glue layer,
4070 so that all methods can throw
4071 <computeroutput>VBoxException</computeroutput> containing a human-readable
4072 text message (see <computeroutput>getMessage()</computeroutput> method)
4073 along with the wrapped original exception (see
4074 <computeroutput>getWrapped()</computeroutput> method).</para>
4075 </sect1>
4076
4077 <sect1>
4078 <title>Example</title>
4079
4080 <para>This example shows a simple use case of the Java API. Differences
4081 for SOAP vs. local execution are minimal and limited to the connection
4082 setup phase (see <computeroutput>ws</computeroutput> variable). In the
4083 SOAP case it's possible to create several VirtualBoxManager instances to
4084 communicate with multiple VirtualBox hosts. <programlisting>
4085 import org.virtualbox_4_3.*;
4086 ....
4087 VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
4088 boolean ws = false; // or true, if we need the SOAP version
4089 if (ws)
4090 {
4091 String url = "http://myhost:18034";
4092 String user = "test";
4093 String passwd = "test";
4094 mgr.connect(url, user, passwd);
4095 }
4096 IVirtualBox vbox = mgr.getVBox();
4097 System.out.println("VirtualBox version: " + vbox.getVersion() + "\n");
4098 // get first VM name
4099 String m = vbox.getMachines().get(0).getName();
4100 System.out.println("\nAttempting to start VM '" + m + "'");
4101 // start it
4102 mgr.startVm(m, null, 7000);
4103
4104 if (ws)
4105 mgr.disconnect();
4106
4107 mgr.cleanup();
4108 </programlisting> For a more complete example, see
4109 <computeroutput>TestVBox.java</computeroutput>, shipped with the
4110 SDK. It contains exception handling and error printing code which
4111 is important for reliable larger scale projects.</para>
4112
4113 <para>It is good practice in long-running API clients to process the
4114 system events every now and then in the main thread (this does not work
4115 in other threads). As a rule of thumb it makes sense to process them
4116 every few 100msec to every few seconds). This is done by
4117 calling<programlisting>
4118 mgr.waitForEvents(0);
4119 </programlisting>
4120 This helps prevent a large number of system events from accumulating which
4121 can need a significant amount of memory, and as they also play a role in
4122 object cleanup it helps freeing additional memory in a timely manner
4123 which is used by the API implementation itself. Java's garbage collection
4124 approach already needs more memory due to the delayed freeing of memory
4125 used by no longer accessible objects and not processing the system
4126 events exacerbates the memory usage. The
4127 <computeroutput>TestVBox.java</computeroutput> example code sprinkles
4128 such lines over the code to achieve the desired effect. In multi-threaded
4129 applications it can be called from the main thread periodically.
4130 Sometimes it's possible to use the non-zero timeout variant of the
4131 method, which then waits the specified number of milliseconds for
4132 events, processing them immediately as they arrive. It achieves better
4133 runtime behavior than separate sleeping/processing.</para>
4134 </sect1>
4135 </chapter>
4136
4137 <chapter>
4138 <title>License information</title>
4139
4140 <para>The sample code files shipped with the SDK are generally licensed
4141 liberally to make it easy for anyone to use this code for their own
4142 application code.</para>
4143
4144 <para>The Java files under
4145 <computeroutput>sdk/bindings/webservice/java/jax-ws/</computeroutput> (library
4146 files for the object-oriented web service) are, by contrast, licensed
4147 under the GNU Lesser General Public License (LGPL) V2.1.</para>
4148
4149 <para>See
4150 <computeroutput>sdk/bindings/webservice/java/jax-ws/src/COPYING.LIB</computeroutput>
4151 for the full text of the LGPL 2.1.</para>
4152
4153 <para>When in doubt, please refer to the individual source code files
4154 shipped with this SDK.</para>
4155 </chapter>
4156
4157 <chapter>
4158 <title>Main API change log</title>
4159
4160 <para>Generally, VirtualBox will maintain API compatibility within a major
4161 release; a major release occurs when the first or the second of the three
4162 version components of VirtualBox change (that is, in the x.y.z scheme, a
4163 major release is one where x or y change, but not when only z
4164 changes).</para>
4165
4166 <para>In other words, updates like those from 2.0.0 to 2.0.2 will not come
4167 with API breakages.</para>
4168
4169 <para>Migration between major releases most likely will lead to API
4170 breakage, so please make sure you updated code accordingly. The OOWS Java
4171 wrappers enforce that mechanism by putting VirtualBox classes into
4172 version-specific packages such as
4173 <computeroutput>org.virtualbox_2_2</computeroutput>. This approach allows
4174 for connecting to multiple VirtualBox versions simultaneously from the
4175 same Java application.</para>
4176
4177 <para>The following sections list incompatible changes that the Main API
4178 underwent since the original release of this SDK Reference with VirtualBox
4179 2.0. A change is deemed "incompatible" only if it breaks existing client
4180 code (e.g. changes in method parameter lists, renamed or removed
4181 interfaces and similar). In other words, the list does not contain new
4182 interfaces, methods or attributes or other changes that do not affect
4183 existing client code.</para>
4184
4185 <sect1>
4186 <title>Incompatible API changes with version 7.1</title>
4187
4188 <itemizedlist>
4189
4190 <listitem><para>The Python API bindings for Python 2.x is now marked as being deprecated and will
4191 be removed in a future version. Please upgrade your code to use Python 3.</para>
4192 </listitem>
4193
4194 <listitem><para>The Python API bindings now live in a separate <computeroutput>python</computeroutput>
4195 sub directory and also now support installing via the pip package manager
4196 (e.g. <computeroutput>pip -v install ./vboxapi</computeroutput>). This also allows installing into
4197 Python virtual environments.</para>
4198 </listitem>
4199
4200 <listitem><para>The Windows host installer now uses the sub directory <computeroutput>installer</computeroutput>
4201 instead of <computeroutput>install</computeroutput> for housing the bindings installers. This now matches
4202 the directory layout for the other platforms. Please adapt your scripts if needed.</para>
4203 </listitem>
4204
4205
4206 <listitem><para>Guest process creation requires a new parameter for specifying the current working directory for the new
4207 guest process. This is optional and can be empty.
4208 See <link linkend="IGuestSession__processCreate">IGuestSession::processCreate</link> and
4209 <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx</link> for more information.</para>
4210 </listitem>
4211
4212 <listitem><para>The APIs <link linkend="IGuestSession__fsQueryInfo">IGuestSession::fsQueryInfo</link> and
4213 <link linkend="IGuestSession__fsQueryFreeSpace">IGuestSession::fsQueryFreeSpace</link> are now implemented.
4214 See <link linkend="IGuestSession__fsQueryInfo">IGuestSession::fsQueryInfo</link> and
4215 <link linkend="IGuestSession__fsQueryFreeSpace">IGuestSession::fsQueryFreeSpace</link> for more information.</para>
4216 </listitem>
4217
4218 <listitem><para>The APIs <link linkend="IGuestSession__waitFor">IGuestSession::waitFor</link> and
4219 <link linkend="IProcess__waitFor">IProcess::waitFor</link> are now marked
4220 as being deprecated. Use <link linkend="IGuestSession__waitForArray">IGuestSession::waitForArray</link>
4221 and <link linkend="IProcess__waitForArray">IProcess::waitForArray</link> instead.</para>
4222 </listitem>
4223
4224 <listitem><para>The attribute <link linkend="IGuestSession__mountPoints">IGuestSession::mountPoints</link> has been
4225 added. This requires 7.1 (or newer) Guest Additions to be installed on the guest.</para>
4226 </listitem>
4227
4228 </itemizedlist>
4229 </sect1>
4230
4231 <sect1>
4232 <title>Incompatible API changes with version 7.0</title>
4233
4234 <itemizedlist>
4235
4236 <listitem><para>The machine's audio adapter has been moved into the new IAudioSettings interface, which in turn
4237 takes care of of all audio settings of a virtual machine.
4238 See <link linkend="IMachine__audioSettings">IMachine::audioSettings</link> and
4239 <link linkend="IAudioSettings">IAudioSettings</link> for more information.</para>
4240 </listitem>
4241
4242 <listitem><para>The <link linkend="IVirtualBox__openMachine">IVirtualBox::openMachine</link> call now
4243 requires an additional password parameter. If the machine is not encrypted the parameter is ignored.</para>
4244 </listitem>
4245
4246 <listitem><para>When a new VM is being created, the default audio driver will be now
4247 <link linkend="AudioDriverType__Default">AudioDriverType_Default</link>. This driver
4248 type will automatically choose the best audio driver (backend) for the host OS &VBOX_PRODUCT;
4249 currently is running on.</para>
4250 </listitem>
4251
4252 <listitem><para>The host update functionality at IHost::update has been refactored into
4253 <link linkend="IHost__updateHost">IHost::updateHost</link>, which in turn uses the new
4254 <link linkend="IHostUpdateAgent">IHostUpdateAgent</link> interface, derived from the new
4255 <link linkend="IUpdateAgent">IUpdateAgent</link> interface.</para>
4256 </listitem>
4257
4258 <listitem><para><link linkend="IGuestSession__directoryCopyFromGuest">IGuestSession::directoryCopyFromGuest()</link> and
4259 <link linkend="IGuestSession__directoryCopyToGuest">IGuestSession::directoryCopyToGuest()</link> no longer implicitly
4260 copy recursively and follow symbolic links -- for this to continue working, the newly introduced flags
4261 <link linkend="DirectoryCopyFlag__Recursive">DirectoryCopyFlag::Recursive</link> and/or
4262 <link linkend="DirectoryCopyFlag__FollowLinks">DirectoryCopyFlag::FollowLinks</link> have to be used.</para>
4263 </listitem>
4264
4265 <listitem><para>VBoxEventType_Last has been renamed to <link linkend="VBoxEventType__End">VBoxEventType_End</link>
4266 for consistency.</para></listitem>
4267
4268 </itemizedlist>
4269
4270 </sect1>
4271
4272 <sect1>
4273 <title>Incompatible API changes with version 6.1</title>
4274
4275 <itemizedlist>
4276
4277 <listitem><para>Split off the graphics adapter part of
4278 <link linkend="IMachine">IMachine</link> into
4279 <link linkend="IGraphicsAdapter">IGraphicsAdapter</link>.
4280 This moved 5 attributes.</para>
4281 </listitem>
4282
4283 </itemizedlist>
4284
4285 </sect1>
4286
4287 <sect1>
4288 <title>Incompatible API changes with version 6.0</title>
4289
4290 <itemizedlist>
4291
4292 <listitem><para>Video recording APIs were changed as follows:
4293 <itemizedlist>
4294 <listitem><para>All attributes which were living in <link linkend="IMachine">IMachine</link> before
4295 have been moved to an own, dedicated interface named <link linkend="IRecordingSettings">IRecordingSettings</link>.
4296 This new interface can be accessed via the new <link linkend="IMachine__recordingSettings">IMachine::recordingSettings</link>
4297 attribute. This should emphasize that recording is not limited to video capturing as such.</para>
4298 </listitem>
4299
4300 <listitem><para>For further flexibility all specific per-VM-screen settings have been moved to a new interface
4301 called <link linkend="IRecordingScreenSettings">IRecordingScreenSettings</link>. Such settings now exist per configured
4302 VM display and can be retrieved via the <link linkend="IRecordingSettings__screens">IRecordingSettings::screens</link>
4303 attribute or the <link linkend="IRecordingSettings__getScreenSettings">IRecordingSettings::getScreenSettings</link>
4304 method.
4305 <note><para>For now all screen settings will share the same settings, e.g. different settings on a per-screen basis
4306 is not implemented yet.</para></note>
4307 </para>
4308 </listitem>
4309
4310 <listitem><para>The event <computeroutput>IVideoCaptureChangedEvent</computeroutput> was renamed into
4311 <link linkend="IRecordingChangedEvent">IRecordingChangedEvent</link>.</para>
4312 </listitem>
4313
4314 </itemizedlist>
4315 </para></listitem>
4316
4317 <listitem><para>Guest Control APIs were changed as follows:
4318 <itemizedlist>
4319 <listitem><para><link linkend="IGuest__createSession">IGuest::createSession()</link>,
4320 <link linkend="IGuestSession__processCreate">IGuestSession::processCreate()</link>,
4321 <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx()</link>,
4322 <link linkend="IGuestSession__directoryOpen">IGuestSession::directoryOpen()</link> and
4323 <link linkend="IGuestSession__fileOpen">IGuestSession::fileOpen()</link> now will
4324 return the new error code VBOX_E_MAXIMUM_REACHED if the limit for the according object
4325 group has been reached.</para>
4326 </listitem>
4327
4328 <listitem><para>The enumerations FileOpenExFlags, FsObjMoveFlags and DirectoryCopyFlags have
4329 been renamed to <link linkend="FileOpenExFlag">FileOpenExFlag</link>,
4330 <link linkend="FsObjMoveFlag">FsObjMoveFlag</link> and <link linkend="DirectoryCopyFlag">DirectoryCopyFlag</link>
4331 accordingly to match the rest of the API.</para>
4332 </listitem>
4333
4334 <listitem>
4335 <para>The following methods have been implemented:
4336 <computeroutput>IGuestSession::directoryCopyFromGuest()</computeroutput> and
4337 <computeroutput>IGuestSession::directoryCopyToGuest()</computeroutput>.
4338 </para>
4339
4340 <para>The following attributes have been implemented:
4341 <computeroutput>IGuestFsObjInfo::accessTime</computeroutput>,
4342 <computeroutput>IGuestFsObjInfo::birthTime</computeroutput>,
4343 <computeroutput>IGuestFsObjInfo::changeTime</computeroutput> and
4344 <computeroutput>IGuestFsObjInfo::modificationTime</computeroutput>.
4345 </para>
4346
4347 </listitem>
4348 </itemizedlist>
4349 </para></listitem>
4350
4351 <listitem><para>The webservice version of the <link linkend="ISharedFolder">ISharedFolder</link>
4352 interface was changed from a struct to a managed object. This causes incompatibilities on the
4353 protocol level as the shared folder attributes are not returned in the responses of
4354 <link linkend="IVirtualBox__sharedFolders">IVirtualBox::getSharedFolders</link> and
4355 <link linkend="IMachine__sharedFolders">IMachine::getSharedFolders</link> anymore. They
4356 return object UUIDs instead which need be wrapped by stub objects. The change is not visible when
4357 using the appropriate client bindings from the most recent VirtualBox SDK.
4358 </para></listitem>
4359
4360 </itemizedlist>
4361
4362 </sect1>
4363
4364 <sect1>
4365 <title>Incompatible API changes with version 5.x</title>
4366
4367 <itemizedlist>
4368 <listitem><para>ProcessCreateFlag::NoProfile has been renamed to
4369 <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>,
4370 and the semantics have also been changed: ProcessCreateFlag::NoProfile
4371 explicitly <emphasis role="bold">did not</emphasis> utilize the guest user's profile data
4372 whereas <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>
4373 explicitly <emphasis role="bold">does</emphasis> utilize the guest
4374 user’s profile data.</para>
4375 </listitem>
4376 </itemizedlist>
4377
4378 </sect1>
4379
4380 <sect1>
4381 <title>Incompatible API changes with version 5.1.28</title>
4382
4383 <itemizedlist>
4384 <listitem><para>The Host-Guest Communication Manager (HGCM) guest driver
4385 interfaces were renamed:
4386 <itemizedlist>
4387 <listitem><para>VbglHGCMConnect() was renamed to VbglR0HGCMConnect()
4388 </para></listitem>
4389 <listitem><para>VbglHGCMDisconnect() was renamed to VbglR0HGCMDisconnect()
4390 </para></listitem>
4391 <listitem><para>VbglHGCMCall() was renamed to VbglR0HGCMCall()
4392 </para></listitem>
4393 </itemizedlist>
4394 </para>
4395 </listitem>
4396
4397 <listitem><para>The Host-Guest Communication Manager (HGCM) guest
4398 application interface IOCTLs were renamed:
4399 <itemizedlist>
4400 <listitem><para>VBOXGUEST_IOCTL_HGCM_CONNECT was renamed to
4401 VBGL_IOCTL_HGCM_CONNECT
4402 </para></listitem>
4403 <listitem><para>VBOXGUEST_IOCTL_HGCM_DISCONNECT was renamed to
4404 VBGL_IOCTL_HGCM_DISCONNECT
4405 </para></listitem>
4406 <listitem><para>VBOXGUEST_IOCTL_HGCM_CALL was renamed to
4407 VBGL_IOCTL_HGCM_CALL
4408 </para></listitem>
4409 </itemizedlist>
4410 </para>
4411 </listitem>
4412
4413 </itemizedlist>
4414
4415 </sect1>
4416
4417
4418 <sect1>
4419 <title>Incompatible API changes with version 5.0</title>
4420
4421 <itemizedlist>
4422 <listitem>
4423 <para>The methods for saving state, adopting a saved state file,
4424 discarding a saved state, taking a snapshot, restoring
4425 a snapshot and deleting a snapshot have been moved from
4426 <computeroutput>IConsole</computeroutput> to
4427 <computeroutput>IMachine</computeroutput>. This straightens out the
4428 logical placement of methods and was necessary to resolve a
4429 long-standing issue, preventing 32-bit API clients from invoking
4430 those operations in the case where no VM is running.
4431 <itemizedlist>
4432 <listitem><para><link linkend="IMachine__saveState">IMachine::saveState()</link>
4433 replaces
4434 <computeroutput>IConsole::saveState()</computeroutput></para>
4435 </listitem>
4436 <listitem>
4437 <para><link linkend="IMachine__adoptSavedState">IMachine::adoptSavedState()</link>
4438 replaces
4439 <computeroutput>IConsole::adoptSavedState()</computeroutput></para>
4440 </listitem>
4441 <listitem>
4442 <para><link linkend="IMachine__discardSavedState">IMachine::discardSavedState()</link>
4443 replaces
4444 <computeroutput>IConsole::discardSavedState()</computeroutput></para>
4445 </listitem>
4446 <listitem>
4447 <para><link linkend="IMachine__takeSnapshot">IMachine::takeSnapshot()</link>
4448 replaces
4449 <computeroutput>IConsole::takeSnapshot()</computeroutput></para>
4450 </listitem>
4451 <listitem>
4452 <para><link linkend="IMachine__deleteSnapshot">IMachine::deleteSnapshot()</link>
4453 replaces
4454 <computeroutput>IConsole::deleteSnapshot()</computeroutput></para>
4455 </listitem>
4456 <listitem>
4457 <para><link linkend="IMachine__deleteSnapshotAndAllChildren">IMachine::deleteSnapshotAndAllChildren()</link>
4458 replaces
4459 <computeroutput>IConsole::deleteSnapshotAndAllChildren()</computeroutput></para>
4460 </listitem>
4461 <listitem>
4462 <para><link linkend="IMachine__deleteSnapshotRange">IMachine::deleteSnapshotRange()</link>
4463 replaces
4464 <computeroutput>IConsole::deleteSnapshotRange()</computeroutput></para>
4465 </listitem>
4466 <listitem>
4467 <para><link linkend="IMachine__restoreSnapshot">IMachine::restoreSnapshot()</link>
4468 replaces
4469 <computeroutput>IConsole::restoreSnapshot()</computeroutput></para>
4470 </listitem>
4471 </itemizedlist>
4472 Small adjustments to the parameter lists have been made to reduce
4473 the number of API calls when taking online snapshots (no longer
4474 needs explicit pausing), and taking a snapshot also returns now
4475 the snapshot id (useful for finding the right snapshot if there
4476 are non-unique snapshot names).</para>
4477 </listitem>
4478
4479 <listitem>
4480 <para>Two new machine states have been introduced to allow proper
4481 distinction between saving state and taking a snapshot.
4482 <link linkend="MachineState__Saving">MachineState::Saving</link>
4483 now is used exclusively while the VM's state is being saved, without
4484 any overlaps with snapshot functionality. The new state
4485 <link linkend="MachineState__Snapshotting">MachineState::Snapshotting</link>
4486 is used when an offline snapshot is taken and likewise the new state
4487 <link linkend="MachineState__OnlineSnapshotting">MachineState::OnlineSnapshotting</link>
4488 is used when an online snapshot is taken.</para>
4489 </listitem>
4490
4491 <listitem>
4492 <para>A new event has been introduced, which signals when a snapshot
4493 has been restored:
4494 <link linkend="ISnapshotRestoredEvent">ISnapshotRestoredEvent</link>.
4495 Previously the event
4496 <link linkend="ISnapshotDeletedEvent">ISnapshotDeletedEvent</link>
4497 was signalled, which isn't logical (but could be distinguished from
4498 actual deletion by the fact that the snapshot was still
4499 there).</para>
4500 </listitem>
4501
4502 <listitem>
4503 <para>The method
4504 <link linkend="IVirtualBox__createMedium">IVirtualBox::createMedium()</link>
4505 replaces
4506 <computeroutput>VirtualBox::createHardDisk()</computeroutput>.
4507 Adjusting existing code needs adding two parameters with
4508 value <computeroutput>AccessMode_ReadWrite</computeroutput>
4509 and <computeroutput>DeviceType_HardDisk</computeroutput>
4510 respectively. The new method supports creating floppy and
4511 DVD images, and (less obviously) further API functionality
4512 such as cloning floppy images.</para>
4513 </listitem>
4514
4515 <listitem>
4516 <para>The method
4517 <link linkend="IMachine__getStorageControllerByInstance">IMachine::getStorageControllerByInstance()</link>
4518 now has an additional parameter (first parameter), for specifying the
4519 storage bus which the storage controller must be using. The method
4520 was not useful before, as the instance numbers are only unique for a
4521 specfic storage bus.</para>
4522 </listitem>
4523
4524 <listitem>
4525 <para>The attribute
4526 <computeroutput>IMachine::sessionType</computeroutput> has been
4527 renamed to
4528 <link linkend="IMachine__sessionName">IMachine::sessionName()</link>.
4529 This cleans up the confusing terminology (as the session type is
4530 something different).</para>
4531 </listitem>
4532
4533 <listitem>
4534 <para>The attribute
4535 <computeroutput>IMachine::guestPropertyNotificationPatterns</computeroutput>
4536 has been removed. In practice it was not usable because it is too
4537 global and didn't distinguish between API clients.</para>
4538 </listitem>
4539
4540 <listitem><para>Drag and drop APIs were changed as follows:<itemizedlist>
4541
4542 <listitem>
4543 <para>Methods for providing host to guest drag and drop
4544 functionality, such as
4545 <computeroutput>IGuest::dragHGEnter</computeroutput>,
4546 <computeroutput>IGuest::dragHGMove()</computeroutput>,
4547 <computeroutput>IGuest::dragHGLeave()</computeroutput>,
4548 <computeroutput>IGuest::dragHGDrop()</computeroutput> and
4549 <computeroutput>IGuest::dragHGPutData()</computeroutput>,
4550 have been moved to an abstract base class called
4551 <link linkend="IDnDTarget">IDnDTarget</link>.
4552 VirtualBox implements this base class in the
4553 <link linkend="IGuestDnDTarget">IGuestDnDTarget</link>
4554 interface. The implementation can be used by using the
4555 <link linkend="IGuest__dnDTarget">IGuest::dnDTarget()</link>
4556 method.</para>
4557 <para>Methods for providing guest to host drag and drop
4558 functionality, such as
4559 <computeroutput>IGuest::dragGHPending()</computeroutput>,
4560 <computeroutput>IGuest::dragGHDropped()</computeroutput> and
4561 <computeroutput>IGuest::dragGHGetData()</computeroutput>,
4562 have been moved to an abstract base class called
4563 <link linkend="IDnDSource">IDnDSource</link>.
4564 VirtualBox implements this base class in the
4565 <link linkend="IGuestDnDSource">IGuestDnDSource</link>
4566 interface. The implementation can be used by using the
4567 <link linkend="IGuest__dnDSource">IGuest::dnDSource()</link>
4568 method.</para>
4569 </listitem>
4570
4571 <listitem>
4572 <para>The <computeroutput>DragAndDropAction</computeroutput>
4573 enumeration has been renamed to
4574 <link linkend="DnDAction">DnDAction</link>.</para>
4575 </listitem>
4576
4577 <listitem>
4578 <para>The <computeroutput>DragAndDropMode</computeroutput>
4579 enumeration has been renamed to
4580 <link linkend="DnDMode">DnDMode</link>.</para>
4581 </listitem>
4582
4583 <listitem>
4584 <para>The attribute
4585 <computeroutput>IMachine::dragAndDropMode</computeroutput>
4586 has been renamed to
4587 <link linkend="IMachine__dnDMode">IMachine::dnDMode()</link>.</para>
4588 </listitem>
4589
4590 <listitem>
4591 <para>The event
4592 <computeroutput>IDragAndDropModeChangedEvent</computeroutput>
4593 has been renamed to
4594 <link linkend="IDnDModeChangedEvent">IDnDModeChangedEvent</link>.</para>
4595 </listitem>
4596
4597 </itemizedlist></para>
4598 </listitem>
4599
4600 <listitem><para>IDisplay and IFramebuffer interfaces were changed to
4601 allow IFramebuffer object to reside in a separate front-end
4602 process:<itemizedlist>
4603
4604 <listitem><para>
4605 IDisplay::ResizeCompleted() has been removed, because the
4606 IFramebuffer object does not provide the screen memory anymore.
4607 </para></listitem>
4608
4609 <listitem><para>
4610 IDisplay::SetFramebuffer() has been replaced with
4611 IDisplay::AttachFramebuffer() and IDisplay::DetachFramebuffer().
4612 </para></listitem>
4613
4614 <listitem><para>
4615 IDisplay::GetFramebuffer() has been replaced with
4616 IDisplay::QueryFramebuffer().
4617 </para></listitem>
4618
4619 <listitem><para>
4620 IDisplay::GetScreenResolution() has a new output parameter
4621 <computeroutput>guestMonitorStatus</computeroutput>
4622 which tells whether the monitor is enabled in the guest.
4623 </para></listitem>
4624
4625 <listitem><para>
4626 IDisplay::TakeScreenShot() and IDisplay::TakeScreenShotToArray()
4627 have a new parameter
4628 <computeroutput>bitmapFormat</computeroutput>. As a consequence of
4629 this, IDisplay::TakeScreenShotPNGToArray() has been removed.
4630 </para></listitem>
4631
4632 <listitem><para>
4633 IFramebuffer::RequestResize() has been replaced with
4634 IFramebuffer::NotifyChange().
4635 </para></listitem>
4636
4637 <listitem><para>
4638 IFramebuffer::NotifyUpdateImage() added to support IFramebuffer
4639 objects in a different process.
4640 </para></listitem>
4641
4642 <listitem><para>
4643 IFramebuffer::Lock(), IFramebuffer::Unlock(),
4644 IFramebuffer::Address(), IFramebuffer::UsesGuestVRAM() have been
4645 removed because the IFramebuffer object does not provide the screen
4646 memory anymore.
4647 </para></listitem>
4648
4649 </itemizedlist></para>
4650 </listitem>
4651
4652 <listitem><para>IGuestSession, IGuestFile and IGuestProcess interfaces
4653 were changed as follows:
4654 <itemizedlist>
4655 <listitem>
4656 <para>Replaced IGuestSession::directoryQueryInfo and
4657 IGuestSession::fileQueryInfo with a new
4658 <link linkend="IGuestSession__fsObjQueryInfo">IGuestSession::fsObjQueryInfo</link>
4659 method that works on any type of file system object.</para>
4660 </listitem>
4661 <listitem>
4662 <para>Replaced IGuestSession::fileRemove,
4663 IGuestSession::symlinkRemoveDirectory and
4664 IGuestSession::symlinkRemoveFile with a new
4665 <link linkend="IGuestSession__fsObjRemove">IGuestSession::fsObjRemove</link>
4666 method that works on any type of file system object except
4667 directories. (fileRemove also worked on any type of object
4668 too, though that was not the intent of the method.)</para>
4669 </listitem>
4670 <listitem>
4671 <para>Replaced IGuestSession::directoryRename and
4672 IGuestSession::directoryRename with a new
4673 <link linkend="IGuestSession__fsObjRename">IGuestSession::fsObjRename</link>
4674 method that works on any type of file system object.
4675 (directoryRename and fileRename may already have worked for
4676 any kind of object, but that was never the intent of the
4677 methods.)</para>
4678 </listitem>
4679 <listitem>
4680 <para>Replaced the unimplemented IGuestSession::directorySetACL
4681 and IGuestSession::fileSetACL with a new
4682 <link linkend="IGuestSession__fsObjSetACL">IGuestSession::fsObjSetACL</link>
4683 method that works on all type of file system object. Also
4684 added a UNIX-style mode parameter as an alternative to the
4685 ACL.</para>
4686 </listitem>
4687 <listitem>
4688 <para>Replaced IGuestSession::fileRemove,
4689 IGuestSession::symlinkRemoveDirectory and
4690 IGuestSession::symlinkRemoveFile with a new
4691 <link linkend="IGuestSession__fsObjRemove">IGuestSession::fsObjRemove</link>
4692 method that works on any type of file system object except
4693 directories (fileRemove also worked on any type of object,
4694 though that was not the intent of the method.)</para>
4695 </listitem>
4696 <listitem>
4697 <para>Renamed IGuestSession::copyTo to
4698 <link linkend="IGuestSession__fileCopyToGuest">IGuestSession::fileCopyToGuest</link>.</para>
4699 </listitem>
4700 <listitem>
4701 <para>Renamed IGuestSession::copyFrom to
4702 <link linkend="IGuestSession__fileCopyFromGuest">IGuestSession::fileCopyFromGuest</link>.</para>
4703 </listitem>
4704 <listitem>
4705 <para>Renamed the CopyFileFlag enum to
4706 <link linkend="FileCopyFlag">FileCopyFlag</link>.</para>
4707 </listitem>
4708 <listitem>
4709 <para>Renamed the IGuestSession::environment attribute to
4710 <link linkend="IGuestSession__environmentChanges">IGuestSession::environmentChanges</link>
4711 to better reflect what it does.</para>
4712 </listitem>
4713 <listitem>
4714 <para>Changed the
4715 <link linkend="IProcess__environment">IGuestProcess::environment</link>
4716 to a stub returning E_NOTIMPL since it wasn't doing what was
4717 advertised (returned changes, not the actual environment).</para>
4718 </listitem>
4719 <listitem>
4720 <para>Renamed IGuestSession::environmentSet to
4721 <link linkend="IGuestSession__environmentScheduleSet">IGuestSession::environmentScheduleSet</link>
4722 to better reflect what it does.</para>
4723 </listitem>
4724 <listitem>
4725 <para>Renamed IGuestSession::environmentUnset to
4726 <link linkend="IGuestSession__environmentScheduleUnset">IGuestSession::environmentScheduleUnset</link>
4727 to better reflect what it does.</para>
4728 </listitem>
4729 <listitem>
4730 <para>Removed IGuestSession::environmentGet it was only getting
4731 changes while giving the impression it was actual environment
4732 variables, and it did not represent scheduled unset
4733 operations.</para>
4734 </listitem>
4735 <listitem>
4736 <para>Removed IGuestSession::environmentClear as it duplicates
4737 assigning an empty array to the
4738 <link linkend="IGuestSession__environmentChanges">IGuestSession::environmentChanges</link>
4739 (formerly known as IGuestSession::environment).</para>
4740 </listitem>
4741 <listitem>
4742 <para>Changed the
4743 <link linkend="IGuestSession__processCreate">IGuestSession::processCreate</link>
4744 and
4745 <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx</link>
4746 methods to accept arguments starting with argument zero (argv[0])
4747 instead of argument one (argv[1]). (Not yet implemented on the
4748 guest additions side, so argv[0] will probably be ignored for a
4749 short while.)</para>
4750 </listitem>
4751
4752 <listitem>
4753 <para>Added a followSymlink parameter to the following methods:
4754 <itemizedlist>
4755 <listitem><para><link linkend="IGuestSession__directoryExists">IGuestSession::directoryExists</link></para></listitem>
4756 <listitem><para><link linkend="IGuestSession__fileExists">IGuestSession::fileExists</link></para></listitem>
4757 <listitem><para><link linkend="IGuestSession__fileQuerySize">IGuestSession::fileQuerySize</link></para></listitem>
4758 </itemizedlist></para>
4759 </listitem>
4760 <listitem>
4761 <para>The parameters to the
4762 <link linkend="IGuestSession__fileOpen">IGuestSession::fileOpen</link>
4763 and
4764 <link linkend="IGuestSession__fileOpenEx">IGuestSession::fileOpenEx</link>
4765 methods were altered:<itemizedlist>
4766 <listitem><para>The openMode string parameter was replaced by
4767 the enum
4768 <link linkend="FileAccessMode">FileAccessMode</link>
4769 and renamed to accessMode.</para></listitem>
4770 <listitem><para>The disposition string parameter was replaced
4771 by the enum
4772 <link linkend="FileOpenAction">FileOpenAction</link>
4773 and renamed to openAction.</para></listitem>
4774 <listitem><para>The unimplemented sharingMode string parameter
4775 was replaced by the enum
4776 <link linkend="FileSharingMode">FileSharingMode</link>
4777 (fileOpenEx only).</para></listitem>
4778 <listitem><para>Added a flags parameter taking a list of
4779 <link linkend="FileOpenExFlag">FileOpenExFlag</link> values
4780 (fileOpenEx only).</para></listitem>
4781 <listitem><para>Removed the offset parameter (fileOpenEx
4782 only).</para></listitem>
4783 </itemizedlist></para>
4784 </listitem>
4785
4786 <listitem>
4787 <para><link linkend="IFile__seek">IGuestFile::seek</link> now
4788 returns the new offset.</para>
4789 </listitem>
4790 <listitem>
4791 <para>Renamed the FileSeekType enum used by
4792 <link linkend="IFile__seek">IGuestFile::seek</link>
4793 to <link linkend="FileSeekOrigin">FileSeekOrigin</link> and
4794 added the missing End value and renaming the Set to
4795 Begin.</para>
4796 </listitem>
4797 <listitem>
4798 <para>Extended the unimplemented
4799 <link linkend="IFile__setACL">IGuestFile::setACL</link>
4800 method with a UNIX-style mode parameter as an alternative to
4801 the ACL.</para>
4802 </listitem>
4803 <listitem>
4804 <para>Renamed the IFile::openMode attribute to
4805 <link linkend="IFile__accessMode">IFile::accessMode</link>
4806 and change the type from string to
4807 <link linkend="FileAccessMode">FileAccessMode</link> to reflect
4808 the changes to the fileOpen methods.</para>
4809 </listitem>
4810 <listitem>
4811 <para>Renamed the IGuestFile::disposition attribute to
4812 <link linkend="IFile__openAction">IFile::openAction</link> and
4813 change the type from string to
4814 <link linkend="FileOpenAction">FileOpenAction</link> to reflect
4815 the changes to the fileOpen methods.</para>
4816 </listitem>
4817
4818 <!-- Non-incompatible things worth mentioning (stubbed methods/attrs aren't worth it). -->
4819 <listitem>
4820 <para>Added
4821 <link linkend="IGuestSession__pathStyle">IGuestSession::pathStyle</link>
4822 attribute.</para>
4823 </listitem>
4824 <listitem>
4825 <para>Added
4826 <link linkend="IGuestSession__fsObjExists">IGuestSession::fsObjExists</link>
4827 attribute.</para>
4828 </listitem>
4829
4830 </itemizedlist>
4831 </para>
4832 </listitem>
4833
4834 <listitem><para>
4835 IConsole::GetDeviceActivity() returns information about multiple
4836 devices.
4837 </para></listitem>
4838
4839 <listitem><para>
4840 IMachine::ReadSavedThumbnailToArray() has a new parameter
4841 <computeroutput>bitmapFormat</computeroutput>. As a consequence of
4842 this, IMachine::ReadSavedThumbnailPNGToArray() has been removed.
4843 </para></listitem>
4844
4845 <listitem><para>
4846 IMachine::QuerySavedScreenshotPNGSize() has been renamed to
4847 IMachine::QuerySavedScreenshotInfo() which also returns
4848 an array of available screenshot formats.
4849 </para></listitem>
4850
4851 <listitem><para>
4852 IMachine::ReadSavedScreenshotPNGToArray() has been renamed to
4853 IMachine::ReadSavedScreenshotToArray() which has a new parameter
4854 <computeroutput>bitmapFormat</computeroutput>.
4855 </para></listitem>
4856
4857 <listitem><para>
4858 IMachine::QuerySavedThumbnailSize() has been removed.
4859 </para></listitem>
4860
4861 <listitem>
4862 <para>The method
4863 <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>
4864 now returns a new <link linkend="ISession">ISession</link> instance
4865 for every invocation. This puts the behavior in line with other
4866 binding styles, which never forced the equivalent of establishing
4867 another connection and logging in again to get another
4868 instance.</para>
4869 </listitem>
4870 </itemizedlist>
4871 </sect1>
4872
4873 <sect1>
4874 <title>Incompatible API changes with version 4.3</title>
4875
4876 <itemizedlist>
4877 <listitem>
4878 <para>The explicit medium locking methods
4879 <link linkend="IMedium__lockRead">IMedium::lockRead()</link>
4880 and <link linkend="IMedium__lockWrite">IMedium::lockWrite()</link>
4881 have been redesigned. They return a lock token object reference
4882 now, and calling the
4883 <link linkend="IToken__abandon">IToken::abandon()</link> method (or
4884 letting the reference count to this object drop to 0) will unlock
4885 it. This eliminates the rather common problem that an API client
4886 crash left behind locks, and also improves the safety (API clients
4887 can't release locks they didn't obtain).</para>
4888 </listitem>
4889
4890 <listitem>
4891 <para>The parameter list of
4892 <link linkend="IAppliance__write">IAppliance::write()</link>
4893 has been changed slightly, to allow multiple flags to be
4894 passed.</para>
4895 </listitem>
4896
4897 <listitem>
4898 <para><computeroutput>IMachine::delete</computeroutput>
4899 has been renamed to
4900 <link linkend="IMachine__deleteConfig">IMachine::deleteConfig()</link>,
4901 to improve API client binding compatibility.</para>
4902 </listitem>
4903
4904 <listitem>
4905 <para><computeroutput>IMachine::export</computeroutput>
4906 has been renamed to
4907 <link linkend="IMachine__exportTo">IMachine::exportTo()</link>,
4908 to improve API client binding compatibility.</para>
4909 </listitem>
4910
4911 <listitem>
4912 <para>For
4913 <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>
4914 the meaning of the <computeroutput>type</computeroutput> parameter
4915 has changed slightly. Empty string now means that the per-VM or
4916 global default front-end is launched. Most callers of this method
4917 should use the empty string now, unless they really want to override
4918 the default and launch a particular front-end.</para>
4919 </listitem>
4920
4921 <listitem>
4922 <para>Medium management APIs were changed as follows:<itemizedlist>
4923
4924 <listitem>
4925 <para>The type of attribute
4926 <link linkend="IMedium__variant">IMedium::variant()</link>
4927 changed from <computeroutput>unsigned long</computeroutput>
4928 to <computeroutput>safe-array MediumVariant</computeroutput>.
4929 It is an array of flags instead of a set of flags which were
4930 stored inside one variable.
4931 </para>
4932 </listitem>
4933
4934 <listitem>
4935 <para>The parameter list for
4936 <link linkend="IMedium__cloneTo">IMedium::cloneTo()</link>
4937 was modified. The type of parameter variant was changed from
4938 unsigned long to safe-array MediumVariant.
4939 </para>
4940 </listitem>
4941
4942 <listitem>
4943 <para>The parameter list for
4944 <link linkend="IMedium__createBaseStorage">IMedium::createBaseStorage()</link>
4945 was modified. The type of parameter variant was changed from
4946 unsigned long to safe-array MediumVariant.
4947 </para>
4948 </listitem>
4949
4950 <listitem>
4951 <para>The parameter list for
4952 <link linkend="IMedium__createDiffStorage">IMedium::createDiffStorage()</link>
4953 was modified. The type of parameter variant was changed from
4954 unsigned long to safe-array MediumVariant.
4955 </para>
4956 </listitem>
4957
4958 <listitem>
4959 <para>The parameter list for
4960 <link linkend="IMedium__cloneToBase">IMedium::cloneToBase()</link>
4961 was modified. The type of parameter variant was changed from
4962 unsigned long to safe-array MediumVariant.
4963 </para>
4964 </listitem>
4965 </itemizedlist></para>
4966 </listitem>
4967
4968 <listitem>
4969 <para>The type of attribute
4970 <link linkend="IMediumFormat__capabilities">IMediumFormat::capabilities()</link>
4971 changed from <computeroutput>unsigned long</computeroutput> to
4972 <computeroutput>safe-array MediumFormatCapabilities</computeroutput>.
4973 It is an array of flags instead of a set of flags which were stored
4974 inside one variable.
4975 </para>
4976 </listitem>
4977
4978 <listitem>
4979 <para>The attribute
4980 <link linkend="IMedium__logicalSize">IMedium::logicalSize()</link>
4981 now returns the logical size of exactly this medium object (whether
4982 it is a base or diff image). The old behavior was no longer
4983 acceptable, as each image can have a different capacity.</para>
4984 </listitem>
4985
4986 <listitem>
4987 <para>Guest control APIs - such as
4988 <link linkend="IGuest">IGuest</link>,
4989 <link linkend="IGuestSession">IGuestSession</link>,
4990 <link linkend="IGuestProcess">IGuestProcess</link> and so on - now
4991 emit own events to provide clients much finer control and the ability
4992 to write own front-ends for guest operations. The event
4993 <link linkend="IGuestSessionEvent">IGuestSessionEvent</link> acts as
4994 an abstract base class for all guest control events. Certain guest
4995 events contain a
4996 <link linkend="IVirtualBoxErrorInfo">IVirtualBoxErrorInfo</link>
4997 member to provide more information in case of an error happened on
4998 the guest side.</para>
4999 </listitem>
5000
5001 <listitem>
5002 <para>Guest control sessions on the guest started by
5003 <link linkend="IGuest__createSession">IGuest::createSession()</link>
5004 now are dedicated guest processes to provide more safety and
5005 performance for certain operations. Also, the
5006 <link linkend="IGuest__createSession">IGuest::createSession()</link>
5007 call does not wait for the guest session being created anymore due
5008 to the dedicated guest session processes just mentioned. This also
5009 will enable webservice clients to handle guest session creation
5010 more gracefully. To wait for a guest session being started, use the
5011 newly added attribute
5012 <link linkend="IGuestSession__status">IGuestSession::status()</link>
5013 to query the current guest session status.</para>
5014 </listitem>
5015
5016 <listitem>
5017 <para>The <link linkend="IGuestFile">IGuestFile</link>
5018 APIs are now implemented to provide native guest file access from
5019 the host.</para>
5020 </listitem>
5021
5022 <listitem>
5023 <para>The parameter list for
5024 <link linkend="IGuest__updateGuestAdditions">IMedium::updateGuestAdditions()</link>
5025 was modified. It now supports specifying optional command line
5026 arguments for the Guest Additions installer performing the actual
5027 update on the guest.
5028 </para>
5029 </listitem>
5030
5031 <listitem>
5032 <para>A new event
5033 <link linkend="IGuestUserStateChangedEvent">IGuestUserStateChangedEvent</link>
5034 was introduced to provide guest user status updates to the host via
5035 event listeners. To use this event there needs to be at least the 4.3
5036 Guest Additions installed on the guest. At the moment only the states
5037 "Idle" and "InUse" of the
5038 <link linkend="GuestUserState">GuestUserState</link> enumeration arei
5039 supported on Windows guests, starting at Windows 2000 SP2.</para>
5040 </listitem>
5041
5042 <listitem>
5043 <para>
5044 The attribute
5045 <link linkend="IGuestSession__protocolVersion">IGuestSession::protocolVersion</link>
5046 was added to provide a convenient way to lookup the guest session's
5047 protocol version it uses to communicate with the installed Guest
5048 Additions on the guest. Older Guest Additions will set the protocol
5049 version to 1, whereas Guest Additions 4.3 will set the protocol
5050 version to 2. This might change in the future as new features
5051 arise.</para>
5052 </listitem>
5053
5054 <listitem>
5055 <para><computeroutput>IDisplay::getScreenResolution</computeroutput>
5056 has been extended to return the display position in the guest.</para>
5057 </listitem>
5058
5059 <listitem>
5060 <para>
5061 The <link linkend="IUSBController">IUSBController</link>
5062 class is not a singleton of
5063 <link linkend="IMachine">IMachine</link> anymore but
5064 <link linkend="IMachine">IMachine</link> contains a list of USB
5065 controllers present in the VM. The USB device filter handling was
5066 moved to
5067 <link linkend="IUSBDeviceFilters">IUSBDeviceFilters</link>.
5068 </para>
5069 </listitem>
5070 </itemizedlist>
5071 </sect1>
5072
5073 <sect1>
5074 <title>Incompatible API changes with version 4.2</title>
5075
5076 <itemizedlist>
5077 <listitem>
5078 <para>Guest control APIs for executing guest processes, working with
5079 guest files or directories have been moved to the newly introduced
5080 <link linkend="IGuestSession">IGuestSession</link> interface which
5081 can be created by calling
5082 <link linkend="IGuest__createSession">IGuest::createSession()</link>.</para>
5083
5084 <para>A guest session will act as a
5085 guest user's impersonation so that the guest credentials only have to
5086 be provided when creating a new guest session. There can be up to 32
5087 guest sessions at once per VM, each session serving up to 2048 guest
5088 processes running or files opened.</para>
5089
5090 <para>Instead of working with process or directory handles before
5091 version 4.2, there now are the dedicated interfaces
5092 <link linkend="IGuestProcess">IGuestProcess</link>,
5093 <link linkend="IGuestDirectory">IGuestDirectory</link> and
5094 <link linkend="IGuestFile">IGuestFile</link>. To retrieve more
5095 information of a file system object the new interface
5096 <link linkend="IGuestFsObjInfo">IGuestFsObjInfo</link> has been
5097 introduced.</para>
5098
5099 <para>Even though the guest control API was changed it is backwards
5100 compatible so that it can be used with older installed Guest
5101 Additions. However, to use upcoming features like process termination
5102 or waiting for input / output new Guest Additions must be installed
5103 when these features got implemented.</para>
5104
5105 <para>The following limitations apply:
5106 <itemizedlist>
5107 <listitem><para>The <link linkend="IGuestFile">IGuestFile</link>
5108 interface is not fully implemented yet.</para>
5109 </listitem>
5110 <listitem><para>The symbolic link APIs
5111 <link linkend="IGuestSession__symlinkCreate">IGuestSession::symlinkCreate()</link>,
5112 <link linkend="IGuestSession__symlinkExists">IGuestSession::symlinkExists()</link>,
5113 <link linkend="IGuestSession__symlinkRead">IGuestSession::symlinkRead()</link>,
5114 IGuestSession::symlinkRemoveDirectory() and
5115 IGuestSession::symlinkRemoveFile() are not
5116 implemented yet.</para>
5117 </listitem>
5118 <listitem><para>The directory APIs
5119 <link linkend="IGuestSession__directoryRemove">IGuestSession::directoryRemove()</link>,
5120 <link linkend="IGuestSession__directoryRemoveRecursive">IGuestSession::directoryRemoveRecursive()</link>,
5121 IGuestSession::directoryRename() and
5122 IGuestSession::directorySetACL() are not
5123 implemented yet.</para>
5124 </listitem>
5125 <listitem><para>The temporary file creation API
5126 <link linkend="IGuestSession__fileCreateTemp">IGuestSession::fileCreateTemp()</link>
5127 is not implemented yet.</para>
5128 </listitem>
5129 <listitem><para>Guest process termination via
5130 <link linkend="IProcess__terminate">IProcess::terminate()</link>
5131 is not implemented yet.</para>
5132 </listitem>
5133 <listitem><para>Waiting for guest process output via
5134 <link linkend="ProcessWaitForFlag__StdOut">ProcessWaitForFlag::StdOut</link>
5135 and
5136 <link linkend="ProcessWaitForFlag__StdErr">ProcessWaitForFlag::StdErr</link>
5137 is not implemented yet.</para>
5138 <para>To wait for process output,
5139 <link linkend="IProcess__read">IProcess::read()</link> with
5140 appropriate flags still can be used to periodically check for
5141 new output data to arrive. Note that
5142 <link linkend="ProcessCreateFlag__WaitForStdOut">ProcessCreateFlag::WaitForStdOut</link>
5143 and / or
5144 <link linkend="ProcessCreateFlag__WaitForStdErr">ProcessCreateFlag::WaitForStdErr</link>
5145 need to be specified when creating a guest process via
5146 <link linkend="IGuestSession__processCreate">IGuestSession::processCreate()</link>
5147 or
5148 <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx()</link>.</para>
5149 </listitem>
5150 <listitem>
5151 <para>ACL (Access Control List) handling in general is not
5152 implemented yet.</para>
5153 </listitem>
5154 </itemizedlist>
5155 </para>
5156 </listitem>
5157
5158 <listitem>
5159 <para>The <link linkend="LockType">LockType</link>
5160 enumeration now has an additional value
5161 <computeroutput>VM</computeroutput> which tells
5162 <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
5163 to create a full-blown object structure for running a VM. This was
5164 the previous behavior with <computeroutput>Write</computeroutput>,
5165 which now only creates the minimal object structure to save time and
5166 resources (at the moment the Console object is still created, but all
5167 sub-objects such as Display, Keyboard, Mouse, Guest are not.</para>
5168 </listitem>
5169
5170 <listitem>
5171 <para>Machines can be put in groups (actually an array of groups).
5172 The primary group affects the default placement of files belonging
5173 to a VM.
5174 <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
5175 and
5176 <link linkend="IVirtualBox__composeMachineFilename">IVirtualBox::composeMachineFilename()</link>
5177 have been adjusted accordingly, the former taking an array of groups
5178 as an additional parameter and the latter taking a group as an
5179 additional parameter. The create option handling has been changed for
5180 those two methods, too.</para>
5181 </listitem>
5182
5183 <listitem>
5184 <para>The method IVirtualBox::findMedium() has been removed, since
5185 it provides a subset of the functionality of
5186 <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>.</para>
5187 </listitem>
5188
5189 <listitem>
5190 <para>The use of acronyms in API enumeration, interface, attribute
5191 and method names has been made much more consistent, previously they
5192 sometimes were lowercase and sometimes mixed case. They are now
5193 consistently all caps:<table>
5194 <title>Renamed identifiers in VirtualBox 4.2</title>
5195
5196 <tgroup cols="2" style="verywide">
5197 <tbody>
5198 <row>
5199 <entry><emphasis role="bold">Old name</emphasis></entry>
5200
5201 <entry><emphasis role="bold">New name</emphasis></entry>
5202 </row>
5203 <row>
5204 <entry>PointingHidType</entry>
5205 <entry><link linkend="PointingHIDType">PointingHIDType</link></entry>
5206 </row>
5207 <row>
5208 <entry>KeyboardHidType</entry>
5209 <entry><link linkend="KeyboardHIDType">KeyboardHIDType</link></entry>
5210 </row>
5211 <row>
5212 <entry>IPciAddress</entry>
5213 <entry><link linkend="IPCIAddress">IPCIAddress</link></entry>
5214 </row>
5215 <row>
5216 <entry>IPciDeviceAttachment</entry>
5217 <entry><link linkend="IPCIDeviceAttachment">IPCIDeviceAttachment</link></entry>
5218 </row>
5219 <row>
5220 <entry>IMachine::pointingHidType</entry>
5221 <entry><link linkend="IMachine__pointingHIDType">IMachine::pointingHIDType</link></entry>
5222 </row>
5223 <row>
5224 <entry>IMachine::keyboardHidType</entry>
5225 <entry><link linkend="IMachine__keyboardHIDType">IMachine::keyboardHIDType</link></entry>
5226 </row>
5227 <row>
5228 <entry>IMachine::hpetEnabled</entry>
5229 <entry>IMachine::HPETEnabled</entry>
5230 </row>
5231 <row>
5232 <entry>IMachine::sessionPid</entry>
5233 <entry><link linkend="IMachine__sessionPID">IMachine::sessionPID</link></entry>
5234 </row>
5235 <row>
5236 <entry>IMachine::ioCacheEnabled</entry>
5237 <entry><link linkend="IMachine__IOCacheEnabled">IMachine::IOCacheEnabled</link></entry>
5238 </row>
5239 <row>
5240 <entry>IMachine::ioCacheSize</entry>
5241 <entry><link linkend="IMachine__IOCacheSize">IMachine::IOCacheSize</link></entry>
5242 </row>
5243 <row>
5244 <entry>IMachine::pciDeviceAssignments</entry>
5245 <entry><link linkend="IMachine__PCIDeviceAssignments">IMachine::PCIDeviceAssignments</link></entry>
5246 </row>
5247 <row>
5248 <entry>IMachine::attachHostPciDevice()</entry>
5249 <entry><link linkend="IMachine__attachHostPCIDevice">IMachine::attachHostPCIDevice</link></entry>
5250 </row>
5251 <row>
5252 <entry>IMachine::detachHostPciDevice()</entry>
5253 <entry><link linkend="IMachine__detachHostPCIDevice">IMachine::detachHostPCIDevice()</link></entry>
5254 </row>
5255 <row>
5256 <entry>IConsole::attachedPciDevices</entry>
5257 <entry><link linkend="IConsole__attachedPCIDevices">IConsole::attachedPCIDevices</link></entry>
5258 </row>
5259 <row>
5260 <entry>IHostNetworkInterface::dhcpEnabled</entry>
5261 <entry><link linkend="IHostNetworkInterface__DHCPEnabled">IHostNetworkInterface::DHCPEnabled</link></entry>
5262 </row>
5263 <row>
5264 <entry>IHostNetworkInterface::enableStaticIpConfig()</entry>
5265 <entry><link linkend="IHostNetworkInterface__enableStaticIPConfig">IHostNetworkInterface::enableStaticIPConfig()</link></entry>
5266 </row>
5267 <row>
5268 <entry>IHostNetworkInterface::enableStaticIpConfigV6()</entry>
5269 <entry><link linkend="IHostNetworkInterface__enableStaticIPConfigV6">IHostNetworkInterface::enableStaticIPConfigV6()</link></entry>
5270 </row>
5271 <row>
5272 <entry>IHostNetworkInterface::enableDynamicIpConfig()</entry>
5273 <entry><link linkend="IHostNetworkInterface__enableDynamicIPConfig">IHostNetworkInterface::enableDynamicIPConfig()</link></entry>
5274 </row>
5275 <row>
5276 <entry>IHostNetworkInterface::dhcpRediscover()</entry>
5277 <entry><link linkend="IHostNetworkInterface__DHCPRediscover">IHostNetworkInterface::DHCPRediscover()</link></entry>
5278 </row>
5279 <row>
5280 <entry>IHost::Acceleration3DAvailable</entry>
5281 <entry><link linkend="IHost__acceleration3DAvailable">IHost::acceleration3DAvailable</link></entry>
5282 </row>
5283 <row>
5284 <entry>IGuestOSType::recommendedPae</entry>
5285 <entry><link linkend="IGuestOSType__recommendedPAE">IGuestOSType::recommendedPAE</link></entry>
5286 </row>
5287 <row>
5288 <entry>IGuestOSType::recommendedDvdStorageController</entry>
5289 <entry><link linkend="IGuestOSType__recommendedDVDStorageController">IGuestOSType::recommendedDVDStorageController</link></entry>
5290 </row>
5291 <row>
5292 <entry>IGuestOSType::recommendedDvdStorageBus</entry>
5293 <entry><link linkend="IGuestOSType__recommendedDVDStorageBus">IGuestOSType::recommendedDVDStorageBus</link></entry>
5294 </row>
5295 <row>
5296 <entry>IGuestOSType::recommendedHdStorageController</entry>
5297 <entry><link linkend="IGuestOSType__recommendedHDStorageController">IGuestOSType::recommendedHDStorageController</link></entry>
5298 </row>
5299 <row>
5300 <entry>IGuestOSType::recommendedHdStorageBus</entry>
5301 <entry><link linkend="IGuestOSType__recommendedHDStorageBus">IGuestOSType::recommendedHDStorageBus</link></entry>
5302 </row>
5303 <row>
5304 <entry>IGuestOSType::recommendedUsbHid</entry>
5305 <entry><link linkend="IGuestOSType__recommendedUSBHID">IGuestOSType::recommendedUSBHID</link></entry>
5306 </row>
5307 <row>
5308 <entry>IGuestOSType::recommendedHpet</entry>
5309 <entry><link linkend="IGuestOSType__recommendedHPET">IGuestOSType::recommendedHPET</link></entry>
5310 </row>
5311 <row>
5312 <entry>IGuestOSType::recommendedUsbTablet</entry>
5313 <entry><link linkend="IGuestOSType__recommendedUSBTablet">IGuestOSType::recommendedUSBTablet</link></entry>
5314 </row>
5315 <row>
5316 <entry>IGuestOSType::recommendedRtcUseUtc</entry>
5317 <entry><link linkend="IGuestOSType__recommendedRTCUseUTC">IGuestOSType::recommendedRTCUseUTC</link></entry>
5318 </row>
5319 <row>
5320 <entry>IGuestOSType::recommendedUsb</entry>
5321 <entry><link linkend="IGuestOSType__recommendedUSB">IGuestOSType::recommendedUSB</link></entry>
5322 </row>
5323 <row>
5324 <entry>INetworkAdapter::natDriver</entry>
5325 <entry><link linkend="INetworkAdapter__NATEngine">INetworkAdapter::NATEngine</link></entry>
5326 </row>
5327 <row>
5328 <entry>IUSBController::enabledEhci</entry>
5329 <entry>IUSBController::enabledEHCI"</entry>
5330 </row>
5331 <row>
5332 <entry>INATEngine::tftpPrefix</entry>
5333 <entry><link linkend="INATEngine__TFTPPrefix">INATEngine::TFTPPrefix</link></entry>
5334 </row>
5335 <row>
5336 <entry>INATEngine::tftpBootFile</entry>
5337 <entry><link linkend="INATEngine__TFTPBootFile">INATEngine::TFTPBootFile</link></entry>
5338 </row>
5339 <row>
5340 <entry>INATEngine::tftpNextServer</entry>
5341 <entry><link linkend="INATEngine__TFTPNextServer">INATEngine::TFTPNextServer</link></entry>
5342 </row>
5343 <row>
5344 <entry>INATEngine::dnsPassDomain</entry>
5345 <entry><link linkend="INATEngine__DNSPassDomain">INATEngine::DNSPassDomain</link></entry>
5346 </row>
5347 <row>
5348 <entry>INATEngine::dnsProxy</entry>
5349 <entry><link linkend="INATEngine__DNSProxy">INATEngine::DNSProxy</link></entry>
5350 </row>
5351 <row>
5352 <entry>INATEngine::dnsUseHostResolver</entry>
5353 <entry><link linkend="INATEngine__DNSUseHostResolver">INATEngine::DNSUseHostResolver</link></entry>
5354 </row>
5355 <row>
5356 <entry>VBoxEventType::OnHostPciDevicePlug</entry>
5357 <entry><link linkend="VBoxEventType__OnHostPCIDevicePlug">VBoxEventType::OnHostPCIDevicePlug</link></entry>
5358 </row>
5359 <row>
5360 <entry>ICPUChangedEvent::cpu</entry>
5361 <entry><link linkend="ICPUChangedEvent__CPU">ICPUChangedEvent::CPU</link></entry>
5362 </row>
5363 <row>
5364 <entry>INATRedirectEvent::hostIp</entry>
5365 <entry><link linkend="INATRedirectEvent__hostIP">INATRedirectEvent::hostIP</link></entry>
5366 </row>
5367 <row>
5368 <entry>INATRedirectEvent::guestIp</entry>
5369 <entry><link linkend="INATRedirectEvent__guestIP">INATRedirectEvent::guestIP</link></entry>
5370 </row>
5371 <row>
5372 <entry>IHostPciDevicePlugEvent</entry>
5373 <entry><link linkend="IHostPCIDevicePlugEvent">IHostPCIDevicePlugEvent</link></entry>
5374 </row>
5375 </tbody>
5376 </tgroup></table></para>
5377 </listitem>
5378 </itemizedlist>
5379 </sect1>
5380
5381 <sect1>
5382 <title>Incompatible API changes with version 4.1</title>
5383
5384 <itemizedlist>
5385 <listitem>
5386 <para>The method
5387 <link linkend="IAppliance__importMachines">IAppliance::importMachines()</link>
5388 has one more parameter now, which allows to configure the import
5389 process in more detail.
5390 </para>
5391 </listitem>
5392
5393 <listitem>
5394 <para>The method
5395 <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>
5396 has one more parameter now, which allows resolving duplicate medium
5397 UUIDs without the need for external tools.</para>
5398 </listitem>
5399
5400 <listitem>
5401 <para>The <link linkend="INetworkAdapter">INetworkAdapter</link>
5402 interface has been cleaned up. The various methods to activate an
5403 attachment type have been replaced by the
5404 <link linkend="INetworkAdapter__attachmentType">INetworkAdapter::attachmentType</link>
5405 setter.</para>
5406 <para>Additionally each attachment mode now has its own attribute,
5407 which means that host only networks no longer share the settings with
5408 bridged interfaces.</para>
5409 <para>To allow introducing new network attachment implementations
5410 without making API changes, the concept of a generic network
5411 attachment driver has been introduced, which is configurable through
5412 key/value properties.</para>
5413 </listitem>
5414
5415 <listitem>
5416 <para>This version introduces the guest facilities concept. A guest
5417 facility either represents a module or feature the guest is running
5418 or offering, which is defined by
5419 <link linkend="AdditionsFacilityType">AdditionsFacilityType</link>.
5420 Each facility is member of a
5421 <link linkend="AdditionsFacilityClass">AdditionsFacilityClass</link>
5422 and has a current status indicated by
5423 <link linkend="AdditionsFacilityStatus">AdditionsFacilityStatus</link>,
5424 together with a timestamp (in ms) of the last status update.</para>
5425 <para>To address the above concept, the following changes were made:
5426 <itemizedlist>
5427 <listitem>
5428 <para>
5429 In the <link linkend="IGuest">IGuest</link> interface, the
5430 following were removed:
5431 <itemizedlist>
5432 <listitem>
5433 <para>the
5434 <computeroutput>supportsSeamless</computeroutput>
5435 attribute;</para>
5436 </listitem>
5437 <listitem>
5438 <para>the
5439 <computeroutput>supportsGraphics</computeroutput>
5440 attribute;</para>
5441 </listitem>
5442 </itemizedlist>
5443 </para>
5444 </listitem>
5445 <listitem>
5446 <para>
5447 The function
5448 <link linkend="IGuest__getFacilityStatus">IGuest::getFacilityStatus()</link>
5449 was added. It quickly provides a facility's status without
5450 the need to get the facility collection with
5451 <link linkend="IGuest__facilities">IGuest::facilities</link>.
5452 </para>
5453 </listitem>
5454 <listitem>
5455 <para>
5456 The attribute
5457 <link linkend="IGuest__facilities">IGuest::facilities</link>
5458 was added to provide an easy to access collection of all
5459 currently known guest facilities, that is, it contains all
5460 facilies where at least one status update was made since the
5461 guest was started.
5462 </para>
5463 </listitem>
5464 <listitem>
5465 <para>
5466 The interface
5467 <link linkend="IAdditionsFacility">IAdditionsFacility</link>
5468 was added to represent a single facility returned by
5469 <link linkend="IGuest__facilities">IGuest::facilities</link>.
5470 </para>
5471 </listitem>
5472 <listitem>
5473 <para>
5474 <link linkend="AdditionsFacilityStatus">AdditionsFacilityStatus</link>
5475 was added to represent a facility's overall status.
5476 </para>
5477 </listitem>
5478 <listitem>
5479 <para>
5480 <link linkend="AdditionsFacilityType">AdditionsFacilityType</link> and
5481 <link linkend="AdditionsFacilityClass">AdditionsFacilityClass</link> were
5482 added to represent the facility's type and class.
5483 </para>
5484 </listitem>
5485 </itemizedlist>
5486 </para>
5487 </listitem>
5488 </itemizedlist>
5489 </sect1>
5490
5491 <sect1>
5492 <title>Incompatible API changes with version 4.0</title>
5493
5494 <itemizedlist>
5495 <listitem>
5496 <para>A new Java glue layer replacing the previous OOWS JAX-WS
5497 bindings was introduced. The new library allows for uniform code
5498 targeting both local (COM/XPCOM) and remote (SOAP) transports. Now,
5499 instead of <computeroutput>IWebsessionManager</computeroutput>, the
5500 new class <computeroutput>VirtualBoxManager</computeroutput> must be
5501 used. See <xref linkend="javaapi"/> for details.</para>
5502 </listitem>
5503
5504 <listitem>
5505 <para>The confusingly named and impractical session APIs were
5506 changed. In existing client code, the following changes need to be
5507 made:<itemizedlist>
5508 <listitem>
5509 <para>Replace any
5510 <computeroutput>IVirtualBox::openSession(uuidMachine,
5511 ...)</computeroutput> API call with the machine's
5512 <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
5513 call and a
5514 <computeroutput>LockType.Write</computeroutput> argument. The
5515 functionality is unchanged, but instead of "opening a direct
5516 session on a machine" all documentation now refers to
5517 "obtaining a write lock on a machine for the client
5518 session".</para>
5519 </listitem>
5520
5521 <listitem>
5522 <para>Similarly, replace any
5523 <computeroutput>IVirtualBox::openExistingSession(uuidMachine,
5524 ...)</computeroutput> call with the machine's
5525 <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
5526 call and a <computeroutput>LockType.Shared</computeroutput>
5527 argument. Whereas it was previously impossible to connect a
5528 client session to a running VM process in a race-free manner,
5529 the new API will atomically either write-lock the machine for
5530 the current session or establish a remote link to an existing
5531 session. Existing client code which tried calling both
5532 <computeroutput>openSession()</computeroutput> and
5533 <computeroutput>openExistingSession()</computeroutput> can now
5534 use this one call instead.</para>
5535 </listitem>
5536
5537 <listitem>
5538 <para>Third, replace any
5539 <computeroutput>IVirtualBox::openRemoteSession(uuidMachine,
5540 ...)</computeroutput> call with the machine's
5541 <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>
5542 call. The functionality is unchanged.</para>
5543 </listitem>
5544
5545 <listitem>
5546 <para>The <link linkend="SessionState">SessionState</link> enum
5547 was adjusted accordingly: "Open" is now "Locked", "Closed" is
5548 now "Unlocked", "Closing" is now "Unlocking".</para>
5549 </listitem>
5550 </itemizedlist></para>
5551 </listitem>
5552
5553 <listitem>
5554 <para>Virtual machines created with VirtualBox 4.0 or later no
5555 longer register their media in the global media registry in the
5556 <computeroutput>VirtualBox.xml</computeroutput> file. Instead, such
5557 machines list all their media in their own machine XML files. As a
5558 result, a number of media-related APIs had to be modified again.
5559 <itemizedlist>
5560 <listitem>
5561 <para>Neither
5562 <computeroutput>IVirtualBox::createHardDisk()</computeroutput>
5563 nor
5564 <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>
5565 register media automatically any more.</para>
5566 </listitem>
5567
5568 <listitem>
5569 <para><link linkend="IMachine__attachDevice">IMachine::attachDevice()</link>
5570 and
5571 <link linkend="IMachine__mountMedium">IMachine::mountMedium()</link>
5572 now take an IMedium object instead of a UUID as an argument. It
5573 is these two calls which add media to a registry now (either a
5574 machine registry for machines created with VirtualBox 4.0 or
5575 later or the global registry otherwise). As a consequence, if a
5576 medium is opened but never attached to a machine, it is no
5577 longer added to any registry any more.</para>
5578 </listitem>
5579
5580 <listitem>
5581 <para>To reduce code duplication, the APIs
5582 IVirtualBox::findHardDisk(), getHardDisk(), findDVDImage(),
5583 getDVDImage(), findFloppyImage() and getFloppyImage() have all
5584 been merged into IVirtualBox::findMedium(), and
5585 IVirtualBox::openHardDisk(), openDVDImage() and
5586 openFloppyImage() have all been merged into
5587 <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>.</para>
5588 </listitem>
5589
5590 <listitem>
5591 <para>The rare use case of changing the UUID and parent UUID
5592 of a medium previously handled by
5593 <computeroutput>openHardDisk()</computeroutput> is now in a
5594 separate IMedium::setIDs method.</para>
5595 </listitem>
5596
5597 <listitem>
5598 <para><computeroutput>ISystemProperties::get/setDefaultHardDiskFolder()</computeroutput>
5599 have been removed since disk images are now by default placed
5600 in each machine's folder.</para>
5601 </listitem>
5602
5603 <listitem>
5604 <para>The
5605 <link linkend="ISystemProperties__infoVDSize">ISystemProperties::infoVDSize</link>
5606 attribute replaces the
5607 <computeroutput>getMaxVDISize()</computeroutput>
5608 API call; this now uses bytes instead of megabytes.</para>
5609 </listitem>
5610 </itemizedlist></para>
5611 </listitem>
5612
5613 <listitem>
5614 <para>Machine management APIs were enhanced as follows:<itemizedlist>
5615 <listitem>
5616 <para><link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
5617 is no longer restricted to creating machines in the default
5618 "Machines" folder, but can now create machines at arbitrary
5619 locations. For this to work, the parameter list had to be
5620 changed.</para>
5621 </listitem>
5622
5623 <listitem>
5624 <para>The long-deprecated
5625 <computeroutput>IVirtualBox::createLegacyMachine()</computeroutput>
5626 API has been removed.</para>
5627 </listitem>
5628
5629 <listitem>
5630 <para>To reduce code duplication and for consistency with the
5631 aforementioned media APIs,
5632 <computeroutput>IVirtualBox::getMachine()</computeroutput> has
5633 been merged with
5634 <link linkend="IVirtualBox__findMachine">IVirtualBox::findMachine()</link>,
5635 and
5636 <computeroutput>IMachine::getSnapshot()</computeroutput> has
5637 been merged with
5638 <link linkend="IMachine__findSnapshot">IMachine::findSnapshot()</link>.</para>
5639 </listitem>
5640
5641 <listitem>
5642 <para><computeroutput>IVirtualBox::unregisterMachine()</computeroutput>
5643 was replaced with
5644 <link linkend="IMachine__unregister">IMachine::unregister()</link>
5645 with additional functionality for cleaning up machine
5646 files.</para>
5647 </listitem>
5648
5649 <listitem>
5650 <para><computeroutput>IMachine::deleteSettings</computeroutput>
5651 has been replaced by IMachine::delete, which allows specifying
5652 which disk images are to be deleted as part of the deletion,
5653 and because it can take a while it also returns a
5654 <computeroutput>IProgress</computeroutput> object reference,
5655 so that the completion of the asynchronous activities can be
5656 monitored.</para>
5657 </listitem>
5658
5659 <listitem>
5660 <para><computeroutput>IConsole::forgetSavedState</computeroutput>
5661 has been renamed to
5662 <computeroutput>IConsole::discardSavedState()</computeroutput>.</para>
5663 </listitem>
5664 </itemizedlist></para>
5665 </listitem>
5666
5667 <listitem>
5668 <para>All event callbacks APIs were replaced with a new, generic
5669 event mechanism that can be used both locally (COM, XPCOM) and
5670 remotely (web services). Also, the new mechanism is usable from
5671 scripting languages and a local Java. See
5672 <link linkend="IEvent">events</link> for details. The new concept
5673 will require changes to all clients that used event callbacks.</para>
5674 </listitem>
5675
5676 <listitem>
5677 <para><computeroutput>additionsActive()</computeroutput> was replaced
5678 with
5679 <link linkend="IGuest__additionsRunLevel">additionsRunLevel()</link>
5680 and
5681 <link linkend="IGuest__getAdditionsStatus">getAdditionsStatus()</link>
5682 in order to support a more detailed status of the current Guest
5683 Additions loading/readiness state.
5684 <link linkend="IGuest__additionsVersion">IGuest::additionsVersion()</link>
5685 no longer returns the Guest Additions interface version but the
5686 installed Guest Additions version and revision in form of
5687 <computeroutput>3.3.0r12345</computeroutput>.</para>
5688 </listitem>
5689
5690 <listitem>
5691 <para>To address shared folders auto-mounting support, the following
5692 APIs were extended to require an additional
5693 <computeroutput>automount</computeroutput> parameter: <itemizedlist>
5694 <listitem>
5695 <para><link linkend="IVirtualBox__createSharedFolder">IVirtualBox::createSharedFolder()</link></para>
5696 </listitem>
5697
5698 <listitem>
5699 <para><link linkend="IMachine__createSharedFolder">IMachine::createSharedFolder()</link></para>
5700 </listitem>
5701
5702 <listitem>
5703 <para><link linkend="IConsole__createSharedFolder">IConsole::createSharedFolder()</link></para>
5704 </listitem>
5705 </itemizedlist> Also, a new property named
5706 <computeroutput>autoMount</computeroutput> was added to the
5707 <link linkend="ISharedFolder">ISharedFolder</link>
5708 interface.</para>
5709 </listitem>
5710
5711 <listitem>
5712 <para>The appliance (OVF) APIs were enhanced as
5713 follows:<itemizedlist>
5714 <listitem>
5715 <para><computeroutput>IMachine::export</computeroutput>
5716 received an extra parameter
5717 <computeroutput>location</computeroutput>, which is used to
5718 decide for the disk naming.</para>
5719 </listitem>
5720
5721 <listitem>
5722 <para><link linkend="IAppliance__write">IAppliance::write()</link>
5723 received an extra parameter
5724 <computeroutput>manifest</computeroutput>, which can suppress
5725 creating the manifest file on export.</para>
5726 </listitem>
5727
5728 <listitem>
5729 <para><link linkend="IVFSExplorer__entryList">IVFSExplorer::entryList()</link>
5730 received two extra parameters
5731 <computeroutput>sizes</computeroutput> and
5732 <computeroutput>modes</computeroutput>, which contains the
5733 sizes (in bytes) and the file access modes (in octal form) of
5734 the returned files.</para>
5735 </listitem>
5736 </itemizedlist></para>
5737 </listitem>
5738
5739 <listitem>
5740 <para>Support for remote desktop access to virtual machines has been
5741 cleaned up to allow third party implementations of the remote
5742 desktop server. This is called the VirtualBox Remote Desktop
5743 Extension (VRDE) and can be added to VirtualBox by installing the
5744 corresponding extension package; see the VirtualBox User Manual for
5745 details.</para>
5746
5747 <para>The following API changes were made to support the VRDE
5748 interface: <itemizedlist>
5749 <listitem>
5750 <para><computeroutput>IVRDPServer</computeroutput> has been
5751 renamed to
5752 <link linkend="IVRDEServer">IVRDEServer</link>.</para>
5753 </listitem>
5754
5755 <listitem>
5756 <para><computeroutput>IRemoteDisplayInfo</computeroutput> has
5757 been renamed to
5758 <link linkend="IVRDEServerInfo">IVRDEServerInfo</link>.</para>
5759 </listitem>
5760
5761 <listitem>
5762 <para><link linkend="IMachine__VRDEServer">IMachine::VRDEServer</link>
5763 replaces
5764 <computeroutput>VRDPServer.</computeroutput></para>
5765 </listitem>
5766
5767 <listitem>
5768 <para><link linkend="IConsole__VRDEServerInfo">IConsole::VRDEServerInfo</link>
5769 replaces
5770 <computeroutput>RemoteDisplayInfo</computeroutput>.</para>
5771 </listitem>
5772
5773 <listitem>
5774 <para><link linkend="ISystemProperties__VRDEAuthLibrary">ISystemProperties::VRDEAuthLibrary</link>
5775 replaces
5776 <computeroutput>RemoteDisplayAuthLibrary</computeroutput>.</para>
5777 </listitem>
5778
5779 <listitem>
5780 <para>The following methods have been implemented in
5781 <computeroutput>IVRDEServer</computeroutput> to support
5782 generic VRDE properties: <itemizedlist>
5783 <listitem>
5784 <para><link linkend="IVRDEServer__setVRDEProperty">IVRDEServer::setVRDEProperty</link></para>
5785 </listitem>
5786
5787 <listitem>
5788 <para><link linkend="IVRDEServer__getVRDEProperty">IVRDEServer::getVRDEProperty</link></para>
5789 </listitem>
5790
5791 <listitem>
5792 <para><link linkend="IVRDEServer__VRDEProperties">IVRDEServer::VRDEProperties</link></para>
5793 </listitem>
5794 </itemizedlist></para>
5795
5796 <para>A few implementation-specific attributes of the old
5797 <computeroutput>IVRDPServer</computeroutput> interface have
5798 been removed and replaced with properties: <itemizedlist>
5799 <listitem>
5800 <para><computeroutput>IVRDPServer::Ports</computeroutput>
5801 has been replaced with the
5802 <computeroutput>"TCP/Ports"</computeroutput> property.
5803 The property value is a string, which contains a
5804 comma-separated list of ports or ranges of ports. Use a
5805 dash between two port numbers to specify a range.
5806 Example:
5807 <computeroutput>"5000,5010-5012"</computeroutput></para>
5808 </listitem>
5809
5810 <listitem>
5811 <para><computeroutput>IVRDPServer::NetAddress</computeroutput>
5812 has been replaced with the
5813 <computeroutput>"TCP/Address"</computeroutput> property.
5814 The property value is an IP address string. Example:
5815 <computeroutput>"127.0.0.1"</computeroutput></para>
5816 </listitem>
5817
5818 <listitem>
5819 <para><computeroutput>IVRDPServer::VideoChannel</computeroutput>
5820 has been replaced with the
5821 <computeroutput>"VideoChannel/Enabled"</computeroutput>
5822 property. The property value is either
5823 <computeroutput>"true"</computeroutput> or
5824 <computeroutput>"false"</computeroutput></para>
5825 </listitem>
5826
5827 <listitem>
5828 <para><computeroutput>IVRDPServer::VideoChannelQuality</computeroutput>
5829 has been replaced with the
5830 <computeroutput>"VideoChannel/Quality"</computeroutput>
5831 property. The property value is a string which contain a
5832 decimal number in range 10..100. Invalid values are
5833 ignored and the quality is set to the default value 75.
5834 Example: <computeroutput>"50"</computeroutput></para>
5835 </listitem>
5836 </itemizedlist></para>
5837 </listitem>
5838 </itemizedlist></para>
5839 </listitem>
5840
5841 <listitem>
5842 <para>The VirtualBox external authentication module interface has
5843 been updated and made more generic. Because of that,
5844 <computeroutput>VRDPAuthType</computeroutput> enumeration has been
5845 renamed to <link linkend="AuthType">AuthType</link>.</para>
5846 </listitem>
5847 </itemizedlist>
5848 </sect1>
5849
5850 <sect1>
5851 <title>Incompatible API changes with version 3.2</title>
5852
5853 <itemizedlist>
5854 <listitem>
5855 <para>The following interfaces were renamed for consistency:
5856 <itemizedlist>
5857 <listitem>
5858 <para>IMachine::getCpuProperty() is now IMachine::getCPUProperty();</para>
5859 </listitem>
5860
5861 <listitem>
5862 <para>IMachine::setCpuProperty() is now IMachine::setCPUProperty();</para>
5863 </listitem>
5864
5865 <listitem>
5866 <para>IMachine::getCpuIdLeaf() is now IMachine::getCPUIDLeaf();</para>
5867 </listitem>
5868
5869 <listitem>
5870 <para>IMachine::setCpuIdLeaf() is now IMachine::setCPUIDLeaf();</para>
5871 </listitem>
5872
5873 <listitem>
5874 <para>IMachine::removeCpuIdLeaf() is now IMachine::removeCPUIDLeaf();</para>
5875 </listitem>
5876
5877 <listitem>
5878 <para>IMachine::removeAllCpuIdLeafs() is now IMachine::removeAllCPUIDLeaves();</para>
5879 </listitem>
5880
5881 <listitem>
5882 <para>the CpuPropertyType enum is now CPUPropertyType.</para>
5883 </listitem>
5884
5885 <listitem>
5886 <para>IVirtualBoxCallback::onSnapshotDiscarded() is now
5887 IVirtualBoxCallback::onSnapshotDeleted.</para>
5888 </listitem>
5889 </itemizedlist></para>
5890 </listitem>
5891
5892 <listitem>
5893 <para>When creating a VM configuration with
5894 <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
5895 it is now possible to ignore existing configuration files which would
5896 previously have caused a failure. For this the
5897 <computeroutput>override</computeroutput> parameter was added.</para>
5898 </listitem>
5899
5900 <listitem>
5901 <para>Deleting snapshots via
5902 <computeroutput>IConsole::deleteSnapshot()</computeroutput> is now
5903 possible while the associated VM is running in almost all cases.
5904 The API is unchanged, but client code that verifies machine states
5905 to determine whether snapshots can be deleted may need to be
5906 adjusted.</para>
5907 </listitem>
5908
5909 <listitem>
5910 <para>The IoBackendType enumeration was replaced with a boolean flag
5911 (see
5912 <link linkend="IStorageController__useHostIOCache">IStorageController::useHostIOCache</link>).</para>
5913 </listitem>
5914
5915 <listitem>
5916 <para>To address multi-monitor support, the following APIs were
5917 extended to require an additional
5918 <computeroutput>screenId</computeroutput> parameter: <itemizedlist>
5919 <listitem>
5920 <para>IMachine::querySavedThumbnailSize()</para>
5921 </listitem>
5922
5923 <listitem>
5924 <para><link linkend="IMachine__readSavedThumbnailToArray">IMachine::readSavedThumbnailToArray()</link></para>
5925 </listitem>
5926
5927 <listitem>
5928 <para><link linkend="IMachine__querySavedScreenshotInfo">IMachine::querySavedScreenshotPNGSize()</link></para>
5929 </listitem>
5930
5931 <listitem>
5932 <para><link linkend="IMachine__readSavedScreenshotToArray">IMachine::readSavedScreenshotPNGToArray()</link></para>
5933 </listitem>
5934 </itemizedlist></para>
5935 </listitem>
5936
5937 <listitem>
5938 <para>The <computeroutput>shape</computeroutput> parameter of
5939 IConsoleCallback::onMousePointerShapeChange was changed from a
5940 implementation-specific pointer to a safearray, enabling scripting
5941 languages to process pointer shapes.</para>
5942 </listitem>
5943 </itemizedlist>
5944 </sect1>
5945
5946 <sect1>
5947 <title>Incompatible API changes with version 3.1</title>
5948
5949 <itemizedlist>
5950 <listitem>
5951 <para>Due to the new flexibility in medium attachments that was
5952 introduced with version 3.1 (in particular, full flexibility with
5953 attaching CD/DVD drives to arbitrary controllers), we seized the
5954 opportunity to rework all interfaces dealing with storage media to
5955 make the API more flexible as well as logical. The
5956 <link linkend="IStorageController">IStorageController</link>,
5957 <link linkend="IMedium">IMedium</link>,
5958 <link linkend="IMediumAttachment">IMediumAttachment</link> and
5959 <link linkend="IMachine">IMachine</link> interfaces were
5960 affected the most. Existing code using them to configure storage and
5961 media needs to be carefully checked.</para>
5962
5963 <para>All media (hard disks, floppies and CDs/DVDs) are now
5964 uniformly handled through the <link linkend="IMedium">IMedium</link>
5965 interface. The device-specific interfaces
5966 (<code>IHardDisk</code>, <code>IDVDImage</code>,
5967 <code>IHostDVDDrive</code>, <code>IFloppyImage</code> and
5968 <code>IHostFloppyDrive</code>) have been merged into IMedium; CD/DVD
5969 and floppy media no longer need special treatment. The device type
5970 of a medium determines in which context it can be used. Some
5971 functionality was moved to the other storage-related
5972 interfaces.</para>
5973
5974 <para><code>IMachine::attachHardDisk</code> and similar methods have
5975 been renamed and generalized to deal with any type of drive and
5976 medium.
5977 <link linkend="IMachine__attachDevice">IMachine::attachDevice()</link>
5978 is the API method for adding any drive to a storage controller. The
5979 floppy and DVD/CD drives are no longer handled specially, and that
5980 means you can have more than one of them. As before, drives can only
5981 be changed while the VM is powered off. Mounting (or unmounting)
5982 removable media at runtime is possible with
5983 <link linkend="IMachine__mountMedium">IMachine::mountMedium()</link>.</para>
5984
5985 <para>Newly created virtual machines have no storage controllers
5986 associated with them. Even the IDE Controller needs to be created
5987 explicitly. The floppy controller is now visible as a separate
5988 controller, with a new storage bus type. For each storage bus type
5989 you can query the device types which can be attached, so that it is
5990 not necessary to hardcode any attachment rules.</para>
5991
5992 <para>This required matching changes e.g. in the callback interfaces
5993 (the medium specific change notification was replaced by a generic
5994 medium change notification) and removing associated enums (e.g.
5995 <code>DriveState</code>). In many places the incorrect use of the
5996 plural form "media" was replaced by "medium", to improve
5997 consistency.</para>
5998 </listitem>
5999
6000 <listitem>
6001 <para>Reading the
6002 <link linkend="IMedium__state">IMedium::state</link> attribute no
6003 longer automatically performs an accessibility check; a new method
6004 <link linkend="IMedium__refreshState">IMedium::refreshState()</link>
6005 does this. The attribute only returns the state now.</para>
6006 </listitem>
6007
6008 <listitem>
6009 <para>There were substantial changes related to snapshots, triggered
6010 by the "branched snapshots" functionality introduced with version
6011 3.1. IConsole::discardSnapshot was renamed to
6012 <computeroutput>IConsole::deleteSnapshot()</computeroutput>.
6013 IConsole::discardCurrentState and
6014 IConsole::discardCurrentSnapshotAndState were removed; corresponding
6015 new functionality is in
6016 <computeroutput>IConsole::restoreSnapshot()</computeroutput>.
6017 Also, when <computeroutput>IConsole::takeSnapshot()</computeroutput>
6018 is called on a running virtual machine, a live snapshot will be
6019 created. The old behavior was to temporarily pause the virtual
6020 machine while creating an online snapshot.</para>
6021 </listitem>
6022
6023 <listitem>
6024 <para>The <computeroutput>IVRDPServer</computeroutput>,
6025 <computeroutput>IRemoteDisplayInfo"</computeroutput> and
6026 <computeroutput>IConsoleCallback</computeroutput> interfaces were
6027 changed to reflect VRDP server ability to bind to one of available
6028 ports from a list of ports.</para>
6029
6030 <para>The <computeroutput>IVRDPServer::port</computeroutput>
6031 attribute has been replaced with
6032 <computeroutput>IVRDPServer::ports</computeroutput>, which is a
6033 comma-separated list of ports or ranges of ports.</para>
6034
6035 <para>An <computeroutput>IRemoteDisplayInfo::port"</computeroutput>
6036 attribute has been added for querying the actual port VRDP server
6037 listens on.</para>
6038
6039 <para>An IConsoleCallback::onRemoteDisplayInfoChange() notification
6040 callback has been added.</para>
6041 </listitem>
6042
6043 <listitem>
6044 <para>The parameter lists for the following functions were
6045 modified:<itemizedlist>
6046 <listitem>
6047 <para><link linkend="IHost__removeHostOnlyNetworkInterface">IHost::removeHostOnlyNetworkInterface()</link></para>
6048 </listitem>
6049
6050 <listitem>
6051 <para><link linkend="IHost__removeUSBDeviceFilter">IHost::removeUSBDeviceFilter()</link></para>
6052 </listitem>
6053 </itemizedlist></para>
6054 </listitem>
6055
6056 <listitem>
6057 <para>In the OOWS bindings for JAX-WS, the behavior of structures
6058 changed: for one, we implemented natural structures field access so
6059 you can just call a "get" method to obtain a field. Secondly,
6060 setters in structures were disabled as they have no expected effect
6061 and were at best misleading.</para>
6062 </listitem>
6063 </itemizedlist>
6064 </sect1>
6065
6066 <sect1>
6067 <title>Incompatible API changes with version 3.0</title>
6068
6069 <itemizedlist>
6070 <listitem>
6071 <para>In the object-oriented web service bindings for JAX-WS, proper
6072 inheritance has been introduced for some classes, so explicit
6073 casting is no longer needed to call methods from a parent class. In
6074 particular, IHardDisk and other classes now properly derive from
6075 <link linkend="IMedium">IMedium</link>.</para>
6076 </listitem>
6077
6078 <listitem>
6079 <para>All object identifiers (machines, snapshots, disks, etc)
6080 switched from GUIDs to strings (now still having string
6081 representation of GUIDs inside). As a result, no particular internal
6082 structure can be assumed for object identifiers; instead, they
6083 should be treated as opaque unique handles. This change mostly
6084 affects Java and C++ programs; for other languages, GUIDs are
6085 transparently converted to strings.</para>
6086 </listitem>
6087
6088 <listitem>
6089 <para>The uses of NULL strings have been changed greatly. All out
6090 parameters now use empty strings to signal a null value. For in
6091 parameters both the old NULL and empty string is allowed. This
6092 change was necessary to support more client bindings, especially
6093 using the web service API. Many of them either have no special NULL
6094 value or have trouble dealing with it correctly in the respective
6095 library code.</para>
6096 </listitem>
6097
6098 <listitem>
6099 <para>Accidentally, the <code>TSBool</code> interface still appeared
6100 in 3.0.0, and was removed in 3.0.2. This is an SDK bug, do not use
6101 the SDK for VirtualBox 3.0.0 for developing clients.</para>
6102 </listitem>
6103
6104 <listitem>
6105 <para>The type of
6106 <link linkend="IVirtualBoxErrorInfo__resultCode">IVirtualBoxErrorInfo::resultCode</link>
6107 changed from
6108 <computeroutput>result</computeroutput> to
6109 <computeroutput>long</computeroutput>.</para>
6110 </listitem>
6111
6112 <listitem>
6113 <para>The parameter list of IVirtualBox::openHardDisk was
6114 changed.</para>
6115 </listitem>
6116
6117 <listitem>
6118 <para>The method IConsole::discardSavedState was renamed to
6119 IConsole::forgetSavedState, and a parameter was added.</para>
6120 </listitem>
6121
6122 <listitem>
6123 <para>The method IConsole::powerDownAsync was renamed to
6124 <link linkend="IConsole__powerDown">IConsole::powerDown</link>,
6125 and the previous method with that name was deleted. So effectively a
6126 parameter was added.</para>
6127 </listitem>
6128
6129 <listitem>
6130 <para>In the
6131 <link linkend="IFramebuffer">IFramebuffer</link> interface, the
6132 following were removed:<itemizedlist>
6133 <listitem>
6134 <para>the <computeroutput>operationSupported</computeroutput>
6135 attribute;</para>
6136
6137 <para>(as a result, the
6138 <computeroutput>FramebufferAccelerationOperation</computeroutput>
6139 enum was no longer needed and removed as well);</para>
6140 </listitem>
6141
6142 <listitem>
6143 <para>the <computeroutput>solidFill()</computeroutput>
6144 method;</para>
6145 </listitem>
6146
6147 <listitem>
6148 <para>the <computeroutput>copyScreenBits()</computeroutput>
6149 method.</para>
6150 </listitem>
6151 </itemizedlist></para>
6152 </listitem>
6153
6154 <listitem>
6155 <para>In the <link linkend="IDisplay">IDisplay</link>
6156 interface, the following were removed:<itemizedlist>
6157 <listitem>
6158 <para>the
6159 <computeroutput>setupInternalFramebuffer()</computeroutput>
6160 method;</para>
6161 </listitem>
6162
6163 <listitem>
6164 <para>the <computeroutput>lockFramebuffer()</computeroutput>
6165 method;</para>
6166 </listitem>
6167
6168 <listitem>
6169 <para>the <computeroutput>unlockFramebuffer()</computeroutput>
6170 method;</para>
6171 </listitem>
6172
6173 <listitem>
6174 <para>the
6175 <computeroutput>registerExternalFramebuffer()</computeroutput>
6176 method.</para>
6177 </listitem>
6178 </itemizedlist></para>
6179 </listitem>
6180 </itemizedlist>
6181 </sect1>
6182
6183 <sect1>
6184 <title>Incompatible API changes with version 2.2</title>
6185
6186 <itemizedlist>
6187 <listitem>
6188 <para>Added explicit version number into JAX-WS Java package names,
6189 such as <computeroutput>org.virtualbox_2_2</computeroutput>,
6190 allowing connect to multiple VirtualBox clients from single Java
6191 application.</para>
6192 </listitem>
6193
6194 <listitem>
6195 <para>The interfaces having a "2" suffix attached to them with
6196 version 2.1 were renamed again to have that suffix removed. This
6197 time around, this change involves only the name, there are no
6198 functional differences.</para>
6199
6200 <para>As a result, IDVDImage2 is now IDVDImage; IHardDisk2 is now
6201 IHardDisk; IHardDisk2Attachment is now IHardDiskAttachment.</para>
6202
6203 <para>Consequentially, all related methods and attributes that had a
6204 "2" suffix have been renamed; for example, IMachine::attachHardDisk2
6205 now becomes IMachine::attachHardDisk().</para>
6206 </listitem>
6207
6208 <listitem>
6209 <para>IVirtualBox::openHardDisk has an extra parameter for opening a
6210 disk read/write or read-only.</para>
6211 </listitem>
6212
6213 <listitem>
6214 <para>The remaining collections were replaced by more performant
6215 safe-arrays. This affects the following collections:</para>
6216
6217 <itemizedlist>
6218 <listitem>
6219 <para>IGuestOSTypeCollection</para>
6220 </listitem>
6221
6222 <listitem>
6223 <para>IHostDVDDriveCollection</para>
6224 </listitem>
6225
6226 <listitem>
6227 <para>IHostFloppyDriveCollection</para>
6228 </listitem>
6229
6230 <listitem>
6231 <para>IHostUSBDeviceCollection</para>
6232 </listitem>
6233
6234 <listitem>
6235 <para>IHostUSBDeviceFilterCollection</para>
6236 </listitem>
6237
6238 <listitem>
6239 <para>IProgressCollection</para>
6240 </listitem>
6241
6242 <listitem>
6243 <para>ISharedFolderCollection</para>
6244 </listitem>
6245
6246 <listitem>
6247 <para>ISnapshotCollection</para>
6248 </listitem>
6249
6250 <listitem>
6251 <para>IUSBDeviceCollection</para>
6252 </listitem>
6253
6254 <listitem>
6255 <para>IUSBDeviceFilterCollection</para>
6256 </listitem>
6257 </itemizedlist>
6258 </listitem>
6259
6260 <listitem>
6261 <para>Since "Host Interface Networking" was renamed to "bridged
6262 networking" and host-only networking was introduced, all associated
6263 interfaces needed renaming as well. In detail:</para>
6264
6265 <itemizedlist>
6266 <listitem>
6267 <para>The HostNetworkInterfaceType enum has been renamed to
6268 <link linkend="HostNetworkInterfaceMediumType">HostNetworkInterfaceMediumType</link></para>
6269 </listitem>
6270
6271 <listitem>
6272 <para>The IHostNetworkInterface::type attribute has been renamed
6273 to
6274 <link linkend="IHostNetworkInterface__mediumType">IHostNetworkInterface::mediumType</link></para>
6275 </listitem>
6276
6277 <listitem>
6278 <para>INetworkAdapter::attachToHostInterface() has been renamed
6279 to INetworkAdapter::attachToBridgedInterface</para>
6280 </listitem>
6281
6282 <listitem>
6283 <para>In the IHost interface, createHostNetworkInterface() has
6284 been renamed to
6285 <link linkend="IHost__createHostOnlyNetworkInterface">createHostOnlyNetworkInterface()</link></para>
6286 </listitem>
6287
6288 <listitem>
6289 <para>Similarly, removeHostNetworkInterface() has been renamed
6290 to
6291 <link linkend="IHost__removeHostOnlyNetworkInterface">removeHostOnlyNetworkInterface()</link></para>
6292 </listitem>
6293 </itemizedlist>
6294 </listitem>
6295 </itemizedlist>
6296 </sect1>
6297
6298 <sect1>
6299 <title>Incompatible API changes with version 2.1</title>
6300
6301 <itemizedlist>
6302 <listitem>
6303 <para>With VirtualBox 2.1, error codes were added to many error
6304 infos that give the caller a machine-readable (numeric) feedback in
6305 addition to the error string that has always been available. This is
6306 an ongoing process, and future versions of this SDK reference will
6307 document the error codes for each method call.</para>
6308 </listitem>
6309
6310 <listitem>
6311 <para>The hard disk and other media interfaces were completely
6312 redesigned. This was necessary to account for the support of VMDK,
6313 VHD and other image types; since backwards compatibility had to be
6314 broken anyway, we seized the moment to redesign the interfaces in a
6315 more logical way.</para>
6316
6317 <itemizedlist>
6318 <listitem>
6319 <para>Previously, the old IHardDisk interface had several
6320 derivatives called IVirtualDiskImage, IVMDKImage, IVHDImage,
6321 IISCSIHardDisk and ICustomHardDisk for the various disk formats
6322 supported by VirtualBox. The new IHardDisk2 interface that comes
6323 with version 2.1 now supports all hard disk image formats
6324 itself.</para>
6325 </listitem>
6326
6327 <listitem>
6328 <para>IHardDiskFormat is a new interface to describe the
6329 available back-ends for hard disk images (e.g. VDI, VMDK, VHD or
6330 iSCSI). The IHardDisk2::format attribute can be used to find out
6331 the back-end that is in use for a particular hard disk image.
6332 ISystemProperties::hardDiskFormats[] contains a list of all
6333 back-ends supported by the system.
6334 <link linkend="ISystemProperties__defaultHardDiskFormat">ISystemProperties::defaultHardDiskFormat</link>
6335 contains the default system format.</para>
6336 </listitem>
6337
6338 <listitem>
6339 <para>In addition, the new
6340 <link linkend="IMedium">IMedium</link> interface is a generic
6341 interface for hard disk, DVD and floppy images that contains the
6342 attributes and methods shared between them. It can be considered
6343 a parent class of the more specific interfaces for those images,
6344 which are now IHardDisk2, IDVDImage2 and IFloppyImage2.</para>
6345
6346 <para>In each case, the "2" versions of these interfaces replace
6347 the earlier versions that did not have the "2" suffix.
6348 Previously, the IDVDImage and IFloppyImage interfaces were
6349 entirely unrelated to IHardDisk.</para>
6350 </listitem>
6351
6352 <listitem>
6353 <para>As a result, all parts of the API that previously
6354 referenced IHardDisk, IDVDImage or IFloppyImage or any of the
6355 old subclasses are gone and will have replacements that use
6356 IHardDisk2, IDVDImage2 and IFloppyImage2; see, for example,
6357 IMachine::attachHardDisk2.</para>
6358 </listitem>
6359
6360 <listitem>
6361 <para>In particular, the IVirtualBox::hardDisks2 array replaces
6362 the earlier IVirtualBox::hardDisks collection.</para>
6363 </listitem>
6364 </itemizedlist>
6365 </listitem>
6366
6367 <listitem>
6368 <para><link linkend="IGuestOSType">IGuestOSType</link> was
6369 extended to group operating systems into families and for 64-bit
6370 support.</para>
6371 </listitem>
6372
6373 <listitem>
6374 <para>The
6375 <link linkend="IHostNetworkInterface">IHostNetworkInterface</link>
6376 interface was completely rewritten to account for the changes in how
6377 Host Interface Networking is now implemented in VirtualBox
6378 2.1.</para>
6379 </listitem>
6380
6381 <listitem>
6382 <para>The IVirtualBox::machines2[] array replaces the former
6383 IVirtualBox::machines collection.</para>
6384 </listitem>
6385
6386 <listitem>
6387 <para>Added
6388 <link linkend="IHost__getProcessorFeature">IHost::getProcessorFeature()</link>
6389 and <link linkend="ProcessorFeature">ProcessorFeature</link>
6390 enumeration.</para>
6391 </listitem>
6392
6393 <listitem>
6394 <para>The parameter list for
6395 <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
6396 was modified.</para>
6397 </listitem>
6398
6399 <listitem>
6400 <para>Added IMachine::pushGuestProperty.</para>
6401 </listitem>
6402
6403 <listitem>
6404 <para>New attributes in IMachine: accelerate3DEnabled,
6405 HWVirtExVPIDEnabled,
6406 <computeroutput>IMachine::guestPropertyNotificationPatterns</computeroutput>,
6407 <link linkend="IMachine__CPUCount">CPUCount</link>.</para>
6408 </listitem>
6409
6410 <listitem>
6411 <para>Added
6412 <link linkend="IConsole__powerUpPaused">IConsole::powerUpPaused()</link>
6413 and
6414 <link linkend="IConsole__getGuestEnteredACPIMode">IConsole::getGuestEnteredACPIMode()</link>.</para>
6415 </listitem>
6416
6417 <listitem>
6418 <para>Removed ResourceUsage enumeration.</para>
6419 </listitem>
6420 </itemizedlist>
6421 </sect1>
6422 </chapter>
6423</book>
6424<!-- vim: set shiftwidth=2 tabstop=2 expandtab: -->
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use