VirtualBox

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

Last change on this file since 67240 was 61895, checked in by vboxsync, 8 years ago

Build fix.

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

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