1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!--
|
---|
3 | Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
4 |
|
---|
5 | This file is part of VirtualBox base platform packages, as
|
---|
6 | available from https://www.virtualbox.org.
|
---|
7 |
|
---|
8 | This program is free software; you can redistribute it and/or
|
---|
9 | modify it under the terms of the GNU General Public License
|
---|
10 | as published by the Free Software Foundation, in version 3 of the
|
---|
11 | License.
|
---|
12 |
|
---|
13 | This program is distributed in the hope that it will be useful, but
|
---|
14 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
16 | General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU General Public License
|
---|
19 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
20 |
|
---|
21 | SPDX-License-Identifier: GPL-3.0-only
|
---|
22 | -->
|
---|
23 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
24 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
|
---|
25 | <!ENTITY % all.entities SYSTEM "all-entities.ent">
|
---|
26 | %all.entities;
|
---|
27 | ]>
|
---|
28 |
|
---|
29 | <book>
|
---|
30 | <bookinfo>
|
---|
31 | <title>&VBOX_PRODUCT;</title>
|
---|
32 |
|
---|
33 | <subtitle>Programming Guide and Reference</subtitle>
|
---|
34 |
|
---|
35 | <edition>Version &VBOX_VERSION_STRING;</edition>
|
---|
36 |
|
---|
37 | <corpauthor>&VBOX_VENDOR;</corpauthor>
|
---|
38 |
|
---|
39 | <address>http://www.virtualbox.org</address>
|
---|
40 |
|
---|
41 | <copyright>
|
---|
42 | <year>2004-&VBOX_C_YEAR;</year>
|
---|
43 |
|
---|
44 | <holder>&VBOX_VENDOR;</holder>
|
---|
45 | </copyright>
|
---|
46 | </bookinfo>
|
---|
47 |
|
---|
48 | <chapter>
|
---|
49 | <title>Introduction</title>
|
---|
50 |
|
---|
51 | <para>VirtualBox comes with comprehensive support for third-party
|
---|
52 | developers. This Software Development Kit (SDK) contains all the
|
---|
53 | documentation and interface files that are needed to write code that
|
---|
54 | interacts with VirtualBox.</para>
|
---|
55 |
|
---|
56 | <sect1>
|
---|
57 | <title>Modularity: the building blocks of VirtualBox</title>
|
---|
58 |
|
---|
59 | <para>VirtualBox is cleanly separated into several layers, which can be
|
---|
60 | visualized like in the picture below:</para>
|
---|
61 |
|
---|
62 | <mediaobject>
|
---|
63 | <imageobject>
|
---|
64 | <imagedata align="center" fileref="images/vbox-components.png"
|
---|
65 | width="12cm"/>
|
---|
66 | </imageobject>
|
---|
67 | </mediaobject>
|
---|
68 |
|
---|
69 | <para>The orange area represents code that runs in kernel mode, the blue
|
---|
70 | area represents userspace code.</para>
|
---|
71 |
|
---|
72 | <para>At the bottom of the stack resides the hypervisor -- the core of
|
---|
73 | the virtualization engine, controlling execution of the virtual machines
|
---|
74 | and making sure they do not conflict with each other or with whatever else
|
---|
75 | the host computer is doing.</para>
|
---|
76 |
|
---|
77 | <para>On top of the hypervisor, additional internal modules provide
|
---|
78 | extra functionality. For example, the RDP server, which can deliver the
|
---|
79 | graphical output of a VM remotely to an RDP client, is a separate module
|
---|
80 | that is only loosely tacked onto the virtual graphics device.</para>
|
---|
81 |
|
---|
82 | <para>What is primarily of interest for purposes of the SDK is the API
|
---|
83 | layer block that sits on top of all the previously mentioned blocks.
|
---|
84 | This API, which we call the <emphasis role="bold">"Main API"</emphasis>,
|
---|
85 | exposes the entire feature set of the virtualization engine below. It is
|
---|
86 | completely documented in this SDK Reference -- see <xref
|
---|
87 | linkend="sdkref_classes"/> and <xref linkend="sdkref_enums"/> -- and
|
---|
88 | available to anyone who wishes to control VirtualBox programmatically.
|
---|
89 | We chose the name "Main API" to differentiate it from other programming
|
---|
90 | interfaces of VirtualBox that may be publicly accessible.</para>
|
---|
91 |
|
---|
92 | <para>With the Main API, you can create, configure, start, stop and
|
---|
93 | delete virtual machines, retrieve performance statistics about running
|
---|
94 | VMs, configure the VirtualBox installation in general, and more. In
|
---|
95 | fact, internally, the front-end programs
|
---|
96 | <computeroutput>VirtualBox</computeroutput> and
|
---|
97 | <computeroutput>VBoxManage</computeroutput> use nothing but this API as
|
---|
98 | well -- there are no hidden backdoors into the virtualization engine for
|
---|
99 | our own front-ends. This ensures the entire Main API is both
|
---|
100 | well-documented and well-tested. (The same applies to
|
---|
101 | <computeroutput>VBoxHeadless</computeroutput>, which is not shown in the
|
---|
102 | image.)</para>
|
---|
103 | </sect1>
|
---|
104 |
|
---|
105 | <sect1 id="webservice-or-com">
|
---|
106 | <title>Two guises of the same "Main API": the web service or
|
---|
107 | COM/XPCOM</title>
|
---|
108 |
|
---|
109 | <para>There are several ways in which the Main API can be called by
|
---|
110 | other code:<orderedlist>
|
---|
111 | <listitem>
|
---|
112 | <para>VirtualBox comes with a <emphasis role="bold">web
|
---|
113 | service</emphasis> that maps nearly the entire Main API. The web
|
---|
114 | service ships in a stand-alone executable
|
---|
115 | (<computeroutput>vboxwebsrv</computeroutput>) that, when running,
|
---|
116 | acts as an HTTP server, accepts SOAP connections and processes
|
---|
117 | them.</para>
|
---|
118 |
|
---|
119 | <para>Since the entire web service API is publicly described in a
|
---|
120 | web service description file (in WSDL format), you can write
|
---|
121 | client programs that call the web service in any language with a
|
---|
122 | toolkit that understands WSDL. These days, that includes most
|
---|
123 | programming languages that are available: Java, C++, .NET, PHP,
|
---|
124 | Python, Perl and probably many more.</para>
|
---|
125 |
|
---|
126 | <para>All of this is explained in detail in subsequent chapters of
|
---|
127 | this book.</para>
|
---|
128 |
|
---|
129 | <para>There are two ways in which you can write client code that
|
---|
130 | uses the web service:<orderedlist>
|
---|
131 | <listitem>
|
---|
132 | <para>For Java as well as Python, the SDK contains
|
---|
133 | easy-to-use classes that allow you to use the web service in
|
---|
134 | an object-oriented, straightforward manner. We shall refer
|
---|
135 | to this as the <emphasis role="bold">"object-oriented web
|
---|
136 | service (OOWS)"</emphasis>.</para>
|
---|
137 |
|
---|
138 | <para>The OO bindings for Java are described in <xref
|
---|
139 | linkend="javaapi"/>, those for Python in <xref
|
---|
140 | linkend="glue-python-ws"/>.</para>
|
---|
141 | </listitem>
|
---|
142 |
|
---|
143 | <listitem>
|
---|
144 | <para>Alternatively, you can use the web service directly,
|
---|
145 | without the object-oriented client layer. We shall refer to
|
---|
146 | this as the <emphasis role="bold">"raw web
|
---|
147 | service"</emphasis>.</para>
|
---|
148 |
|
---|
149 | <para>You will then have neither native object orientation
|
---|
150 | nor full type safety, since web services are neither
|
---|
151 | object-oriented nor stateful. However, in this way, you can
|
---|
152 | write client code even in languages for which we do not ship
|
---|
153 | object-oriented client code; all you need is a programming
|
---|
154 | language with a toolkit that can parse WSDL and generate
|
---|
155 | client wrapper code from it.</para>
|
---|
156 |
|
---|
157 | <para>We describe this further in <xref
|
---|
158 | linkend="raw-webservice"/>, with samples for Java and
|
---|
159 | Perl.</para>
|
---|
160 | </listitem>
|
---|
161 | </orderedlist></para>
|
---|
162 | </listitem>
|
---|
163 |
|
---|
164 | <listitem>
|
---|
165 | <para>Internally, for portability and easier maintenance, the Main
|
---|
166 | API is implemented using the <emphasis role="bold">Component
|
---|
167 | Object Model (COM), </emphasis> an interprocess mechanism for
|
---|
168 | software components originally introduced by Microsoft for
|
---|
169 | Microsoft Windows. On a Windows host, VirtualBox will use
|
---|
170 | Microsoft COM; on other hosts where COM is not present, VirtualBox
|
---|
171 | ships with XPCOM, a free software implementation of COM originally
|
---|
172 | created by the Mozilla project for their browsers.</para>
|
---|
173 |
|
---|
174 | <para>So if you are familiar with COM and the C++ programming
|
---|
175 | language (or with any other programming language that can handle
|
---|
176 | COM/XPCOM objects, such as Java, Visual Basic or C#), then you can
|
---|
177 | use the COM/XPCOM API directly. VirtualBox comes with all the
|
---|
178 | necessary files and documentation to build fully functional COM
|
---|
179 | applications. For an introduction, please see <xref
|
---|
180 | linkend="api_com"/> below.</para>
|
---|
181 |
|
---|
182 | <para>The VirtualBox front-ends (the graphical user interfaces as
|
---|
183 | well as the command line), which are all written in C++, use
|
---|
184 | COM/XPCOM to call the Main API. Technically, the web service is
|
---|
185 | another front-end to this COM API, mapping almost all of it to
|
---|
186 | SOAP clients.</para>
|
---|
187 | </listitem>
|
---|
188 | </orderedlist></para>
|
---|
189 |
|
---|
190 | <para>If you are wondering which approach to choose, here are a few
|
---|
191 | comparisons:<table>
|
---|
192 | <title>Comparison web service vs. COM/XPCOM</title>
|
---|
193 |
|
---|
194 | <tgroup cols="2">
|
---|
195 | <tbody>
|
---|
196 | <row>
|
---|
197 | <entry><emphasis role="bold">Web service</emphasis></entry>
|
---|
198 |
|
---|
199 | <entry><emphasis role="bold">COM/XPCOM</emphasis></entry>
|
---|
200 | </row>
|
---|
201 |
|
---|
202 | <row>
|
---|
203 | <entry><emphasis role="bold">Pro:</emphasis> Easy to use with
|
---|
204 | Java and Python with the object-oriented web service;
|
---|
205 | extensive support even with other languages (C++, .NET, PHP,
|
---|
206 | Perl and others)</entry>
|
---|
207 |
|
---|
208 | <entry><emphasis role="bold">Con:</emphasis> Usable from
|
---|
209 | languages where COM bridge available (most languages on
|
---|
210 | Windows platform, Python and C++ on other hosts)</entry>
|
---|
211 | </row>
|
---|
212 |
|
---|
213 | <row>
|
---|
214 | <entry><emphasis role="bold">Pro:</emphasis> Client can be on
|
---|
215 | remote machine</entry>
|
---|
216 |
|
---|
217 | <entry><emphasis role="bold">Con: </emphasis>Client must be on
|
---|
218 | the same host where virtual machine is executed</entry>
|
---|
219 | </row>
|
---|
220 |
|
---|
221 | <row>
|
---|
222 | <entry><emphasis role="bold">Con: </emphasis>Significant
|
---|
223 | overhead due to XML marshalling over the wire for each method
|
---|
224 | call</entry>
|
---|
225 |
|
---|
226 | <entry><emphasis role="bold">Pro: </emphasis>Relatively low
|
---|
227 | invocation overhead</entry>
|
---|
228 | </row>
|
---|
229 | </tbody>
|
---|
230 | </tgroup>
|
---|
231 | </table></para>
|
---|
232 |
|
---|
233 | <para>In the following chapters, we will describe the different ways in
|
---|
234 | which to program VirtualBox, starting with the method that is easiest to
|
---|
235 | use and then increasing in complexity as we go along.</para>
|
---|
236 | </sect1>
|
---|
237 |
|
---|
238 | <sect1 id="api_soap_intro">
|
---|
239 | <title>About web services in general</title>
|
---|
240 |
|
---|
241 | <para>Web services are a particular type of programming interface.
|
---|
242 | Whereas, with "normal" programming, a program calls an application
|
---|
243 | programming interface (API) defined by another program or the operating
|
---|
244 | system and both sides of the interface have to agree on the calling
|
---|
245 | convention and, in most cases, use the same programming language, web
|
---|
246 | services use Internet standards such as HTTP and XML to
|
---|
247 | communicate.<footnote>
|
---|
248 | <para>In some ways, web services promise to deliver the same thing
|
---|
249 | as CORBA and DCOM did years ago. However, while these previous
|
---|
250 | technologies relied on specific binary protocols and thus proved to
|
---|
251 | be difficult to use between diverging platforms, web services
|
---|
252 | circumvent these incompatibilities by using text-only standards like
|
---|
253 | HTTP and XML. On the downside (and, one could say, typical of things
|
---|
254 | related to XML), a lot of standards are involved before a web
|
---|
255 | service can be implemented. Many of the standards invented around
|
---|
256 | XML are used one way or another. As a result, web services are slow
|
---|
257 | and verbose, and the details can be incredibly messy. The relevant
|
---|
258 | standards here are called SOAP and WSDL, where SOAP describes the
|
---|
259 | format of the messages that are exchanged (an XML document wrapped
|
---|
260 | in an HTTP header), and WSDL is an XML format that describes a
|
---|
261 | complete API provided by a web service. WSDL in turn uses XML Schema
|
---|
262 | to describe types, which is not exactly terse either. However, as
|
---|
263 | you will see from the samples provided in this chapter, the
|
---|
264 | VirtualBox web service shields you from these details and is easy to
|
---|
265 | use.</para>
|
---|
266 | </footnote></para>
|
---|
267 |
|
---|
268 | <para>In order to successfully use a web service, a number of things are
|
---|
269 | required -- primarily, a web service accepting connections; service
|
---|
270 | descriptions; and a client that connects to that web service. Connections
|
---|
271 | to the VirtualBox web service are governed by the SOAP standard, which
|
---|
272 | describes how messages are to be exchanged between a service and its
|
---|
273 | clients; the service descriptions are governed by WSDL.</para>
|
---|
274 |
|
---|
275 | <para>In the case of VirtualBox, this translates into the following
|
---|
276 | three components:<orderedlist>
|
---|
277 | <listitem>
|
---|
278 | <para>The VirtualBox web service (the "server"): this is the
|
---|
279 | <computeroutput>vboxwebsrv</computeroutput> executable shipped
|
---|
280 | with VirtualBox. Once you start this executable (which acts as an
|
---|
281 | HTTP server on a specific TCP/IP port), clients can connect to the
|
---|
282 | web service and thus control a VirtualBox installation.</para>
|
---|
283 | </listitem>
|
---|
284 |
|
---|
285 | <listitem>
|
---|
286 | <para>VirtualBox also comes with WSDL files that describe the
|
---|
287 | services provided by the web service. You can find these files in
|
---|
288 | the <computeroutput>sdk/bindings/webservice/</computeroutput>
|
---|
289 | directory. These files are understood by the web service toolkits
|
---|
290 | that are shipped with most programming languages and enable you to
|
---|
291 | easily access a web service even if you don't use our
|
---|
292 | object-oriented client layers. VirtualBox is shipped with
|
---|
293 | pre-generated web service glue code for several languages (Python,
|
---|
294 | Perl, Java).</para>
|
---|
295 | </listitem>
|
---|
296 |
|
---|
297 | <listitem>
|
---|
298 | <para>A client that connects to the web service in order to
|
---|
299 | control the VirtualBox installation.</para>
|
---|
300 |
|
---|
301 | <para>Unless you use some of the samples shipped with
|
---|
302 | VirtualBox, this needs to be written by you.</para>
|
---|
303 | </listitem>
|
---|
304 | </orderedlist></para>
|
---|
305 | </sect1>
|
---|
306 |
|
---|
307 | <sect1 id="runvboxwebsrv">
|
---|
308 | <title>Running the web service</title>
|
---|
309 |
|
---|
310 | <para>The web service ships in a stand-alone executable,
|
---|
311 | <computeroutput>vboxwebsrv</computeroutput>, that, when running, acts as
|
---|
312 | an HTTP server, accepts SOAP connections, remotely or from the same machine,
|
---|
313 | and processes them.<note>
|
---|
314 | <para>The web service executable is not delivered with the
|
---|
315 | VirtualBox SDK, but instead ships with the standard VirtualBox
|
---|
316 | binary package for your specific platform. The SDK contains only
|
---|
317 | platform-independent text files and documentation so thus the vboxwebsrv
|
---|
318 | binary is shipped with the platform-specific packages. Therefore the
|
---|
319 | information on how to run vboxwebsrv as a service is included in the
|
---|
320 | VirtualBox documentation and not the SDK.</para>
|
---|
321 | </note></para>
|
---|
322 |
|
---|
323 | <para>The <computeroutput>vboxwebsrv</computeroutput> program, which
|
---|
324 | implements the web service, is a text-mode (console) program which,
|
---|
325 | after being started, simply runs until it is interrupted with Ctrl-C or
|
---|
326 | a kill command.</para>
|
---|
327 |
|
---|
328 | <para>Once the web service is started, it acts as a front-end to the
|
---|
329 | VirtualBox installation of the user account that it is running under. In
|
---|
330 | other words, if the web service is run under the user account of
|
---|
331 | <computeroutput>user1</computeroutput>, it will see and manipulate the
|
---|
332 | virtual machines and other data represented by the VirtualBox data of
|
---|
333 | that user (for example, on a Linux machine, under
|
---|
334 | <computeroutput>/home/user1/.config/VirtualBox</computeroutput>; see the
|
---|
335 | VirtualBox User Guide for details on where this data is stored).</para>
|
---|
336 |
|
---|
337 | <sect2 id="vboxwebsrv-ref">
|
---|
338 | <title>Command line options of vboxwebsrv</title>
|
---|
339 |
|
---|
340 | <para>The web service supports the following command line
|
---|
341 | options:</para>
|
---|
342 |
|
---|
343 | <itemizedlist>
|
---|
344 | <listitem>
|
---|
345 | <para><computeroutput>--help</computeroutput> (or
|
---|
346 | <computeroutput>-h</computeroutput>): print a brief summary of
|
---|
347 | command line options.</para>
|
---|
348 | </listitem>
|
---|
349 |
|
---|
350 | <listitem>
|
---|
351 | <para><computeroutput>--background</computeroutput> (or
|
---|
352 | <computeroutput>-b</computeroutput>): run the web service as a
|
---|
353 | background daemon. This option is not supported on Windows
|
---|
354 | hosts.</para>
|
---|
355 | </listitem>
|
---|
356 |
|
---|
357 | <listitem>
|
---|
358 | <para><computeroutput>--host</computeroutput> (or
|
---|
359 | <computeroutput>-H</computeroutput>): This specifies the host to
|
---|
360 | bind to and defaults to "localhost".</para>
|
---|
361 | </listitem>
|
---|
362 |
|
---|
363 | <listitem>
|
---|
364 | <para><computeroutput>--port</computeroutput> (or
|
---|
365 | <computeroutput>-p</computeroutput>): This specifies which port to
|
---|
366 | bind to on the host and defaults to 18083.</para>
|
---|
367 | </listitem>
|
---|
368 |
|
---|
369 | <listitem>
|
---|
370 | <para><computeroutput>--ssl</computeroutput> (or
|
---|
371 | <computeroutput>-s</computeroutput>): This enables SSL
|
---|
372 | support.</para>
|
---|
373 | </listitem>
|
---|
374 |
|
---|
375 | <listitem>
|
---|
376 | <para><computeroutput>--keyfile</computeroutput> (or
|
---|
377 | <computeroutput>-K</computeroutput>): This specifies the file name
|
---|
378 | containing the server private key and the certificate. This is a
|
---|
379 | mandatory parameter if SSL is enabled.</para>
|
---|
380 | </listitem>
|
---|
381 |
|
---|
382 | <listitem>
|
---|
383 | <para><computeroutput>--passwordfile</computeroutput> (or
|
---|
384 | <computeroutput>-a</computeroutput>): This specifies the file name
|
---|
385 | containing the password for the server private key. If unspecified
|
---|
386 | or an empty string is specified this is interpreted as an empty
|
---|
387 | password (i.e. the private key is not protected by a password). If
|
---|
388 | the file name <computeroutput>-</computeroutput> is specified then
|
---|
389 | then the password is read from the standard input stream, otherwise
|
---|
390 | from the specified file. The user is responsible for appropriate
|
---|
391 | access rights to protect the confidential password.</para>
|
---|
392 | </listitem>
|
---|
393 |
|
---|
394 | <listitem>
|
---|
395 | <para><computeroutput>--cacert</computeroutput> (or
|
---|
396 | <computeroutput>-c</computeroutput>): This specifies the file name
|
---|
397 | containing the CA certificate appropriate for the server
|
---|
398 | certificate.</para>
|
---|
399 | </listitem>
|
---|
400 |
|
---|
401 | <listitem>
|
---|
402 | <para><computeroutput>--capath</computeroutput> (or
|
---|
403 | <computeroutput>-C</computeroutput>): This specifies the directory
|
---|
404 | containing several CA certificates appropriate for the server
|
---|
405 | certificate.</para>
|
---|
406 | </listitem>
|
---|
407 |
|
---|
408 | <listitem>
|
---|
409 | <para><computeroutput>--dhfile</computeroutput> (or
|
---|
410 | <computeroutput>-D</computeroutput>): This specifies the file name
|
---|
411 | containing the DH key. Alternatively it can contain the number of
|
---|
412 | bits of the DH key to generate. If left empty, RSA is used.</para>
|
---|
413 | </listitem>
|
---|
414 |
|
---|
415 | <listitem>
|
---|
416 | <para><computeroutput>--randfile</computeroutput> (or
|
---|
417 | <computeroutput>-r</computeroutput>): This specifies the file name
|
---|
418 | containing the seed for the random number generator. If left empty,
|
---|
419 | an operating system specific source of the seed.</para>
|
---|
420 | </listitem>
|
---|
421 |
|
---|
422 | <listitem>
|
---|
423 | <para><computeroutput>--timeout</computeroutput> (or
|
---|
424 | <computeroutput>-t</computeroutput>): This specifies the session
|
---|
425 | timeout, in seconds, and defaults to 300 (five minutes). A web
|
---|
426 | service client that has logged on but makes no calls to the web
|
---|
427 | service will automatically be disconnected after the number of
|
---|
428 | seconds specified here, as if it had called the
|
---|
429 | <computeroutput>IWebSessionManager::logoff()</computeroutput>
|
---|
430 | method provided by the web service itself.</para>
|
---|
431 |
|
---|
432 | <para>It is normally vital that each web service client call this
|
---|
433 | method, as the web service can accumulate large amounts of memory
|
---|
434 | when running, especially if a web service client does not properly
|
---|
435 | release managed object references. As a result, this timeout value
|
---|
436 | should not be set too high, especially on machines with a high
|
---|
437 | load on the web service, or the web service may eventually deny
|
---|
438 | service.</para>
|
---|
439 | </listitem>
|
---|
440 |
|
---|
441 | <listitem>
|
---|
442 | <para><computeroutput>--check-interval</computeroutput> (or
|
---|
443 | <computeroutput>-i</computeroutput>): This specifies the interval
|
---|
444 | in which the web service checks for timed-out clients, in seconds,
|
---|
445 | and defaults to 5. This normally does not need to be
|
---|
446 | changed.</para>
|
---|
447 | </listitem>
|
---|
448 |
|
---|
449 | <listitem>
|
---|
450 | <para><computeroutput>--threads</computeroutput> (or
|
---|
451 | <computeroutput>-T</computeroutput>): This specifies the maximum
|
---|
452 | number or worker threads, and defaults to 100. This normally does
|
---|
453 | not need to be changed.</para>
|
---|
454 | </listitem>
|
---|
455 |
|
---|
456 | <listitem>
|
---|
457 | <para><computeroutput>--keepalive</computeroutput> (or
|
---|
458 | <computeroutput>-k</computeroutput>): This specifies the maximum
|
---|
459 | number of requests which can be sent in one web service connection,
|
---|
460 | and defaults to 100. This normally does not need to be
|
---|
461 | changed.</para>
|
---|
462 | </listitem>
|
---|
463 |
|
---|
464 | <listitem>
|
---|
465 | <para><computeroutput>--authentication</computeroutput> (or
|
---|
466 | <computeroutput>-A</computeroutput>): This specifies the desired
|
---|
467 | web service authentication method. If the parameter is not
|
---|
468 | specified or the empty string is specified it does not change the
|
---|
469 | authentication method, otherwise it is set to the specified value.
|
---|
470 | Using this parameter is a good measure against accidental
|
---|
471 | misconfiguration, as the web service ensures periodically that it
|
---|
472 | isn't changed.</para>
|
---|
473 | </listitem>
|
---|
474 |
|
---|
475 | <listitem>
|
---|
476 | <para><computeroutput>--verbose</computeroutput> (or
|
---|
477 | <computeroutput>-v</computeroutput>): Normally, the web service
|
---|
478 | outputs only brief messages to the console each time a request is
|
---|
479 | served. With this option, the web service prints much more detailed
|
---|
480 | data about every request and the COM methods that those requests
|
---|
481 | are mapped to internally, which can be useful for debugging client
|
---|
482 | programs.</para>
|
---|
483 | </listitem>
|
---|
484 |
|
---|
485 | <listitem>
|
---|
486 | <para><computeroutput>--pidfile</computeroutput> (or
|
---|
487 | <computeroutput>-P</computeroutput>): Name of the PID file which is
|
---|
488 | created when the daemon was started.</para>
|
---|
489 | </listitem>
|
---|
490 |
|
---|
491 | <listitem>
|
---|
492 | <para><computeroutput>--logfile</computeroutput> (or
|
---|
493 | <computeroutput>-F</computeroutput>)
|
---|
494 | <computeroutput><file></computeroutput>: If this is
|
---|
495 | specified, the web service not only prints its output to the
|
---|
496 | console, but also writes it to the specified file. The file is
|
---|
497 | created if it does not exist; if it does exist, new output is
|
---|
498 | appended to it. This is useful if you run the web service
|
---|
499 | unattended and need to debug problems after they have
|
---|
500 | occurred.</para>
|
---|
501 | </listitem>
|
---|
502 |
|
---|
503 | <listitem>
|
---|
504 | <para><computeroutput>--logrotate</computeroutput> (or
|
---|
505 | <computeroutput>-R</computeroutput>): Number of old log files to
|
---|
506 | keep, defaults to 10. Log rotation is disabled if set to 0.</para>
|
---|
507 | </listitem>
|
---|
508 |
|
---|
509 | <listitem>
|
---|
510 | <para><computeroutput>--logsize</computeroutput> (or
|
---|
511 | <computeroutput>-S</computeroutput>): Maximum size of log file in
|
---|
512 | bytes, defaults to 100MB. Log rotation is triggered if the file
|
---|
513 | grows beyond this limit.</para>
|
---|
514 | </listitem>
|
---|
515 |
|
---|
516 | <listitem>
|
---|
517 | <para><computeroutput>--loginterval</computeroutput> (or
|
---|
518 | <computeroutput>-I</computeroutput>): Maximum time interval to be
|
---|
519 | put in a log file before rotation is triggered, in seconds, and
|
---|
520 | defaults to one day.</para>
|
---|
521 | </listitem>
|
---|
522 | </itemizedlist>
|
---|
523 | </sect2>
|
---|
524 |
|
---|
525 | <sect2 id="websrv_authenticate">
|
---|
526 | <title>Authenticating at web service logon</title>
|
---|
527 |
|
---|
528 | <para>As opposed to the COM/XPCOM variant of the Main API, a client
|
---|
529 | that wants to use the web service must first log on by calling the
|
---|
530 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
|
---|
531 | API that is specific to the
|
---|
532 | web service. Logon is necessary for the web service to be stateful;
|
---|
533 | internally, it maintains a session for each client that connects to
|
---|
534 | it.</para>
|
---|
535 |
|
---|
536 | <para>The <computeroutput>IWebsessionManager::logon()</computeroutput>
|
---|
537 | API takes a user name and a password as arguments, which the web
|
---|
538 | service then passes to a customizable authentication plugin that
|
---|
539 | performs the actual authentication.</para>
|
---|
540 |
|
---|
541 | <para>For testing purposes, it is recommended that you first disable
|
---|
542 | authentication with the command:
|
---|
543 | <screen>VBoxManage setproperty websrvauthlibrary null</screen></para>
|
---|
544 |
|
---|
545 | <para><warning>
|
---|
546 | <para>This will cause all logons to succeed, regardless of user
|
---|
547 | name or password. This should of course not be used in a
|
---|
548 | production environment.</para>
|
---|
549 | </warning>Generally, the mechanism by which clients are
|
---|
550 | authenticated is configurable by way of the
|
---|
551 | <computeroutput>VBoxManage</computeroutput> command:</para>
|
---|
552 |
|
---|
553 | <para><screen>VBoxManage setproperty websrvauthlibrary default|null|<library></screen></para>
|
---|
554 |
|
---|
555 | <para>This way you can specify any shared object/dynamic link module
|
---|
556 | that conforms with the specifications for VirtualBox external
|
---|
557 | authentication modules as laid out in section <emphasis
|
---|
558 | role="bold">VRDE authentication</emphasis> of the VirtualBox User
|
---|
559 | Guide; the web service uses the same kind of modules as the
|
---|
560 | VirtualBox VRDE server. For technical details on VirtualBox external
|
---|
561 | authentication modules see <xref linkend="vbox-auth"/></para>
|
---|
562 |
|
---|
563 | <para>By default, after installation, the web service uses the
|
---|
564 | VBoxAuth module that ships with VirtualBox. This module uses PAM on
|
---|
565 | FreeBSD, Linux, and Solaris hosts to authenticate users. Any valid
|
---|
566 | username/password combination is accepted, it does not have to be the
|
---|
567 | username and password of the user running the web service daemon. If
|
---|
568 | <computeroutput>vboxwebsrv</computeroutput> doesn't run as root PAM
|
---|
569 | authentication can fail, because the
|
---|
570 | <computeroutput>/etc/shadow</computeroutput> file, which is used by PAM,
|
---|
571 | is only readable by root. On most Linux distributions PAM uses a suid
|
---|
572 | root helper internally, so make sure you test this before deploying it.
|
---|
573 | One can override authentication failures due to lack of read privileges
|
---|
574 | of the shadow password file by setting the environment variable
|
---|
575 | <computeroutput>VBOX_PAM_ALLOW_INACTIVE</computeroutput>.
|
---|
576 | Please use this variable carefully and only if you fully understand what
|
---|
577 | you're doing.</para>
|
---|
578 | </sect2>
|
---|
579 | </sect1>
|
---|
580 | </chapter>
|
---|
581 |
|
---|
582 | <chapter>
|
---|
583 | <title>Environment-specific notes</title>
|
---|
584 |
|
---|
585 | <para>The Main API described in <xref linkend="sdkref_classes"/> and
|
---|
586 | <xref linkend="sdkref_enums"/> is mostly identical in all the supported
|
---|
587 | programming environments which have been briefly mentioned in the
|
---|
588 | introduction of this book. As a result, the Main API's general concepts
|
---|
589 | described in <xref linkend="concepts"/> are the same whether you use the
|
---|
590 | object-oriented web service (OOWS) for JAX-WS or a raw web service
|
---|
591 | connection via, say, Perl, or whether you use C++ COM bindings.</para>
|
---|
592 |
|
---|
593 | <para>Some things are different depending on your environment, however.
|
---|
594 | These differences are explained in this chapter.</para>
|
---|
595 |
|
---|
596 | <sect1 id="glue">
|
---|
597 | <title>Using the object-oriented web service (OOWS)</title>
|
---|
598 |
|
---|
599 | <para>As explained in <xref linkend="webservice-or-com"/>, VirtualBox
|
---|
600 | ships with client-side libraries for Java, Python and PHP that allow you
|
---|
601 | to use the VirtualBox web service in an intuitive, object-oriented way.
|
---|
602 | These libraries shield you from the client-side complications of managed
|
---|
603 | object references and other implementation details that come with the
|
---|
604 | VirtualBox web service. (If you are interested in these complications,
|
---|
605 | have a look at <xref linkend="raw-webservice"/>).</para>
|
---|
606 |
|
---|
607 | <para>We recommend that you start your experiments with the VirtualBox
|
---|
608 | web service by using our object-oriented client libraries for JAX-WS, a
|
---|
609 | web service toolkit for Java, which enables you to write code to
|
---|
610 | interact with VirtualBox in the simplest manner possible.</para>
|
---|
611 |
|
---|
612 | <para>As "interfaces", "attributes" and "methods" are COM concepts,
|
---|
613 | please read the documentation in <xref linkend="sdkref_classes"/> and
|
---|
614 | <xref linkend="sdkref_enums"/> with the following notes in mind.</para>
|
---|
615 |
|
---|
616 | <para>The OOWS bindings attempt to map the Main API as closely as
|
---|
617 | possible to the Java, Python and PHP languages. In other words, objects
|
---|
618 | are objects, interfaces become classes, and you can call methods on
|
---|
619 | objects as you would on local objects.</para>
|
---|
620 |
|
---|
621 | <para>The main difference remains with attributes: to read an attribute,
|
---|
622 | call a "getXXX" method, with "XXX" being the attribute name with a
|
---|
623 | capitalized first letter. So when the Main API Reference says that
|
---|
624 | <computeroutput>IMachine</computeroutput> has a "name" attribute (see
|
---|
625 | <link linkend="IMachine__name">IMachine::name</link>), call
|
---|
626 | <computeroutput>getName()</computeroutput> on an IMachine object to
|
---|
627 | obtain a machine's name. Unless the attribute is marked as read-only in
|
---|
628 | the documentation, there will also be a corresponding "set"
|
---|
629 | method.</para>
|
---|
630 |
|
---|
631 | <sect2 id="glue-jax-ws">
|
---|
632 | <title>The object-oriented web service for JAX-WS</title>
|
---|
633 |
|
---|
634 | <para>JAX-WS is a powerful toolkit by Sun Microsystems to build both
|
---|
635 | server and client code with Java. It is part of Java 6 (JDK 1.6), but
|
---|
636 | can also be obtained separately for Java 5 (JDK 1.5). The VirtualBox
|
---|
637 | SDK comes with precompiled OOWS bindings working with both Java 5 and
|
---|
638 | 6.</para>
|
---|
639 |
|
---|
640 | <para>The following sections explain how to get the JAX-WS sample code
|
---|
641 | running and explain a few common practices when using the JAX-WS
|
---|
642 | object-oriented web service.</para>
|
---|
643 |
|
---|
644 | <sect3>
|
---|
645 | <title>Preparations</title>
|
---|
646 |
|
---|
647 | <para>Since JAX-WS is already integrated into Java 6, no additional
|
---|
648 | preparations are needed for Java 6.</para>
|
---|
649 |
|
---|
650 | <para>If you are using Java 5 (JDK 1.5.x), you will first need to
|
---|
651 | download and install an external JAX-WS implementation, as Java 5
|
---|
652 | does not support JAX-WS out of the box; for example, you can
|
---|
653 | download one from here: <ulink
|
---|
654 | url="https://jax-ws.dev.java.net/2.1.4/JAXWS2.1.4-20080502.jar">https://jax-ws.dev.java.net/2.1.4/JAXWS2.1.4-20080502.jar</ulink>.
|
---|
655 | Then perform the installation (<computeroutput>java -jar
|
---|
656 | JAXWS2.1.4-20080502.jar</computeroutput>).</para>
|
---|
657 | </sect3>
|
---|
658 |
|
---|
659 | <sect3>
|
---|
660 | <title>Getting started: running the sample code</title>
|
---|
661 |
|
---|
662 | <para>To run the OOWS for JAX-WS samples that we ship with the SDK,
|
---|
663 | perform the following steps: <orderedlist>
|
---|
664 | <listitem>
|
---|
665 | <para>Open a terminal and change to the directory where the
|
---|
666 | JAX-WS samples reside.<footnote>
|
---|
667 | <para>In
|
---|
668 | <computeroutput>sdk/bindings/glue/java/</computeroutput>.</para>
|
---|
669 | </footnote> Examine the header of
|
---|
670 | <computeroutput>Makefile</computeroutput> to see if the
|
---|
671 | supplied variables (Java compiler, Java executable) and a few
|
---|
672 | other details match your system settings.</para>
|
---|
673 | </listitem>
|
---|
674 |
|
---|
675 | <listitem>
|
---|
676 | <para>To start the VirtualBox web service, open a second
|
---|
677 | terminal and change to the directory where the VirtualBox
|
---|
678 | executables are located. Then type:
|
---|
679 | <screen>./vboxwebsrv -v</screen></para>
|
---|
680 |
|
---|
681 | <para>The web service now waits for connections and will run
|
---|
682 | until you press Ctrl+C in this second terminal. The -v
|
---|
683 | argument causes it to log all connections to the terminal.
|
---|
684 | (See <xref linkend="runvboxwebsrv"/> for details on how
|
---|
685 | to run the web service.)</para>
|
---|
686 | </listitem>
|
---|
687 |
|
---|
688 | <listitem>
|
---|
689 | <para>Back in the first terminal and still in the samples
|
---|
690 | directory, to start a simple client example just type:
|
---|
691 | <screen>make run16</screen></para>
|
---|
692 |
|
---|
693 | <para>if you're on a Java 6 system; on a Java 5 system, run
|
---|
694 | <computeroutput>make run15</computeroutput> instead.</para>
|
---|
695 |
|
---|
696 | <para>This should work on all Unix-like systems such as Linux
|
---|
697 | and Solaris. For Windows systems, use commands similar to what
|
---|
698 | is used in the Makefile.</para>
|
---|
699 |
|
---|
700 | <para>This will compile the
|
---|
701 | <computeroutput>clienttest.java</computeroutput> code on the
|
---|
702 | first call and then execute the resulting
|
---|
703 | <computeroutput>clienttest</computeroutput> class to show the
|
---|
704 | locally installed VMs (see below).</para>
|
---|
705 | </listitem>
|
---|
706 | </orderedlist></para>
|
---|
707 |
|
---|
708 | <para>The <computeroutput>clienttest</computeroutput> sample
|
---|
709 | imitates a few typical command line tasks that
|
---|
710 | <computeroutput>VBoxManage</computeroutput>, VirtualBox's regular
|
---|
711 | command-line front-end, would provide (see the VirtualBox User
|
---|
712 | Guide for details). In particular, you can run:<itemizedlist>
|
---|
713 | <listitem>
|
---|
714 | <para><computeroutput>java clienttest show
|
---|
715 | vms</computeroutput>: show the virtual machines that are
|
---|
716 | registered locally.</para>
|
---|
717 | </listitem>
|
---|
718 |
|
---|
719 | <listitem>
|
---|
720 | <para><computeroutput>java clienttest list
|
---|
721 | hostinfo</computeroutput>: show various information about the
|
---|
722 | host this VirtualBox installation runs on.</para>
|
---|
723 | </listitem>
|
---|
724 |
|
---|
725 | <listitem>
|
---|
726 | <para><computeroutput>java clienttest startvm
|
---|
727 | <vmname|uuid></computeroutput>: start the given virtual
|
---|
728 | machine.</para>
|
---|
729 | </listitem>
|
---|
730 | </itemizedlist></para>
|
---|
731 |
|
---|
732 | <para>The <computeroutput>clienttest.java</computeroutput> sample
|
---|
733 | code illustrates common basic practices how to use the VirtualBox
|
---|
734 | OOWS for JAX-WS, which we will explain in more detail in the
|
---|
735 | following chapters.</para>
|
---|
736 | </sect3>
|
---|
737 |
|
---|
738 | <sect3>
|
---|
739 | <title>Logging on to the web service</title>
|
---|
740 |
|
---|
741 | <para>Before a web service client can do anything useful, two
|
---|
742 | objects need to be created, as can be seen in the
|
---|
743 | <computeroutput>clienttest</computeroutput> constructor:<orderedlist>
|
---|
744 | <listitem>
|
---|
745 | <para>An instance of
|
---|
746 | <link linkend="IWebsessionManager">IWebsessionManager</link>,
|
---|
747 | which is an interface provided by the web service to manage
|
---|
748 | "web sessions" -- that is, stateful connections to the web
|
---|
749 | service with persistent objects upon which methods can be
|
---|
750 | invoked.</para>
|
---|
751 |
|
---|
752 | <para>In the OOWS for JAX-WS, the IWebsessionManager class
|
---|
753 | must be constructed explicitly, and a URL must be provided in
|
---|
754 | the constructor that specifies where the web service (the
|
---|
755 | server) awaits connections. The code in
|
---|
756 | <computeroutput>clienttest.java</computeroutput> connects to
|
---|
757 | "http://localhost:18083/", which is the default.</para>
|
---|
758 |
|
---|
759 | <para>The port number, by default 18083, must match the port
|
---|
760 | number given to the
|
---|
761 | <computeroutput>vboxwebsrv</computeroutput> command line; see
|
---|
762 | <xref linkend="vboxwebsrv-ref"/>.</para>
|
---|
763 | </listitem>
|
---|
764 |
|
---|
765 | <listitem>
|
---|
766 | <para>After that, the code calls
|
---|
767 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>,
|
---|
768 | which is the first call that actually communicates with the
|
---|
769 | server. This authenticates the client with the web service and
|
---|
770 | returns an instance of
|
---|
771 | <link linkend="IVirtualBox">IVirtualBox</link>,
|
---|
772 | the most fundamental interface of the VirtualBox web service,
|
---|
773 | from which all other functionality can be derived.</para>
|
---|
774 |
|
---|
775 | <para>If logon doesn't work, please take another look at <xref
|
---|
776 | linkend="websrv_authenticate"/>.</para>
|
---|
777 | </listitem>
|
---|
778 | </orderedlist></para>
|
---|
779 | </sect3>
|
---|
780 |
|
---|
781 | <sect3>
|
---|
782 | <title>Object management</title>
|
---|
783 |
|
---|
784 | <para>The current OOWS for JAX-WS has certain memory management
|
---|
785 | related limitations. When you no longer need an object, call its
|
---|
786 | <link linkend="IManagedObjectRef__release">IManagedObjectRef::release()</link>
|
---|
787 | method explicitly, which
|
---|
788 | frees appropriate managed reference, as is required by the raw
|
---|
789 | web service; see <xref linkend="managed-object-references"/> for
|
---|
790 | details. This limitation may be reconsidered in a future version of
|
---|
791 | the VirtualBox SDK.</para>
|
---|
792 | </sect3>
|
---|
793 | </sect2>
|
---|
794 |
|
---|
795 | <sect2 id="glue-python-ws">
|
---|
796 | <title>The object-oriented web service for Python</title>
|
---|
797 |
|
---|
798 | <para>VirtualBox comes with two flavors of a Python API: one for web
|
---|
799 | service, discussed here, and one for the COM/XPCOM API discussed in
|
---|
800 | <xref linkend="pycom"/>. The client code is mostly similar, except
|
---|
801 | for the initialization part, so it is up to the application developer
|
---|
802 | to choose the appropriate technology. Moreover, a common Python glue
|
---|
803 | layer exists, abstracting out concrete platform access details, see
|
---|
804 | <xref linkend="glue-python"/>.</para>
|
---|
805 |
|
---|
806 | <para>The minimum supported Python version is 2.6.</para>
|
---|
807 |
|
---|
808 | <para>As indicated in <xref linkend="webservice-or-com"/>, the
|
---|
809 | COM/XPCOM API gives better performance without the SOAP overhead, and
|
---|
810 | does not require a web server to be running. On the other hand, the
|
---|
811 | COM/XPCOM Python API requires a suitable Python bridge for your Python
|
---|
812 | installation (VirtualBox ships the most important ones for each
|
---|
813 | platform<footnote>
|
---|
814 | <para>On Mac OS X only the Python versions bundled with the OS
|
---|
815 | are officially supported.</para>
|
---|
816 | </footnote>). On Windows, you can use the Main API from Python if the
|
---|
817 | Win32 extensions package for Python<footnote>
|
---|
818 | <para>See <ulink
|
---|
819 | url="http://sourceforge.net/project/showfiles.php?group_id=78018">http://sourceforge.net/project/showfiles.php?group_id=78018</ulink>.</para>
|
---|
820 | </footnote> is installed. Versions of Python Win32 extensions earlier
|
---|
821 | than 2.16 are known to have bugs, leading to issues with VirtualBox
|
---|
822 | Python bindings, so please make sure to use latest available Python
|
---|
823 | and Win32 extensions.</para>
|
---|
824 |
|
---|
825 | <para>The VirtualBox OOWS for Python relies on the Python ZSI SOAP
|
---|
826 | implementation (see <ulink
|
---|
827 | url="http://pywebsvcs.sourceforge.net/zsi.html">http://pywebsvcs.sourceforge.net/zsi.html</ulink>),
|
---|
828 | which you will need to install locally before trying the examples.
|
---|
829 | Most Linux distributions come with a package for ZSI, such as
|
---|
830 | <computeroutput>python-zsi</computeroutput> in Ubuntu.</para>
|
---|
831 |
|
---|
832 | <para>To get started, open a terminal and change to the
|
---|
833 | <computeroutput>sdk/bindings/glue/python/sample</computeroutput>
|
---|
834 | directory, which contains an example of a simple interactive shell
|
---|
835 | able to control a VirtualBox instance. The shell is written using the
|
---|
836 | API layer, thereby hiding different implementation details, so it is
|
---|
837 | actually an example of code shared among XPCOM, MSCOM and web services.
|
---|
838 | If you are interested in how to interact with the web services layer
|
---|
839 | directly, have a look at
|
---|
840 | <computeroutput>install/vboxapi/__init__.py</computeroutput> which
|
---|
841 | contains the glue layer for all target platforms (i.e. XPCOM, MSCOM
|
---|
842 | and web services).</para>
|
---|
843 |
|
---|
844 | <para>To start the shell, run the following commands:
|
---|
845 | <screen>/opt/VirtualBox/vboxwebsrv -t 0 # start web service with object autocollection disabled
|
---|
846 | export VBOX_PROGRAM_PATH=/opt/VirtualBox # your VirtualBox installation directory
|
---|
847 | export VBOX_SDK_PATH=/home/youruser/vbox-sdk # where you've extracted the SDK
|
---|
848 | ./vboxshell.py -w </screen>
|
---|
849 | See <xref linkend="vboxshell"/> for more
|
---|
850 | details on the shell's functionality. For you, as a VirtualBox
|
---|
851 | application developer, the vboxshell sample could be interesting as an
|
---|
852 | example of how to write code targeting both local and remote cases
|
---|
853 | (COM/XPCOM and SOAP). The common part of the shell is the same -- the
|
---|
854 | only difference is how it interacts with the invocation layer. You can
|
---|
855 | use the <computeroutput>connect</computeroutput> shell command to
|
---|
856 | connect to remote VirtualBox servers; in this case you can skip
|
---|
857 | starting the local web server.</para>
|
---|
858 | </sect2>
|
---|
859 |
|
---|
860 | <sect2>
|
---|
861 | <title>The object-oriented web service for PHP</title>
|
---|
862 |
|
---|
863 | <para>VirtualBox also comes with object-oriented web service (OOWS)
|
---|
864 | wrappers for PHP5. These wrappers rely on the PHP SOAP
|
---|
865 | Extension<footnote>
|
---|
866 | <para>See
|
---|
867 | <ulink url="https://www.php.net/soap">https://www.php.net/soap</ulink>.</para>
|
---|
868 | </footnote>, which can be installed by configuring PHP with
|
---|
869 | <computeroutput>--enable-soap</computeroutput>.</para>
|
---|
870 | </sect2>
|
---|
871 | </sect1>
|
---|
872 |
|
---|
873 | <sect1 id="raw-webservice">
|
---|
874 | <title>Using the raw web service with any language</title>
|
---|
875 |
|
---|
876 | <para>The following examples show you how to use the raw web service,
|
---|
877 | without the object-oriented client-side code that was described in the
|
---|
878 | previous chapter.</para>
|
---|
879 |
|
---|
880 | <para>Due to the limitations of SOAP and WSDL outlined in
|
---|
881 | <xref linkend="rawws-conventions"/>, keep the following notes in
|
---|
882 | mind when reading the documentation in <xref linkend="sdkref_classes"/>
|
---|
883 | and <xref linkend="sdkref_enums"/>:</para>
|
---|
884 |
|
---|
885 | <para><orderedlist>
|
---|
886 | <listitem>
|
---|
887 | <para>Any COM method call becomes a <emphasis role="bold">plain
|
---|
888 | function call</emphasis> in the raw web service, with the object
|
---|
889 | as an additional first parameter (before the "real" parameters
|
---|
890 | listed in the documentation). So when the documentation says that
|
---|
891 | the <computeroutput>IVirtualBox</computeroutput> interface
|
---|
892 | supports the <computeroutput>createMachine()</computeroutput>
|
---|
893 | method (see
|
---|
894 | <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>),
|
---|
895 | the web service operation is
|
---|
896 | <computeroutput>IVirtualBox_createMachine(...)</computeroutput>,
|
---|
897 | and a managed object reference to an
|
---|
898 | <computeroutput>IVirtualBox</computeroutput> object must be passed
|
---|
899 | as the first argument.</para>
|
---|
900 | </listitem>
|
---|
901 |
|
---|
902 | <listitem>
|
---|
903 | <para>For <emphasis role="bold">attributes</emphasis> in
|
---|
904 | interfaces, there will be at least one "get" function; there will
|
---|
905 | also be a "set" function, unless the attribute is "readonly". The
|
---|
906 | attribute name will be appended to the "get" or "set" prefix, with
|
---|
907 | a capitalized first letter. So, the "version" readonly attribute
|
---|
908 | of the <computeroutput>IVirtualBox</computeroutput> interface can
|
---|
909 | be retrieved by calling
|
---|
910 | <computeroutput>IVirtualBox_getVersion(vbox)</computeroutput>,
|
---|
911 | with <computeroutput>vbox</computeroutput> being the VirtualBox
|
---|
912 | object.</para>
|
---|
913 | </listitem>
|
---|
914 |
|
---|
915 | <listitem>
|
---|
916 | <para>Whenever the API documentation says that a method (or an
|
---|
917 | attribute getter) returns an <emphasis
|
---|
918 | role="bold">object</emphasis>, it will returned a managed object
|
---|
919 | reference in the web service instead. As said above, managed
|
---|
920 | object references should be released if the web service client
|
---|
921 | does not log off again immediately!</para>
|
---|
922 | </listitem>
|
---|
923 | </orderedlist></para>
|
---|
924 |
|
---|
925 | <para></para>
|
---|
926 |
|
---|
927 | <sect2 id="webservice-java-sample">
|
---|
928 | <title>Raw web service example for Java with Axis</title>
|
---|
929 |
|
---|
930 | <para>Axis is an older web service toolkit created by the Apache
|
---|
931 | foundation. If your distribution does not have it installed, you can
|
---|
932 | get a binary from <ulink
|
---|
933 | url="http://axis.apache.org">http://axis.apache.org</ulink>. The
|
---|
934 | following examples assume that you have Axis 1.4 installed.</para>
|
---|
935 |
|
---|
936 | <para>The VirtualBox SDK ships with an example for Axis that, again,
|
---|
937 | is called <computeroutput>clienttest.java</computeroutput> and that
|
---|
938 | imitates a few <computeroutput>VBoxManage</computeroutput> commands
|
---|
939 | and sends them to the VirtualBox web service.</para>
|
---|
940 |
|
---|
941 | <para>To try out the raw web service with Axis complete the following
|
---|
942 | steps:<orderedlist>
|
---|
943 | <listitem>
|
---|
944 | <para>Create a working directory somewhere. Under your
|
---|
945 | VirtualBox installation directory, find the
|
---|
946 | <computeroutput>sdk/webservice/samples/java/axis/</computeroutput>
|
---|
947 | directory and copy the file
|
---|
948 | <computeroutput>clienttest.java</computeroutput> to your working
|
---|
949 | directory.</para>
|
---|
950 | </listitem>
|
---|
951 |
|
---|
952 | <listitem>
|
---|
953 | <para>Open a terminal in your working directory. Execute the
|
---|
954 | following command:
|
---|
955 | <screen>java org.apache.axis.wsdl.WSDL2Java /path/to/vboxwebService.wsdl</screen></para>
|
---|
956 |
|
---|
957 | <para>The <computeroutput>vboxwebService.wsdl</computeroutput>
|
---|
958 | file should be located in the
|
---|
959 | <computeroutput>sdk/webservice/</computeroutput>
|
---|
960 | directory.</para>
|
---|
961 |
|
---|
962 | <para>If this fails, your Apache Axis may not be located on your
|
---|
963 | system classpath, and you may have to adjust the CLASSPATH
|
---|
964 | environment variable. Something like this:
|
---|
965 | <screen>export CLASSPATH="/path-to-axis-1_4/lib/*":$CLASSPATH</screen></para>
|
---|
966 |
|
---|
967 | <para>Use the directory where the Axis JAR files are located.
|
---|
968 | Mind the quotes so that your shell passes the "*" character to
|
---|
969 | the java executable without expanding. Alternatively, add a
|
---|
970 | corresponding <computeroutput>-classpath</computeroutput>
|
---|
971 | argument to the "java" call above.</para>
|
---|
972 |
|
---|
973 | <para>If the command executes successfully, you should see an
|
---|
974 | "org" directory with subdirectories containing Java source files
|
---|
975 | in your working directory. These classes represent the
|
---|
976 | interfaces that the VirtualBox web service offers, as described
|
---|
977 | by the WSDL file.</para>
|
---|
978 |
|
---|
979 | <para>This is the bit that makes using web services so
|
---|
980 | attractive to client developers: if a language's toolkit
|
---|
981 | understands WSDL, it can generate large amounts of support code
|
---|
982 | automatically. Clients can then easily use this support code and
|
---|
983 | can be done with just a few lines of code.</para>
|
---|
984 | </listitem>
|
---|
985 |
|
---|
986 | <listitem>
|
---|
987 | <para>Next, compile the
|
---|
988 | <computeroutput>clienttest.java</computeroutput>
|
---|
989 | source:<screen>javac clienttest.java </screen></para>
|
---|
990 |
|
---|
991 | <para>This should yield a "clienttest.class" file.</para>
|
---|
992 | </listitem>
|
---|
993 |
|
---|
994 | <listitem>
|
---|
995 | <para>To start the VirtualBox web service, open a second
|
---|
996 | terminal and change to the directory where the VirtualBox
|
---|
997 | executables are located. Then type:
|
---|
998 | <screen>./vboxwebsrv -v</screen></para>
|
---|
999 |
|
---|
1000 | <para>The web service now waits for connections and will run
|
---|
1001 | until you press Ctrl+C in this second terminal. The -v argument
|
---|
1002 | causes it to log all connections to the terminal. (See <xref
|
---|
1003 | linkend="runvboxwebsrv"/> for details on how to run the
|
---|
1004 | web service.)</para>
|
---|
1005 | </listitem>
|
---|
1006 |
|
---|
1007 | <listitem>
|
---|
1008 | <para>Back in the original terminal where you compiled the Java
|
---|
1009 | source, run the resulting binary, which will then connect to the
|
---|
1010 | web service:<screen>java clienttest</screen></para>
|
---|
1011 |
|
---|
1012 | <para>The client sample will connect to the web service (on
|
---|
1013 | localhost, but the code could be changed to connect remotely if
|
---|
1014 | the web service was running on a different machine) and make a
|
---|
1015 | number of method calls. It will output the version number of
|
---|
1016 | your VirtualBox installation and a list of all virtual machines
|
---|
1017 | that are currently registered (with a bit of seemingly random
|
---|
1018 | data, which will be explained later).</para>
|
---|
1019 | </listitem>
|
---|
1020 | </orderedlist></para>
|
---|
1021 | </sect2>
|
---|
1022 |
|
---|
1023 | <sect2 id="raw-webservice-perl">
|
---|
1024 | <title>Raw web service example for Perl</title>
|
---|
1025 |
|
---|
1026 | <para>We also ship a small sample for Perl. It uses the SOAP::Lite
|
---|
1027 | perl module to communicate with the VirtualBox web service.</para>
|
---|
1028 |
|
---|
1029 | <para>The
|
---|
1030 | <computeroutput>sdk/bindings/webservice/perl/lib/</computeroutput>
|
---|
1031 | directory contains a pre-generated Perl module that allows for
|
---|
1032 | communicating with the web service from Perl. You can generate such a
|
---|
1033 | module yourself using the "stubmaker" tool that comes with SOAP::Lite,
|
---|
1034 | but since that tool is slow as well as sometimes unreliable, we ship a
|
---|
1035 | working module with the SDK for your convenience.</para>
|
---|
1036 |
|
---|
1037 | <para>Perform the following steps:<orderedlist>
|
---|
1038 | <listitem>
|
---|
1039 | <para>If SOAP::Lite is not yet installed on your system, you
|
---|
1040 | will need to install the package first. On Debian-based systems,
|
---|
1041 | the package is called
|
---|
1042 | <computeroutput>libsoap-lite-perl</computeroutput>; on Gentoo,
|
---|
1043 | it's <computeroutput>dev-perl/SOAP-Lite</computeroutput>.</para>
|
---|
1044 | </listitem>
|
---|
1045 |
|
---|
1046 | <listitem>
|
---|
1047 | <para>Open a terminal in the
|
---|
1048 | <computeroutput>sdk/bindings/webservice/perl/samples/</computeroutput>
|
---|
1049 | directory.</para>
|
---|
1050 | </listitem>
|
---|
1051 |
|
---|
1052 | <listitem>
|
---|
1053 | <para>To start the VirtualBox web service, open a second
|
---|
1054 | terminal and change to the directory where the VirtualBox
|
---|
1055 | executables are located. Then type:
|
---|
1056 | <screen>./vboxwebsrv -v</screen></para>
|
---|
1057 |
|
---|
1058 | <para>The web service now waits for connections and will run
|
---|
1059 | until you press Ctrl+C in this second terminal. The -v argument
|
---|
1060 | causes it to log all connections to the terminal. (See <xref
|
---|
1061 | linkend="runvboxwebsrv"/> for details on how to run the
|
---|
1062 | web service.)</para>
|
---|
1063 | </listitem>
|
---|
1064 |
|
---|
1065 | <listitem>
|
---|
1066 | <para>In the first terminal with the Perl sample, run the
|
---|
1067 | clienttest.pl script:
|
---|
1068 | <screen>perl -I ../lib clienttest.pl</screen></para>
|
---|
1069 | </listitem>
|
---|
1070 | </orderedlist></para>
|
---|
1071 | </sect2>
|
---|
1072 |
|
---|
1073 | <sect2>
|
---|
1074 | <title>Programming considerations for the raw web service</title>
|
---|
1075 |
|
---|
1076 | <para>If you use the raw web service, you need to keep a number of
|
---|
1077 | things in mind, or you will sooner or later run into issues that are
|
---|
1078 | not immediately obvious. By contrast, the object-oriented client-side
|
---|
1079 | libraries described in <xref linkend="glue"/> take care of these
|
---|
1080 | things automatically and thus greatly simplify using the web
|
---|
1081 | service.</para>
|
---|
1082 |
|
---|
1083 | <sect3 id="rawws-conventions">
|
---|
1084 | <title>Fundamental conventions</title>
|
---|
1085 |
|
---|
1086 | <para>If you are familiar with other web services, you may find that the
|
---|
1087 | VirtualBox web service behaves a bit differently to accommodate
|
---|
1088 | for the fact that the VirtualBox web service more or less maps the
|
---|
1089 | VirtualBox Main COM API. The primary challenges in mapping the VirtualBox
|
---|
1090 | Main COM API to the web service are as follows:<itemizedlist>
|
---|
1091 | <listitem>
|
---|
1092 | <para>Web services, as expressed by WSDL, are not
|
---|
1093 | object-oriented. Even worse, they are normally stateless (or,
|
---|
1094 | in web services terminology, "loosely coupled"). Web service
|
---|
1095 | operations are entirely procedural, and one cannot normally
|
---|
1096 | make assumptions about the state of a web service between
|
---|
1097 | function calls.</para>
|
---|
1098 |
|
---|
1099 | <para>In particular, this normally means that you cannot work
|
---|
1100 | on objects in one method call that were created by another
|
---|
1101 | call.</para>
|
---|
1102 | </listitem>
|
---|
1103 |
|
---|
1104 | <listitem>
|
---|
1105 | <para>By contrast, the VirtualBox Main API, being expressed in
|
---|
1106 | COM, is object-oriented and works entirely on objects, which
|
---|
1107 | are grouped into public interfaces, which in turn have
|
---|
1108 | attributes and methods associated with them.</para>
|
---|
1109 | </listitem>
|
---|
1110 | </itemizedlist> For the VirtualBox web service, this results in
|
---|
1111 | three fundamental conventions:<orderedlist>
|
---|
1112 | <listitem>
|
---|
1113 | <para>All <emphasis role="bold">function names</emphasis> in
|
---|
1114 | the VirtualBox web service consist of an interface name and a
|
---|
1115 | method name, joined together by an underscore. This is because
|
---|
1116 | there are only functions ("operations") in WSDL, but no
|
---|
1117 | classes, interfaces, or methods.</para>
|
---|
1118 | </listitem>
|
---|
1119 |
|
---|
1120 | <listitem>
|
---|
1121 | <para>All calls to the VirtualBox web service (except for logon, see
|
---|
1122 | below) take a <emphasis role="bold">managed object reference</emphasis>
|
---|
1123 | as the first argument, representing the object upon which the underlying
|
---|
1124 | method is invoked. (Managed object references are explained in detail
|
---|
1125 | below; see <xref linkend="managed-object-references"/>.)</para>
|
---|
1126 |
|
---|
1127 | <para>So, when one would normally code, in the pseudo-code of
|
---|
1128 | an object-oriented language, to invoke a method upon an
|
---|
1129 | object:<screen>IMachine machine;
|
---|
1130 | result = machine.getName();</screen></para>
|
---|
1131 |
|
---|
1132 | <para>In the VirtualBox web service, this looks something like
|
---|
1133 | this (again, pseudo-code):<screen>IMachineRef machine;
|
---|
1134 | result = IMachine_getName(machine);</screen></para>
|
---|
1135 | </listitem>
|
---|
1136 |
|
---|
1137 | <listitem>
|
---|
1138 | <para>To make the web service stateful, and objects persistent
|
---|
1139 | between method calls, the VirtualBox web service introduces a
|
---|
1140 | <emphasis role="bold">session manager</emphasis> (by way of the
|
---|
1141 | <link linkend="IWebsessionManager">IWebsessionManager</link>
|
---|
1142 | interface), which manages object references. Any client wishing
|
---|
1143 | to interact with the web service must first log on to the
|
---|
1144 | session manager and in turn receives a managed object reference
|
---|
1145 | to an object that supports the
|
---|
1146 | <link linkend="IVirtualBox">IVirtualBox</link>
|
---|
1147 | interface (the basic interface in the Main API).</para>
|
---|
1148 | </listitem>
|
---|
1149 | </orderedlist></para>
|
---|
1150 |
|
---|
1151 | <para>In other words, as opposed to other web services, <emphasis
|
---|
1152 | role="bold">the VirtualBox web service is both object-oriented and
|
---|
1153 | stateful.</emphasis></para>
|
---|
1154 | </sect3>
|
---|
1155 |
|
---|
1156 | <sect3>
|
---|
1157 | <title>Example: A typical web service client session</title>
|
---|
1158 |
|
---|
1159 | <para>A typical short web service session to retrieve the version
|
---|
1160 | number of the VirtualBox web service (to be precise, the underlying
|
---|
1161 | Main API version number) looks like this:<orderedlist>
|
---|
1162 | <listitem>
|
---|
1163 | <para>A client logs on to the web service by calling
|
---|
1164 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
|
---|
1165 | with a valid user name and password. See
|
---|
1166 | <xref linkend="websrv_authenticate"/>
|
---|
1167 | for details about how authentication works.</para>
|
---|
1168 | </listitem>
|
---|
1169 |
|
---|
1170 | <listitem>
|
---|
1171 | <para>On the server side,
|
---|
1172 | <computeroutput>vboxwebsrv</computeroutput> creates a session,
|
---|
1173 | which persists until the client calls
|
---|
1174 | <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>
|
---|
1175 | or the session times out after a configurable period of
|
---|
1176 | inactivity (see <xref linkend="vboxwebsrv-ref"/>).</para>
|
---|
1177 |
|
---|
1178 | <para>For the new session, the web service creates an instance
|
---|
1179 | of <link linkend="IVirtualBox">IVirtualBox</link>.
|
---|
1180 | This interface is the most central one in the Main API and
|
---|
1181 | allows access to all other interfaces, either through
|
---|
1182 | attributes or method calls. For example, IVirtualBox contains
|
---|
1183 | a list of all virtual machines that are currently registered
|
---|
1184 | (as they would be listed on the left side of the VirtualBox
|
---|
1185 | main program).</para>
|
---|
1186 |
|
---|
1187 | <para>The web service then creates a managed object reference
|
---|
1188 | for this instance of IVirtualBox and returns it to the calling
|
---|
1189 | client, which receives it as the return value of the logon
|
---|
1190 | call. Something like this:</para>
|
---|
1191 |
|
---|
1192 | <screen>string oVirtualBox;
|
---|
1193 | oVirtualBox = webservice.IWebsessionManager_logon("user", "pass");</screen>
|
---|
1194 |
|
---|
1195 | <para>(The managed object reference "oVirtualBox" is just a
|
---|
1196 | string consisting of digits and dashes. However, it is a
|
---|
1197 | string with a meaning and will be checked by the web service.
|
---|
1198 | For details, see below. As hinted above,
|
---|
1199 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
|
---|
1200 | is the <emphasis>only</emphasis> operation provided by the web
|
---|
1201 | service which does not take a managed object reference as the
|
---|
1202 | first argument!)</para>
|
---|
1203 | </listitem>
|
---|
1204 |
|
---|
1205 | <listitem>
|
---|
1206 | <para>The VirtualBox Main API documentation explains that the
|
---|
1207 | <computeroutput>IVirtualBox</computeroutput> interface has a
|
---|
1208 | <link linkend="IVirtualBox__version">version</link>
|
---|
1209 | attribute, which is a string. For each attribute, there is a
|
---|
1210 | "get" and a "set" method in COM, which maps to the corresponding
|
---|
1211 | operations in the web service. So, to retrieve the "version"
|
---|
1212 | attribute of this <computeroutput>IVirtualBox</computeroutput>
|
---|
1213 | object, the web service client does this:
|
---|
1214 | <screen>string version;
|
---|
1215 | version = webservice.IVirtualBox_getVersion(oVirtualBox);
|
---|
1216 |
|
---|
1217 | print version;</screen></para>
|
---|
1218 |
|
---|
1219 | <para>And it will print
|
---|
1220 | "&VBOX_VERSION_MAJOR;.&VBOX_VERSION_MINOR;.&VBOX_VERSION_BUILD;".</para>
|
---|
1221 | </listitem>
|
---|
1222 |
|
---|
1223 | <listitem>
|
---|
1224 | <para>The web service client calls
|
---|
1225 | <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>
|
---|
1226 | with the VirtualBox managed object reference. This will clean
|
---|
1227 | up all allocated resources.</para>
|
---|
1228 | </listitem>
|
---|
1229 | </orderedlist></para>
|
---|
1230 | </sect3>
|
---|
1231 |
|
---|
1232 | <sect3 id="managed-object-references">
|
---|
1233 | <title>Managed object references</title>
|
---|
1234 |
|
---|
1235 | <para>To a web service client, a managed object reference looks like
|
---|
1236 | a string: two 64-bit hex numbers separated by a dash. This string,
|
---|
1237 | however, represents a COM object that "lives" in the web service
|
---|
1238 | process. The two 64-bit numbers encoded in the managed object
|
---|
1239 | reference represent a session ID (which is the same for all objects
|
---|
1240 | in the same web service session, i.e. for all objects after one
|
---|
1241 | logon) and a unique object ID within that session.</para>
|
---|
1242 |
|
---|
1243 | <para>Managed object references are created in two
|
---|
1244 | situations:<orderedlist>
|
---|
1245 | <listitem>
|
---|
1246 | <para>When a client logs on, by calling
|
---|
1247 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>.</para>
|
---|
1248 |
|
---|
1249 | <para>Upon logon, the websession manager creates one instance
|
---|
1250 | of <link linkend="IVirtualBox">IVirtualBox</link>,
|
---|
1251 | which can be used for directly performing calls to its
|
---|
1252 | methods, or used as a parameter for calling some methods of
|
---|
1253 | <link linkend="IWebsessionManager">IWebsessionManager</link>.
|
---|
1254 | Creating Main API session objects is performed using
|
---|
1255 | <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>.</para>
|
---|
1256 |
|
---|
1257 | <para>(Technically, there is always only one
|
---|
1258 | <link linkend="IVirtualBox">IVirtualBox</link> object, which
|
---|
1259 | is shared between all websessions and clients, as it is a COM
|
---|
1260 | singleton. However, each session receives its own managed
|
---|
1261 | object reference to it.)</para>
|
---|
1262 | </listitem>
|
---|
1263 |
|
---|
1264 | <listitem>
|
---|
1265 | <para>Whenever a web service clients invokes an operation
|
---|
1266 | whose COM implementation creates COM objects.</para>
|
---|
1267 |
|
---|
1268 | <para>For example,
|
---|
1269 | <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
|
---|
1270 | creates a new instance of
|
---|
1271 | <link linkend="IMachine">IMachine</link>;
|
---|
1272 | the COM object returned by the COM method call is then wrapped
|
---|
1273 | into a managed object reference by the web server, and this
|
---|
1274 | reference is returned to the web service client.</para>
|
---|
1275 | </listitem>
|
---|
1276 | </orderedlist></para>
|
---|
1277 |
|
---|
1278 | <para>Internally, in the web service process, each managed object
|
---|
1279 | reference is simply a small data structure, containing a COM pointer
|
---|
1280 | to the "real" COM object, the web session ID and the object ID. This
|
---|
1281 | structure is allocated on creation and stored efficiently in hashes,
|
---|
1282 | so that the web service can look up the COM object quickly whenever
|
---|
1283 | a web service client wishes to make a method call. The random
|
---|
1284 | session ID also ensures that one web service client cannot intercept
|
---|
1285 | the objects of another.</para>
|
---|
1286 |
|
---|
1287 | <para>Managed object references are not destroyed automatically and
|
---|
1288 | must be released by explicitly calling
|
---|
1289 | <link linkend="IManagedObjectRef__release">IManagedObjectRef::release()</link>.
|
---|
1290 | This is important, as
|
---|
1291 | otherwise hundreds or thousands of managed object references (and
|
---|
1292 | corresponding COM objects, which can consume much more memory!) can
|
---|
1293 | pile up in the web service process and eventually cause it to deny
|
---|
1294 | service.</para>
|
---|
1295 |
|
---|
1296 | <para>To reiterate: The underlying COM object, which the reference
|
---|
1297 | points to, is only freed if the managed object reference is
|
---|
1298 | released. It is therefore vital that web service clients properly
|
---|
1299 | clean up after the managed object references that are returned to
|
---|
1300 | them.</para>
|
---|
1301 |
|
---|
1302 | <para>When a web service client calls
|
---|
1303 | <link linkend="IWebsessionManager__logoff">IWebsessionManager::logoff()</link>,
|
---|
1304 | all managed object references created during the session are
|
---|
1305 | automatically freed. For short-lived sessions that do not create a
|
---|
1306 | lot of objects, logging off may therefore be sufficient, although it
|
---|
1307 | is certainly not "best practice".</para>
|
---|
1308 | </sect3>
|
---|
1309 |
|
---|
1310 | <sect3>
|
---|
1311 | <title>Some more detail about web service operation</title>
|
---|
1312 |
|
---|
1313 | <sect4 id="soap">
|
---|
1314 | <title>SOAP messages</title>
|
---|
1315 |
|
---|
1316 | <para>Whenever a client makes a call to a web service, this
|
---|
1317 | involves a complicated procedure internally. These calls are
|
---|
1318 | remote procedure calls. Each such procedure call typically
|
---|
1319 | consists of two "message" being passed, where each message is a
|
---|
1320 | plain-text HTTP request with a standard HTTP header and a special
|
---|
1321 | XML document following. This XML document encodes the name of the
|
---|
1322 | procedure to call and the argument names and values passed to
|
---|
1323 | it.</para>
|
---|
1324 |
|
---|
1325 | <para>To give you an idea of what such a message looks like,
|
---|
1326 | assuming that a web service provides a procedure called
|
---|
1327 | "SayHello", which takes a string "name" as an argument and returns
|
---|
1328 | "Hello" with a space and that name appended, the request message
|
---|
1329 | could look like this:</para>
|
---|
1330 |
|
---|
1331 | <para><screen><?xml version="1.0" encoding="UTF-8"?>
|
---|
1332 | <SOAP-ENV:Envelope
|
---|
1333 | xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
---|
1334 | xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
|
---|
1335 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
---|
1336 | xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
---|
1337 | xmlns:test="http://test/">
|
---|
1338 | <SOAP-ENV:Body>
|
---|
1339 | <test:SayHello>
|
---|
1340 | <name>Peter</name>
|
---|
1341 | </test:SayHello>
|
---|
1342 | </SOAP-ENV:Body>
|
---|
1343 | </SOAP-ENV:Envelope></screen>A similar message -- the "response" message
|
---|
1344 | -- would be sent back from the web service to the client,
|
---|
1345 | containing the return value "Hello Peter".</para>
|
---|
1346 |
|
---|
1347 | <para>Most programming languages provide automatic support to
|
---|
1348 | generate such messages whenever code in that programming language
|
---|
1349 | makes such a request. In other words, these programming languages
|
---|
1350 | allow for writing something like this (in pseudo-C++ code):</para>
|
---|
1351 |
|
---|
1352 | <para><screen>webServiceClass service("localhost", 18083); // server and port
|
---|
1353 | string result = service.SayHello("Peter"); // invoke remote procedure</screen>
|
---|
1354 | and would, for these two pseudo-lines, automatically perform these
|
---|
1355 | steps:</para>
|
---|
1356 |
|
---|
1357 | <para><orderedlist>
|
---|
1358 | <listitem>
|
---|
1359 | <para>Prepare a connection to the web service running on port
|
---|
1360 | 18083 of "localhost".</para>
|
---|
1361 | </listitem>
|
---|
1362 |
|
---|
1363 | <listitem>
|
---|
1364 | <para>Generate a SOAP message similar to the above example for the
|
---|
1365 | <computeroutput>SayHello()</computeroutput> function of the web service
|
---|
1366 | by encoding all arguments of the remote procedure call (which could
|
---|
1367 | involve all kinds of type conversions and complex marshalling for arrays
|
---|
1368 | and structures).</para>
|
---|
1369 | </listitem>
|
---|
1370 |
|
---|
1371 | <listitem>
|
---|
1372 | <para>Connect to the web service via HTTP and then send that
|
---|
1373 | message.</para>
|
---|
1374 | </listitem>
|
---|
1375 |
|
---|
1376 | <listitem>
|
---|
1377 | <para>Wait for the web service to send a response message.</para>
|
---|
1378 | </listitem>
|
---|
1379 |
|
---|
1380 | <listitem>
|
---|
1381 | <para>Decode that response message and put the return value
|
---|
1382 | of the remote procedure into the "result" variable.</para>
|
---|
1383 | </listitem>
|
---|
1384 | </orderedlist></para>
|
---|
1385 | </sect4>
|
---|
1386 |
|
---|
1387 | <sect4 id="wsdl">
|
---|
1388 | <title>Service descriptions in WSDL</title>
|
---|
1389 |
|
---|
1390 | <para>In the above explanations about SOAP, it wasn't explained how
|
---|
1391 | the programming language learns about how to translate function
|
---|
1392 | calls in its own syntax into proper SOAP messages. In other words,
|
---|
1393 | the programming language needs to know what operations the web
|
---|
1394 | service supports and what types of arguments are required for the
|
---|
1395 | operation's data in order to be able to properly serialize and
|
---|
1396 | deserialize the data to and from the web service. For example, if
|
---|
1397 | a web service operation expects a number in "double" floating
|
---|
1398 | point format for a particular parameter, the programming language
|
---|
1399 | cannot send it a string instead.</para>
|
---|
1400 |
|
---|
1401 | <para>For this, the Web Service Definition Language (WSDL) was
|
---|
1402 | invented, another XML substandard that describes exactly what
|
---|
1403 | operations the web service supports and, for each operation, which
|
---|
1404 | parameters and types are needed with each request and response
|
---|
1405 | message. WSDL descriptions can be incredibly verbose, and one of
|
---|
1406 | the few good things that can be said about this standard is that
|
---|
1407 | it is indeed supported by most programming languages.</para>
|
---|
1408 |
|
---|
1409 | <para>So, if it is said that a programming language "supports" web
|
---|
1410 | services, this typically means that a programming language has
|
---|
1411 | support for parsing WSDL files and somehow integrating the remote
|
---|
1412 | procedure calls into the native language syntax -- for example, as
|
---|
1413 | shown in the Java sample in <xref
|
---|
1414 | linkend="webservice-java-sample"/>.</para>
|
---|
1415 |
|
---|
1416 | <para>For details about how programming languages support web
|
---|
1417 | services, please refer to the documentation that comes with the
|
---|
1418 | individual language. Here are a few pointers:</para>
|
---|
1419 |
|
---|
1420 | <orderedlist>
|
---|
1421 | <listitem>
|
---|
1422 | <para>For <emphasis role="bold">C++, </emphasis> among many
|
---|
1423 | others, the gSOAP toolkit is a good option. Parts of gSOAP are
|
---|
1424 | also used in VirtualBox to implement the VirtualBox web
|
---|
1425 | service.</para>
|
---|
1426 | </listitem>
|
---|
1427 |
|
---|
1428 | <listitem>
|
---|
1429 | <para>For <emphasis role="bold">Java, </emphasis> there are
|
---|
1430 | several implementations already described in this document
|
---|
1431 | (see <xref linkend="glue-jax-ws"/> and <xref
|
---|
1432 | linkend="webservice-java-sample"/>).</para>
|
---|
1433 | </listitem>
|
---|
1434 |
|
---|
1435 | <listitem>
|
---|
1436 | <para><emphasis role="bold">Perl</emphasis> supports WSDL via
|
---|
1437 | the SOAP::Lite package. This in turn comes with a tool called
|
---|
1438 | <computeroutput>stubmaker.pl</computeroutput> that allows you
|
---|
1439 | to turn any WSDL file into a Perl package that you can import.
|
---|
1440 | (You can also import any WSDL file "live" by having it parsed
|
---|
1441 | every time the script runs, but that can take a while.) You
|
---|
1442 | can then code (again, assuming the above example):
|
---|
1443 | <screen>my $result = servicename->sayHello("Peter");</screen>
|
---|
1444 | </para>
|
---|
1445 |
|
---|
1446 | <para>A sample that uses SOAP::Lite was described in <xref
|
---|
1447 | linkend="raw-webservice-perl"/>.</para>
|
---|
1448 | </listitem>
|
---|
1449 | </orderedlist>
|
---|
1450 | </sect4>
|
---|
1451 | </sect3>
|
---|
1452 | </sect2>
|
---|
1453 | </sect1>
|
---|
1454 |
|
---|
1455 | <sect1 id="api_com">
|
---|
1456 | <title>Using COM/XPCOM directly</title>
|
---|
1457 |
|
---|
1458 | <para>If you do not require <emphasis>remote</emphasis> procedure calls
|
---|
1459 | such as those offered by the VirtualBox web service, and if you know
|
---|
1460 | Python or C++ as well as COM, you might find it preferable to program
|
---|
1461 | VirtualBox's Main API directly via COM.</para>
|
---|
1462 |
|
---|
1463 | <para>COM stands for "Component Object Model" and is a standard
|
---|
1464 | originally introduced by Microsoft in the 1990s for Microsoft Windows.
|
---|
1465 | It allows for organizing software in an object-oriented way and across
|
---|
1466 | processes; code in one process may access objects that live in another
|
---|
1467 | process.</para>
|
---|
1468 |
|
---|
1469 | <para>COM has several advantages: it is language-neutral, meaning that
|
---|
1470 | even though all of VirtualBox is internally written in C++, programs
|
---|
1471 | written in other languages can communicate with it. COM also cleanly
|
---|
1472 | separates interface from implementation, so that external programs do
|
---|
1473 | not need to know anything about the messy and complicated details of
|
---|
1474 | VirtualBox internals.</para>
|
---|
1475 |
|
---|
1476 | <para>On a Windows host, all parts of VirtualBox will use the COM
|
---|
1477 | functionality that is native to Windows. On other hosts (including
|
---|
1478 | Linux), VirtualBox comes with a built-in implementation of XPCOM, as
|
---|
1479 | originally created by the Mozilla project, which we have enhanced to
|
---|
1480 | support interprocess communication on a level comparable to Microsoft
|
---|
1481 | COM. Internally, VirtualBox has an abstraction layer that allows the
|
---|
1482 | same VirtualBox code to work both with native COM as well as our XPCOM
|
---|
1483 | implementation.</para>
|
---|
1484 |
|
---|
1485 | <sect2 id="pycom">
|
---|
1486 | <title>Python COM API</title>
|
---|
1487 |
|
---|
1488 | <para>On Windows, Python scripts can use COM and VirtualBox interfaces
|
---|
1489 | to control almost all aspects of virtual machine execution. For example,
|
---|
1490 | you can use the following commands to instantiate the VirtualBox object
|
---|
1491 | and start a VM: <screen>
|
---|
1492 | vbox = win32com.client.Dispatch("VirtualBox.VirtualBox")
|
---|
1493 | session = win32com.client.Dispatch("VirtualBox.Session")
|
---|
1494 | mach = vbox.findMachine("uuid or name of machine to start")
|
---|
1495 | progress = mach.launchVMProcess(session, "gui", "")
|
---|
1496 | progress.waitForCompletion(-1)
|
---|
1497 | </screen> Also, see
|
---|
1498 | <computeroutput>sdk/bindings/glue/python/samples/vboxshell.py</computeroutput>
|
---|
1499 | for more advanced usage scenarious. However, unless you have specific
|
---|
1500 | requirements, we strongly recommend that you use the generic glue layer
|
---|
1501 | described in the next section to access MS COM objects.</para>
|
---|
1502 | </sect2>
|
---|
1503 |
|
---|
1504 | <sect2 id="glue-python">
|
---|
1505 | <title>Common Python bindings layer</title>
|
---|
1506 |
|
---|
1507 | <para>As different wrappers ultimately provide access to the same
|
---|
1508 | underlying API, and to simplify porting and development of Python
|
---|
1509 | applications using the VirtualBox Main API, we developed a common glue
|
---|
1510 | layer that abstracts out most platform-specific details from the
|
---|
1511 | application and allows the developer to focus on application logic.
|
---|
1512 | The VirtualBox installer automatically sets up this glue layer for the
|
---|
1513 | system default Python installation.</para>
|
---|
1514 |
|
---|
1515 | <para>See <xref linkend="glue-python-setup"/> for details on how to
|
---|
1516 | set up the glue layer if you want to use a different Python installation,
|
---|
1517 | or if the VirtualBox installer failed to detect and set it up accordingly.</para>
|
---|
1518 |
|
---|
1519 | <para>The minimum supported Python version is 2.6.</para>
|
---|
1520 |
|
---|
1521 | <para>In this layer, the class
|
---|
1522 | <computeroutput>VirtualBoxManager</computeroutput> hides most
|
---|
1523 | platform-specific details. It can be used to access both the local
|
---|
1524 | (COM) and the web service based API. The following code can be used by
|
---|
1525 | an application to use the glue layer.</para>
|
---|
1526 |
|
---|
1527 | <screen># This code assumes vboxapi.py from VirtualBox distribution
|
---|
1528 | # being in PYTHONPATH, or installed system-wide
|
---|
1529 | from vboxapi import VirtualBoxManager
|
---|
1530 |
|
---|
1531 | # This code initializes VirtualBox manager with default style
|
---|
1532 | # and parameters
|
---|
1533 | virtualBoxManager = VirtualBoxManager(None, None)
|
---|
1534 |
|
---|
1535 | # Alternatively, one can be more verbose, and initialize
|
---|
1536 | # glue with web service backend, and provide authentication
|
---|
1537 | # information
|
---|
1538 | virtualBoxManager = VirtualBoxManager("WEBSERVICE",
|
---|
1539 | {'url':'http://myhost.com::18083/',
|
---|
1540 | 'user':'me',
|
---|
1541 | 'password':'secret'}) </screen>
|
---|
1542 |
|
---|
1543 | <para>We supply the <computeroutput>VirtualBoxManager</computeroutput>
|
---|
1544 | constructor with 2 arguments: style and parameters. Style defines
|
---|
1545 | which bindings style to use (could be "MSCOM", "XPCOM" or
|
---|
1546 | "WEBSERVICE"), and if set to <computeroutput>None</computeroutput>
|
---|
1547 | defaults to usable platform bindings (MS COM on Windows, XPCOM on
|
---|
1548 | other platforms). The second argument defines parameters, passed to
|
---|
1549 | the platform-specific module, as we do in the second example, where we
|
---|
1550 | pass a username and password to be used to authenticate against the web
|
---|
1551 | service.</para>
|
---|
1552 |
|
---|
1553 | <para>After obtaining the
|
---|
1554 | <computeroutput>VirtualBoxManager</computeroutput> instance, one can
|
---|
1555 | perform operations on the IVirtualBox class. For example, the
|
---|
1556 | following code will a start virtual machine by name or ID:</para>
|
---|
1557 |
|
---|
1558 | <screen>from vboxapi import VirtualBoxManager
|
---|
1559 | mgr = VirtualBoxManager(None, None)
|
---|
1560 | vbox = mgr.getVirtualBox()
|
---|
1561 | name = "Linux"
|
---|
1562 | mach = vbox.findMachine(name)
|
---|
1563 | session = mgr.getSessionObject(vbox)
|
---|
1564 | progress = mach.launchVMProcess(session, "gui", "")
|
---|
1565 | progress.waitForCompletion(-1)
|
---|
1566 | mgr.closeMachineSession(session)
|
---|
1567 | </screen>
|
---|
1568 | <para>
|
---|
1569 | The following code will print all registered machines and their log
|
---|
1570 | folders:
|
---|
1571 | </para>
|
---|
1572 | <screen>from vboxapi import VirtualBoxManager
|
---|
1573 | mgr = VirtualBoxManager(None, None)
|
---|
1574 | vbox = mgr.getVirtualBox()
|
---|
1575 |
|
---|
1576 | for m in mgr.getArray(vbox, 'machines'):
|
---|
1577 | print "Machine '%s' logs in '%s'" %(m.name, m.logFolder)
|
---|
1578 | </screen>
|
---|
1579 |
|
---|
1580 | <para>The code above demonstrates cross-platform access to array
|
---|
1581 | properties (certain limitations prevent one from using
|
---|
1582 | <computeroutput>vbox.machines</computeroutput> to access a list of
|
---|
1583 | available virtual machines in the case of XPCOM), and a mechanism for
|
---|
1584 | uniform session creation and closure
|
---|
1585 | (<computeroutput>mgr.getSessionObject()</computeroutput>).</para>
|
---|
1586 |
|
---|
1587 | <sect3 id="glue-python-setup">
|
---|
1588 | <title>Manual or subsequent setup</title>
|
---|
1589 |
|
---|
1590 | <para>If you want to use the glue layer with a different Python
|
---|
1591 | installation or the installer failed to set it up, then use these steps
|
---|
1592 | in a shell to install the necessary files:</para>
|
---|
1593 |
|
---|
1594 | <screen> # cd VBOX_INSTALL_PATH/sdk/installer
|
---|
1595 | # python vboxapisetup.py install</screen>
|
---|
1596 |
|
---|
1597 | <note> <para>On Windows hosts, a Python distribution along with the
|
---|
1598 | win32api bindings package need to be installed as a prerequisite. </para></note>
|
---|
1599 | </sect3>
|
---|
1600 |
|
---|
1601 | </sect2>
|
---|
1602 |
|
---|
1603 | <sect2 id="cppcom">
|
---|
1604 | <title>C++ COM API</title>
|
---|
1605 |
|
---|
1606 | <para>C++ is the language that VirtualBox itself is written in, so C++
|
---|
1607 | is the most direct way to use the Main API -- but it is not
|
---|
1608 | necessarily the easiest, as using COM and XPCOM has its own set of
|
---|
1609 | complications.</para>
|
---|
1610 |
|
---|
1611 | <para>VirtualBox ships with sample programs that demonstrate how to
|
---|
1612 | use the Main API to implement a number of tasks on your host platform.
|
---|
1613 | These samples can be found in the
|
---|
1614 | <computeroutput>sdk/bindings/xpcom/samples</computeroutput> directory for
|
---|
1615 | Linux, Mac OS X and Solaris and
|
---|
1616 | <computeroutput>sdk/bindings/mscom/samples</computeroutput> for Windows.
|
---|
1617 | The two samples are actually different, because the one for Windows
|
---|
1618 | uses native COM, whereas the other uses our XPCOM implementation, as
|
---|
1619 | described above.</para>
|
---|
1620 |
|
---|
1621 | <para>Since COM and XPCOM are conceptually very similar but vary in
|
---|
1622 | the implementation details, we have created a "glue" layer that
|
---|
1623 | shields COM client code from these differences. All VirtualBox uses is
|
---|
1624 | this glue layer, so the same code written once works on both Windows
|
---|
1625 | hosts (with native COM) as well as on other hosts (with our XPCOM
|
---|
1626 | implementation). It is recommended to always use this glue code
|
---|
1627 | instead of using the COM and XPCOM APIs directly, as it is very easy
|
---|
1628 | to make your code completely independent from the platform it is
|
---|
1629 | running on.<!-- A third sample,
|
---|
1630 | <computeroutput>tstVBoxAPIGlue.cpp</computeroutput>, illustrates how to
|
---|
1631 | use the glue layer.
|
---|
1632 | --></para>
|
---|
1633 |
|
---|
1634 | <para>In order to encapsulate platform differences between Microsoft
|
---|
1635 | COM and XPCOM, the following items should be kept in mind when using
|
---|
1636 | the glue layer:</para>
|
---|
1637 |
|
---|
1638 | <para><orderedlist>
|
---|
1639 | <listitem>
|
---|
1640 | <para><emphasis role="bold">Attribute getters and
|
---|
1641 | setters.</emphasis> COM has the notion of "attributes" in
|
---|
1642 | interfaces, which roughly compare to C++ member variables in
|
---|
1643 | classes. The difference is that for each attribute declared in
|
---|
1644 | an interface, COM automatically provides a "get" method to
|
---|
1645 | return the attribute's value. Unless the attribute has been
|
---|
1646 | marked as "readonly", a "set" attribute is also provided.</para>
|
---|
1647 |
|
---|
1648 | <para>To illustrate, the IVirtualBox interface has a "version"
|
---|
1649 | attribute, which is read-only and of the "wstring" type (the
|
---|
1650 | standard string type in COM). As a result, you can call the
|
---|
1651 | "get" method for this attribute to retrieve the version number
|
---|
1652 | of VirtualBox.</para>
|
---|
1653 |
|
---|
1654 | <para>Unfortunately, the implementation differs between COM and
|
---|
1655 | XPCOM. Microsoft COM names the "get" method like this:
|
---|
1656 | <computeroutput>get_Attribute()</computeroutput>, whereas XPCOM
|
---|
1657 | uses this syntax:
|
---|
1658 | <computeroutput>GetAttribute()</computeroutput> (and accordingly
|
---|
1659 | for "set" methods). To hide these differences, the VirtualBox
|
---|
1660 | glue code provides the
|
---|
1661 | <computeroutput>COMGETTER(attrib)</computeroutput> and
|
---|
1662 | <computeroutput>COMSETTER(attrib)</computeroutput> macros. So,
|
---|
1663 | <computeroutput>COMGETTER(version)()</computeroutput> (note, two
|
---|
1664 | pairs of brackets) expands to
|
---|
1665 | <computeroutput>get_Version()</computeroutput> on Windows and
|
---|
1666 | <computeroutput>GetVersion()</computeroutput> on other
|
---|
1667 | platforms.</para>
|
---|
1668 | </listitem>
|
---|
1669 |
|
---|
1670 | <listitem>
|
---|
1671 | <para><emphasis role="bold">Unicode conversions.</emphasis>
|
---|
1672 | While the rest of the modern world has pretty much settled on
|
---|
1673 | encoding strings in UTF-8, COM, unfortunately, uses UCS-16
|
---|
1674 | encoding. This requires a lot of conversions, in particular
|
---|
1675 | between the VirtualBox Main API and the Qt GUI, which, like the
|
---|
1676 | rest of Qt, likes to use UTF-8.</para>
|
---|
1677 |
|
---|
1678 | <para>To facilitate these conversions, VirtualBox provides the
|
---|
1679 | <computeroutput>com::Bstr</computeroutput> and
|
---|
1680 | <computeroutput>com::Utf8Str</computeroutput> classes, which
|
---|
1681 | support all kinds of conversions back and forth.</para>
|
---|
1682 | </listitem>
|
---|
1683 |
|
---|
1684 | <listitem>
|
---|
1685 | <para><emphasis role="bold">COM autopointers.</emphasis>
|
---|
1686 | Possibly the greatest pain of using COM -- reference counting --
|
---|
1687 | is alleviated by the
|
---|
1688 | <computeroutput>ComPtr<></computeroutput> template
|
---|
1689 | provided by the <computeroutput>ptr.h</computeroutput> file in
|
---|
1690 | the glue layer.</para>
|
---|
1691 | </listitem>
|
---|
1692 | </orderedlist></para>
|
---|
1693 | </sect2>
|
---|
1694 |
|
---|
1695 | <sect2 id="event-queue">
|
---|
1696 | <title>Event queue processing</title>
|
---|
1697 |
|
---|
1698 | <para>Both VirtualBox client programs and front-ends should
|
---|
1699 | periodically perform processing of the main event queue, and do that
|
---|
1700 | on the application's main thread. In the case of a typical GUI
|
---|
1701 | Windows/Mac OS application this happens automatically in the GUI's
|
---|
1702 | dispatch loop. However, for CLI only application, the appropriate actions
|
---|
1703 | have to be taken. For C++ applications, the VirtualBox SDK provided glue
|
---|
1704 | method
|
---|
1705 | <screen>
|
---|
1706 | int EventQueue::processEventQueue(uint32_t cMsTimeout)
|
---|
1707 | </screen> can be used for both blocking and non-blocking operations.
|
---|
1708 | For the Python bindings, a common layer provides the method <screen>
|
---|
1709 | VirtualBoxManager.waitForEvents(ms)
|
---|
1710 | </screen> with similar semantics.</para>
|
---|
1711 |
|
---|
1712 | <para>Things get somewhat more complicated for situations where an
|
---|
1713 | application using VirtualBox cannot directly control the main event
|
---|
1714 | loop and the main event queue is separated from the event queue of the
|
---|
1715 | programming library (for example in case of Qt on Unix platforms). In
|
---|
1716 | such a case, the application developer is advised to use a
|
---|
1717 | platform/toolkit specific event injection mechanism to force event
|
---|
1718 | queue checks either based on periodic timer events delivered to the
|
---|
1719 | main thread, or by using custom platform messages to notify the main
|
---|
1720 | thread when events are available. See the Qt (VirtualBox) front-end as
|
---|
1721 | an example.</para>
|
---|
1722 | </sect2>
|
---|
1723 |
|
---|
1724 | <sect2 id="vbcom">
|
---|
1725 | <title>Visual Basic and Visual Basic Script (VBS) on Windows
|
---|
1726 | hosts</title>
|
---|
1727 |
|
---|
1728 | <para>On Windows hosts, one can control some of the VirtualBox Main
|
---|
1729 | API functionality from VBS scripts, and pretty much everything from
|
---|
1730 | Visual Basic programs.<footnote>
|
---|
1731 | <para>The difference results from the way VBS treats COM
|
---|
1732 | safearrays, which are used to keep lists in the Main API. VBS
|
---|
1733 | expects every array element to be a
|
---|
1734 | <computeroutput>VARIANT</computeroutput>, which is too strict a
|
---|
1735 | limitation for any high performance API. We may lift this
|
---|
1736 | restriction for interface APIs in a future version, or
|
---|
1737 | alternatively provide conversion APIs.</para>
|
---|
1738 | </footnote></para>
|
---|
1739 |
|
---|
1740 | <para>VBS is a scripting language available in any recent Windows
|
---|
1741 | environment. As an example, the following VBS code will print the
|
---|
1742 | VirtualBox version: <screen>
|
---|
1743 | set vb = CreateObject("VirtualBox.VirtualBox")
|
---|
1744 | Wscript.Echo "VirtualBox version " & vb.version
|
---|
1745 | </screen> See
|
---|
1746 | <computeroutput>sdk/bindings/mscom/vbs/sample/vboxinfo.vbs</computeroutput>
|
---|
1747 | for the complete sample.</para>
|
---|
1748 |
|
---|
1749 | <para>Visual Basic is a popular high level language capable of
|
---|
1750 | accessing COM objects. The following VB code will iterate over all
|
---|
1751 | available virtual machines:<screen>
|
---|
1752 | Dim vb As VirtualBox.IVirtualBox
|
---|
1753 |
|
---|
1754 | vb = CreateObject("VirtualBox.VirtualBox")
|
---|
1755 | machines = ""
|
---|
1756 | For Each m In vb.Machines
|
---|
1757 | m = m & " " & m.Name
|
---|
1758 | Next
|
---|
1759 | </screen> See
|
---|
1760 | <computeroutput>sdk/bindings/mscom/vb/sample/vboxinfo.vb</computeroutput>
|
---|
1761 | for the complete sample.</para>
|
---|
1762 | </sect2>
|
---|
1763 |
|
---|
1764 | <sect2 id="cbinding">
|
---|
1765 | <title>C bindings to the VirtualBox API</title>
|
---|
1766 |
|
---|
1767 | <para>The VirtualBox API was originally designed to be object oriented
|
---|
1768 | and leverages XPCOM or COM as the middleware to natively map the API to
|
---|
1769 | C++. This means that in order to use the VirtualBox API from C there
|
---|
1770 | needs to be some helper code to bridge the language differences and
|
---|
1771 | reduce the differences between platforms.</para>
|
---|
1772 |
|
---|
1773 | <sect3 id="capi_glue">
|
---|
1774 | <title>Cross-platform C bindings to the VirtualBox API</title>
|
---|
1775 |
|
---|
1776 | <para>Starting with version 4.3, VirtualBox offers C bindings
|
---|
1777 | which allows using the same C client sources for all platforms,
|
---|
1778 | covering Windows, Linux, Mac OS X and Solaris. It is the
|
---|
1779 | preferred way to write API clients, even though the old style
|
---|
1780 | is still available.</para>
|
---|
1781 |
|
---|
1782 | </sect3>
|
---|
1783 |
|
---|
1784 | <sect3 id="c-gettingstarted">
|
---|
1785 | <title>Getting started</title>
|
---|
1786 |
|
---|
1787 | <para>The following sections describe how to use the VirtualBox API
|
---|
1788 | in a C program. The necessary files are included in the SDK, in the
|
---|
1789 | directories <computeroutput>sdk/bindings/c/include</computeroutput>
|
---|
1790 | and <computeroutput>sdk/bindings/c/glue</computeroutput>.</para>
|
---|
1791 |
|
---|
1792 | <para>As part of the SDK, a sample program
|
---|
1793 | <computeroutput>tstCAPIGlue.c</computeroutput> is provided in the
|
---|
1794 | directory <computeroutput>sdk/bindings/c/samples</computeroutput>
|
---|
1795 | which demonstrates
|
---|
1796 | using the C bindings to initialize the API, get handles for
|
---|
1797 | VirtualBox and Session objects, make calls to list and start virtual
|
---|
1798 | machines, monitor events, and uninitialize resources when done. The
|
---|
1799 | sample program is trying to illustrate all relevant concepts, so it
|
---|
1800 | is a great source of detail information. Among many other generally
|
---|
1801 | useful code sequences it contains a function which shows how to
|
---|
1802 | retrieve error details in C code if they are available from the API
|
---|
1803 | call.</para>
|
---|
1804 |
|
---|
1805 | <para>The sample program <computeroutput>tstCAPIGlue</computeroutput>
|
---|
1806 | can be built using the provided
|
---|
1807 | <computeroutput>Makefile</computeroutput> and can be run without
|
---|
1808 | arguments.</para>
|
---|
1809 |
|
---|
1810 | <para>It uses the VBoxCAPIGlue library (source code is in directory
|
---|
1811 | <computeroutput>sdk/bindings/c/glue</computeroutput>, to be used in
|
---|
1812 | your API client code) to open the C binding layer during runtime,
|
---|
1813 | which is preferred to other means as it isolates the code which
|
---|
1814 | locates the necessary dynamic library, using a known working way
|
---|
1815 | which works on all platforms. If you encounter problems with this
|
---|
1816 | glue code in <computeroutput>VBoxCAPIGlue.c</computeroutput>, let the
|
---|
1817 | VirtualBox developers know, rather than inventing incompatible
|
---|
1818 | solutions.</para>
|
---|
1819 |
|
---|
1820 | <para>The following sections document the important concepts needed
|
---|
1821 | to correctly use the C bindings, as it is vital for developing API
|
---|
1822 | client code which manages memory correctly, updates the reference
|
---|
1823 | counters correctly, and avoids crashes and memory leaks. Often API
|
---|
1824 | clients need to handle events, so the C API specifics are also
|
---|
1825 | described below.</para>
|
---|
1826 | </sect3>
|
---|
1827 |
|
---|
1828 | <sect3 id="c-initialization">
|
---|
1829 | <title>VirtualBox C API initialization</title>
|
---|
1830 |
|
---|
1831 | <para>Just like in C++, the API and the underlying middleware needs
|
---|
1832 | to be initialized before it can be used. The
|
---|
1833 | <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>
|
---|
1834 | header file provides the interface to the C bindings, but you can
|
---|
1835 | alternatively and more conveniently just include
|
---|
1836 | <computeroutput>VBoxCAPIGlue.h</computeroutput>,
|
---|
1837 | as this avoids the VirtualBox version dependent header file name and
|
---|
1838 | makes sure that the global variable <code>g_pVBoxFuncs</code> contains a
|
---|
1839 | pointer to the structure which contains the helper function pointers.
|
---|
1840 | Here's how to initialize the C API:<screen>#include "VBoxCAPIGlue.h"
|
---|
1841 | ...
|
---|
1842 | IVirtualBoxClient *vboxclient = NULL;
|
---|
1843 |
|
---|
1844 | /*
|
---|
1845 | * VBoxCGlueInit() loads the necessary dynamic library, handles errors
|
---|
1846 | * (producing an error message hinting what went wrong) and gives you
|
---|
1847 | * the pointer to the function table (g_pVBoxFuncs).
|
---|
1848 | *
|
---|
1849 | * Once you get the function table, then how and which functions
|
---|
1850 | * to use is explained below.
|
---|
1851 | *
|
---|
1852 | * g_pVBoxFuncs->pfnClientInitialize does all the necessary startup
|
---|
1853 | * action and provides us with pointers to an IVirtualBoxClient instance.
|
---|
1854 | * It should be matched by a call to g_pVBoxFuncs->pfnClientUninitialize()
|
---|
1855 | * when done.
|
---|
1856 | */
|
---|
1857 |
|
---|
1858 | if (VBoxCGlueInit())
|
---|
1859 | {
|
---|
1860 | fprintf(stderr, "s: FATAL: VBoxCGlueInit failed: %s\n",
|
---|
1861 | argv[0], g_szVBoxErrMsg);
|
---|
1862 | return EXIT_FAILURE;
|
---|
1863 | }
|
---|
1864 |
|
---|
1865 | g_pVBoxFuncs->pfnClientInitialize(NULL, &vboxclient);
|
---|
1866 | if (!vboxclient)
|
---|
1867 | {
|
---|
1868 | fprintf(stderr, "%s: FATAL: could not get VirtualBoxClient reference\n",
|
---|
1869 | argv[0]);
|
---|
1870 | return EXIT_FAILURE;
|
---|
1871 | }</screen></para>
|
---|
1872 |
|
---|
1873 | <para>If <computeroutput>vboxclient</computeroutput> is still
|
---|
1874 | <computeroutput>NULL</computeroutput> this means the initializationi
|
---|
1875 | failed and the VirtualBox C API cannot be used.</para>
|
---|
1876 |
|
---|
1877 | <para>It is possible to write C applications using multiple threads
|
---|
1878 | which all use the VirtualBox API, as long as you're initializing
|
---|
1879 | the C API in each thread which your application creates. This is done
|
---|
1880 | with <code>g_pVBoxFuncs->pfnClientThreadInitialize()</code> and
|
---|
1881 | likewise before the thread is terminated the API must be
|
---|
1882 | uninitialized with
|
---|
1883 | <code>g_pVBoxFuncs->pfnClientThreadUninitialize()</code>. You don't
|
---|
1884 | have to use these functions in worker threads created by COM/XPCOM
|
---|
1885 | (which you might utilize if your code uses active event handling),
|
---|
1886 | since everything is initialized correctly already. On Windows the C
|
---|
1887 | bindings create a marshaller which supports a wide range of COM
|
---|
1888 | threading models, from Single-Threaded Apartments (STA) to
|
---|
1889 | Multithreaded Apartments (MTA), so you don't have to worry about
|
---|
1890 | these details unless you plan to use active event handlers. See
|
---|
1891 | the sample code for how to get this to work reliably (in other words
|
---|
1892 | think twice if passive event handling isn't the better solution after
|
---|
1893 | you looked at the sample code).</para>
|
---|
1894 | </sect3>
|
---|
1895 |
|
---|
1896 | <sect3 id="c-invocation">
|
---|
1897 | <title>C API attribute and method invocation</title>
|
---|
1898 |
|
---|
1899 | <para>Method invocation is straightforward. It looks very similar
|
---|
1900 | to the C++ mechanism since it also uses a macro which internally
|
---|
1901 | accesses the vtable and additionally needs to be passed a pointer to the
|
---|
1902 | object as the first argument to serve as the
|
---|
1903 | <computeroutput>this</computeroutput> pointer.</para>
|
---|
1904 |
|
---|
1905 | <para>Using the C bindings all method invocations return a numeric
|
---|
1906 | result code of type <code>HRESULT</code> (with a few exceptions
|
---|
1907 | which normally are not relevant).</para>
|
---|
1908 |
|
---|
1909 | <para>If an interface is specified as returning an object, a pointer
|
---|
1910 | to a pointer to the appropriate object must be passed as the last
|
---|
1911 | argument. The method will then store an object pointer in that
|
---|
1912 | location.</para>
|
---|
1913 |
|
---|
1914 | <para>Likewise, attributes (properties) can be queried or set using
|
---|
1915 | method invocations, using specially named methods. For each
|
---|
1916 | attribute there exists a getter method, the name of which is composed
|
---|
1917 | of <computeroutput>get_</computeroutput> followed by the capitalized
|
---|
1918 | attribute name. Unless the attribute is read-only, an analogous
|
---|
1919 | <computeroutput>set_</computeroutput> method exists. Let's apply
|
---|
1920 | these rules to get the <computeroutput>IVirtualBox</computeroutput>
|
---|
1921 | reference, an <computeroutput>ISession</computeroutput> instance
|
---|
1922 | reference and read the
|
---|
1923 | <link linkend="IVirtualBox__revision">IVirtualBox::revision</link>
|
---|
1924 | attribute:
|
---|
1925 | <screen>
|
---|
1926 | IVirtualBox *vbox = NULL;
|
---|
1927 | ISession *session = NULL;
|
---|
1928 | HRESULT rc;
|
---|
1929 | ULONG revision;
|
---|
1930 |
|
---|
1931 | rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &vbox);
|
---|
1932 |
|
---|
1933 | if (FAILED(rc) || !vbox)
|
---|
1934 | {
|
---|
1935 | PrintErrorInfo(argv[0], "FATAL: could not get VirtualBox reference", rc);
|
---|
1936 | return EXIT_FAILURE;
|
---|
1937 | }
|
---|
1938 | rc = IVirtualBoxClient_get_Session(vboxclient, &session);
|
---|
1939 | if (FAILED(rc) || !session)
|
---|
1940 | {
|
---|
1941 | PrintErrorInfo(argv[0], "FATAL: could not get Session reference", rc);
|
---|
1942 | return EXIT_FAILURE;
|
---|
1943 | }
|
---|
1944 |
|
---|
1945 | rc = IVirtualBox_get_Revision(vbox, &revision);
|
---|
1946 | if (SUCCEEDED(rc))
|
---|
1947 | {
|
---|
1948 | printf("Revision: %u\n", revision);
|
---|
1949 | }</screen></para>
|
---|
1950 |
|
---|
1951 | <para>The convenience macros for calling a method are named by prepending
|
---|
1952 | the method name with the interface name (using <code>_</code> as the
|
---|
1953 | separator).</para>
|
---|
1954 |
|
---|
1955 | <para>So far only attribute getters were illustrated, but generic
|
---|
1956 | method calls are straightforward, too:
|
---|
1957 | <screen>IMachine *machine = NULL;
|
---|
1958 | BSTR vmname = ...;
|
---|
1959 | ...
|
---|
1960 | /*
|
---|
1961 | * Calling IMachine::findMachine(...)
|
---|
1962 | */
|
---|
1963 | rc = IVirtualBox_FindMachine(vbox, vmname, &machine);</screen></para>
|
---|
1964 |
|
---|
1965 | <para>As a more complicated example of a method invocation, let's
|
---|
1966 | call
|
---|
1967 | <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess</link>
|
---|
1968 | which returns an IProgress object. Note again that the method name is
|
---|
1969 | capitalized:
|
---|
1970 | <screen>IProgress *progress;
|
---|
1971 | ...
|
---|
1972 | rc = IMachine_LaunchVMProcess(
|
---|
1973 | machine, /* this */
|
---|
1974 | session, /* arg 1 */
|
---|
1975 | sessionType, /* arg 2 */
|
---|
1976 | env, /* arg 3 */
|
---|
1977 | &progress /* Out */
|
---|
1978 | );</screen></para>
|
---|
1979 |
|
---|
1980 | <para>All objects with their methods and attributes are documented
|
---|
1981 | in <xref linkend="sdkref_classes"/>.</para>
|
---|
1982 | </sect3>
|
---|
1983 |
|
---|
1984 | <sect3 id="c-string-handling">
|
---|
1985 | <title>String handling</title>
|
---|
1986 |
|
---|
1987 | <para>When dealing with strings you have to be aware of a string's
|
---|
1988 | encoding and ownership.</para>
|
---|
1989 |
|
---|
1990 | <para>Internally, the API uses UTF-16 encoded strings. A set of
|
---|
1991 | conversion functions is provided to convert other encodings to and
|
---|
1992 | from UTF-16. The type of a UTF-16 character is
|
---|
1993 | <computeroutput>BSTR</computeroutput> (or its constant counterpart
|
---|
1994 | <computeroutput>CBSTR</computeroutput>), which is an array type,
|
---|
1995 | represented by a pointer to the start of the zero-terminated string.
|
---|
1996 | There are functions for converting between UTF-8 and UTF-16 strings
|
---|
1997 | available through <code>g_pVBoxFuncs</code>:
|
---|
1998 | <screen>int (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
|
---|
1999 | int (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);</screen></para>
|
---|
2000 |
|
---|
2001 | <para>The ownership of a string determines who is responsible for
|
---|
2002 | releasing resources associated with the string. Whenever the API
|
---|
2003 | creates a string (essentially for output parameters), ownership is
|
---|
2004 | transferred to the caller. To avoid resource leaks, the caller
|
---|
2005 | should release resources once the string is no longer needed.
|
---|
2006 | There are plenty of examples in the sample code.</para>
|
---|
2007 | </sect3>
|
---|
2008 |
|
---|
2009 | <sect3 id="c-safearray">
|
---|
2010 | <title>Array handling</title>
|
---|
2011 |
|
---|
2012 | <para>Arrays are handled somewhat similarly to strings, with the
|
---|
2013 | additional information of the number of elements in the array. The
|
---|
2014 | exact details of string passing depends on the platform middleware
|
---|
2015 | (COM/XPCOM), and therefore the C binding offers helper functions to
|
---|
2016 | gloss over these differences.</para>
|
---|
2017 |
|
---|
2018 | <para>Passing arrays as input parameters to API methods is usually
|
---|
2019 | done by the following sequence, calling a hypothetical
|
---|
2020 | <code>IArrayDemo_PassArray</code> API method:
|
---|
2021 | <screen>static const ULONG aElements[] = { 1, 2, 3, 4 };
|
---|
2022 | ULONG cElements = sizeof(aElements) / sizeof(aElements[0]);
|
---|
2023 | SAFEARRAY *psa = NULL;
|
---|
2024 | psa = g_pVBoxFuncs->pfnSafeArrayCreateVector(VT_I4, 0, cElements);
|
---|
2025 | g_pVBoxFuncs->pfnSafeArrayCopyInParamHelper(psa, aElements, sizeof(aElements));
|
---|
2026 | IArrayDemo_PassArray(pThis, ComSafeArrayAsInParam(psa));
|
---|
2027 | g_pVBoxFuncs->pfnSafeArrayDestroy(psa);</screen></para>
|
---|
2028 |
|
---|
2029 | <para>Likewise, getting arrays results from output parameters is done
|
---|
2030 | using helper functions which manage memory allocations as part of
|
---|
2031 | their other functionality:
|
---|
2032 | <screen>SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
|
---|
2033 | ULONG *pData;
|
---|
2034 | ULONG cElements;
|
---|
2035 | IArrayDemo_ReturnArray(pThis, ComSafeArrayAsOutTypeParam(psa, ULONG));
|
---|
2036 | g_pVBoxFuncs->pfnSafeArrayCopyOutParamHelper((void **)&pData, &cElements, VT_I4, psa);
|
---|
2037 | g_pVBoxFuncs->pfnSafeArrayDestroy(psa);</screen></para>
|
---|
2038 |
|
---|
2039 | <para>This covers the necessary functionality for all array element
|
---|
2040 | types except interface references. These need special helpers to
|
---|
2041 | manage the reference counting correctly. The following code snippet
|
---|
2042 | gets the list of VMs, and passes the first IMachine reference to
|
---|
2043 | another API function (assuming that there is at least one element
|
---|
2044 | in the array, to simplify the example):
|
---|
2045 | <screen>SAFEARRAY psa = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
|
---|
2046 | IMachine **machines = NULL;
|
---|
2047 | ULONG machineCnt = 0;
|
---|
2048 | ULONG i;
|
---|
2049 | IVirtualBox_get_Machines(virtualBox, ComSafeArrayAsOutIfaceParam(machinesSA, IMachine *));
|
---|
2050 | g_pVBoxFuncs->pfnSafeArrayCopyOutIfaceParamHelper((IUnknown ***)&machines, &machineCnt, machinesSA);
|
---|
2051 | g_pVBoxFuncs->pfnSafeArrayDestroy(machinesSA);
|
---|
2052 | /* Now "machines" contains the IMachine references, and machineCnt the
|
---|
2053 | * number of elements in the array. */
|
---|
2054 | ...
|
---|
2055 | SAFEARRAY *psa = g_pVBoxFuncs->pfnSafeArrayCreateVector(VT_IUNKNOWN, 0, 1);
|
---|
2056 | g_pVBoxFuncs->pfnSafeArrayCopyInParamHelper(psa, (void *)&machines[0], sizeof(machines[0]));
|
---|
2057 | IVirtualBox_GetMachineStates(ComSafeArrayAsInParam(psa), ...);
|
---|
2058 | ...
|
---|
2059 | g_pVBoxFuncs->pfnSafeArrayDestroy(psa);
|
---|
2060 | for (i = 0; i < machineCnt; ++i)
|
---|
2061 | {
|
---|
2062 | IMachine *machine = machines[i];
|
---|
2063 | IMachine_Release(machine);
|
---|
2064 | }
|
---|
2065 | free(machines);</screen></para>
|
---|
2066 |
|
---|
2067 | <para>Handling output parameters needs more special handling than
|
---|
2068 | input parameters, thus only for the former are there special helpers
|
---|
2069 | while the latter is handled through the generic array support.</para>
|
---|
2070 | </sect3>
|
---|
2071 |
|
---|
2072 | <sect3 id="c-eventhandling">
|
---|
2073 | <title>Event handling</title>
|
---|
2074 |
|
---|
2075 | <para>The VirtualBox API offers two types of event handling, active
|
---|
2076 | and passive, and consequently there is support for both with the
|
---|
2077 | C API binding. Active event handling (based on asynchronous
|
---|
2078 | callback invocation for event delivery) is more difficult, as it
|
---|
2079 | requires the construction of valid C++ objects in C, which is
|
---|
2080 | inherently platform and compiler dependent. Passive event handling
|
---|
2081 | is much simpler, it relies on an event loop, fetching events and
|
---|
2082 | triggering the necessary handlers explicitly in the API client code.
|
---|
2083 | Both approaches depend on an event loop to make sure that events
|
---|
2084 | get delivered in a timely manner but otherwise differ in what
|
---|
2085 | else is required to implement the respective event handler type.</para>
|
---|
2086 |
|
---|
2087 | <para>The C API sample contains code for both event handling styles,
|
---|
2088 | and one has to modify the appropriate <code>#define</code> to select
|
---|
2089 | which style is actually used by the compiled program. It allows a
|
---|
2090 | good comparison between the two variants and the code sequences are
|
---|
2091 | probably worth reusing without much change in other API clients
|
---|
2092 | with only minor adaptions.</para>
|
---|
2093 |
|
---|
2094 | <para>Active event handling needs to ensure that the following helper
|
---|
2095 | function is called frequently enough in the primary thread:
|
---|
2096 | <screen>g_pVBoxFuncs->pfnProcessEventQueue(cTimeoutMS);</screen></para>
|
---|
2097 |
|
---|
2098 | <para>The actual event handler implementation is quite tedious, as
|
---|
2099 | it has to implement a complete API interface. Especially on Windows
|
---|
2100 | it is a lot of work to implement the complicated
|
---|
2101 | <code>IDispatch</code> interface, requiring loading COM type
|
---|
2102 | information and using it in the <code>IDispatch</code> method
|
---|
2103 | implementation. Overall this is quite tedious compared to passive
|
---|
2104 | event handling.</para>
|
---|
2105 |
|
---|
2106 | <para>Passive event handling uses a similar event loop structure,
|
---|
2107 | which requires calling the following function in a loop, and
|
---|
2108 | processing the returned event appropriately:
|
---|
2109 | <screen>rc = IEventSource_GetEvent(pEventSource, pListener, cTimeoutMS, &pEvent);</screen></para>
|
---|
2110 |
|
---|
2111 | <para>After processing the event it needs to be marked as processed
|
---|
2112 | with the following method call:
|
---|
2113 | <screen>rc = IEventSource_EventProcessed(pEventSource, pListener, pEvent);</screen></para>
|
---|
2114 |
|
---|
2115 | <para>This is vital for vetoable events, as they would be stuck
|
---|
2116 | otherwise, waiting on whether the veto comes or not. It does not do any
|
---|
2117 | harm for other event types, and in the end is cheaper than checking
|
---|
2118 | if the event at hand is vetoable or not.</para>
|
---|
2119 |
|
---|
2120 | <para>The general event handling concepts are described in the API
|
---|
2121 | specification (see <xref linkend="events"/>), including how to
|
---|
2122 | aggregate multiple event sources for processing in one event loop.
|
---|
2123 | As mentioned, the sample illustrates the practical aspects of how to
|
---|
2124 | use both types of event handling, active and passive, from a C
|
---|
2125 | application. Additional hints are in the comments documenting
|
---|
2126 | the helper methods in
|
---|
2127 | <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>.
|
---|
2128 | The code complexity of active event handling (and its inherently
|
---|
2129 | platform/compiler specific aspects) should be motivation to use passive
|
---|
2130 | event handling wherever possible.</para>
|
---|
2131 | </sect3>
|
---|
2132 |
|
---|
2133 | <sect3 id="c-uninitialization">
|
---|
2134 | <title>C API uninitialization</title>
|
---|
2135 |
|
---|
2136 | <para>Uninitialization is performed by
|
---|
2137 | <computeroutput>g_pVBoxFuncs->pfnClientUninitialize().</computeroutput>
|
---|
2138 | If your program can exit in more than one place, it is a good idea
|
---|
2139 | to install this function as an exit handler using the C library function
|
---|
2140 | <computeroutput>atexit()</computeroutput> just after calling
|
---|
2141 | <computeroutput>g_pVBoxFuncs->pfnClientInitialize()</computeroutput>
|
---|
2142 | , e.g. <screen>#include <stdlib.h>
|
---|
2143 | #include <stdio.h>
|
---|
2144 |
|
---|
2145 | ...
|
---|
2146 |
|
---|
2147 | /*
|
---|
2148 | * Make sure g_pVBoxFuncs->pfnClientUninitialize() is called at exit, no
|
---|
2149 | * matter if we return from the initial call to main or call exit()
|
---|
2150 | * somewhere else. Note that atexit registered functions are not
|
---|
2151 | * called upon abnormal termination, i.e. when calling abort() or
|
---|
2152 | * signal().
|
---|
2153 | */
|
---|
2154 |
|
---|
2155 | if (atexit(g_pVBoxFuncs->pfnClientUninitialize()) != 0) {
|
---|
2156 | fprintf(stderr, "failed to register g_pVBoxFuncs->pfnClientUninitialize()\n");
|
---|
2157 | exit(EXIT_FAILURE);
|
---|
2158 | }</screen></para>
|
---|
2159 |
|
---|
2160 | <para>Another idea would be to write your own <computeroutput>void
|
---|
2161 | myexit(int status)</computeroutput> function, calling
|
---|
2162 | <computeroutput>g_pVBoxFuncs->pfnClientUninitialize()</computeroutput>
|
---|
2163 | followed by the real <computeroutput>exit()</computeroutput>, and
|
---|
2164 | use it instead of <computeroutput>exit()</computeroutput> throughout
|
---|
2165 | your program and at the end of
|
---|
2166 | <computeroutput>main.</computeroutput></para>
|
---|
2167 |
|
---|
2168 | <para>If you expect your program to be terminated by a signal (e.g. a
|
---|
2169 | user types CTRL-C sending SIGINT) you might want to install a signal
|
---|
2170 | handler setting a flag noting that a signal was sent and then
|
---|
2171 | calling
|
---|
2172 | <computeroutput>g_pVBoxFuncs->pfnClientUninitialize()</computeroutput>
|
---|
2173 | later on, <emphasis>not</emphasis> from the handler itself.</para>
|
---|
2174 |
|
---|
2175 | <para>That said, if a client program forgets to call
|
---|
2176 | <computeroutput>g_pVBoxFuncs->pfnClientUninitialize()</computeroutput>
|
---|
2177 | before it terminates, there is a mechanism in place which will
|
---|
2178 | eventually release references held by the client. On Windows it can
|
---|
2179 | take quite a while, on the order of 6-7 minutes.</para>
|
---|
2180 | </sect3>
|
---|
2181 |
|
---|
2182 | <sect3 id="c-linking">
|
---|
2183 | <title>Compiling and linking</title>
|
---|
2184 |
|
---|
2185 | <para>A program using the C binding has to open the library during
|
---|
2186 | runtime using the help of the glue code provided and as shown in the
|
---|
2187 | example <computeroutput>tstCAPIGlue.c</computeroutput>.
|
---|
2188 | Compilation and linking can be achieved with a makefile fragment
|
---|
2189 | similar to:<screen># Where is the SDK directory?
|
---|
2190 | PATH_SDK = ../../..
|
---|
2191 | CAPI_INC = -I$(PATH_SDK)/bindings/c/include
|
---|
2192 | ifdef ProgramFiles
|
---|
2193 | PLATFORM_INC = -I$(PATH_SDK)/bindings/mscom/include
|
---|
2194 | PLATFORM_LIB = $(PATH_SDK)/bindings/mscom/lib
|
---|
2195 | else
|
---|
2196 | PLATFORM_INC = -I$(PATH_SDK)/bindings/xpcom/include
|
---|
2197 | PLATFORM_LIB = $(PATH_SDK)/bindings/xpcom/lib
|
---|
2198 | endif
|
---|
2199 | GLUE_DIR = $(PATH_SDK)/bindings/c/glue
|
---|
2200 | GLUE_INC = -I$(GLUE_DIR)
|
---|
2201 |
|
---|
2202 | # Compile Glue Library
|
---|
2203 | VBoxCAPIGlue.o: $(GLUE_DIR)/VBoxCAPIGlue.c
|
---|
2204 | $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $<
|
---|
2205 |
|
---|
2206 | # Compile interface ID list
|
---|
2207 | VirtualBox_i.o: $(PLATFORM_LIB)/VirtualBox_i.c
|
---|
2208 | $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $<
|
---|
2209 |
|
---|
2210 | # Compile program code
|
---|
2211 | program.o: program.c
|
---|
2212 | $(CC) $(CFLAGS) $(CAPI_INC) $(PLATFORM_INC) $(GLUE_INC) -o $@ -c $<
|
---|
2213 |
|
---|
2214 | # Link program.
|
---|
2215 | program: program.o VBoxCAPICGlue.o VirtualBox_i.o
|
---|
2216 | $(CC) -o $@ $^ -ldl -lpthread</screen></para>
|
---|
2217 | </sect3>
|
---|
2218 |
|
---|
2219 | <sect3 id="capi_conversion">
|
---|
2220 | <title>Conversion of code using legacy C bindings</title>
|
---|
2221 |
|
---|
2222 | <para>This section aims to make the task of converting code using the
|
---|
2223 | legacy C bindings to the new style a breeze by following these key
|
---|
2224 | steps.</para>
|
---|
2225 |
|
---|
2226 | <para>One necessary change is adjusting your Makefile to reflect the
|
---|
2227 | different include paths. As shown in the makefile fragment above, there
|
---|
2228 | are now three relevant include directories. The XPCOM include directory
|
---|
2229 | is still relevant for platforms where the XPCOM middleware is used but
|
---|
2230 | most of its include files live elsewhere now so it's good to have it
|
---|
2231 | last. Additionally the <computeroutput>VirtualBox_i.c</computeroutput>
|
---|
2232 | file needs to be compiled and linked to the program since it contains
|
---|
2233 | the interface IDs (IIDs) relevant for the VirtualBox API, making sure
|
---|
2234 | they are not replicated endlessly if the code refers to them
|
---|
2235 | frequently.</para>
|
---|
2236 |
|
---|
2237 | <para>The C API client code should include
|
---|
2238 | <computeroutput>VBoxCAPIGlue.h</computeroutput> instead of
|
---|
2239 | <computeroutput>VBoxXPCOMCGlue.h</computeroutput> or
|
---|
2240 | <computeroutput>VBoxCAPI_v&VBOX_VERSION_MAJOR;_&VBOX_VERSION_MINOR;.h</computeroutput>,
|
---|
2241 | as this makes sure the correct macros and internal translations are
|
---|
2242 | selected.</para>
|
---|
2243 |
|
---|
2244 | <para>All API method calls (anything mentioning <code>vtbl</code>)
|
---|
2245 | should be rewritten using the convenience macros for calling methods,
|
---|
2246 | as these hide the internal details, are generally easier to
|
---|
2247 | use, and are shorter to type. You should remove as many as possible
|
---|
2248 | <code>(nsISupports **)</code> or similar typecasts, as the new style
|
---|
2249 | should use the correct type in most places, increasing the type
|
---|
2250 | safety in case of an error in the source code.</para>
|
---|
2251 |
|
---|
2252 | <para>To gloss over the platform differences, API client code should
|
---|
2253 | no longer rely on XPCOM specific interface names such as
|
---|
2254 | <code>nsISupports</code>, <code>nsIException</code> and
|
---|
2255 | <code>nsIEventQueue</code>, and replace them by the platform
|
---|
2256 | independent interface names <code>IUnknown</code> and
|
---|
2257 | <code>IErrorInfo</code> for the first two respectively. Event queue
|
---|
2258 | handling should be replaced by using the platform independent way
|
---|
2259 | described in <xref linkend="c-eventhandling"/>.</para>
|
---|
2260 |
|
---|
2261 | <para>Finally adjust the string and array handling to use the new
|
---|
2262 | helpers, as these make sure the code works without changes with
|
---|
2263 | both COM and XPCOM, which are significantly different in this area.
|
---|
2264 | The code should be double checked to see that it uses the correct way to
|
---|
2265 | manage memory and is freeing it only after the last use.</para>
|
---|
2266 | </sect3>
|
---|
2267 |
|
---|
2268 | <sect3 id="xpcom_cbinding">
|
---|
2269 | <title>Legacy C bindings to VirtualBox API for XPCOM</title>
|
---|
2270 |
|
---|
2271 | <note>
|
---|
2272 | <para>This section applies to Linux, Mac OS X and Solaris
|
---|
2273 | hosts only and describes deprecated use of the API from C.</para>
|
---|
2274 | </note>
|
---|
2275 |
|
---|
2276 | <para>Starting with version 2.2, VirtualBox offers C bindings for
|
---|
2277 | its API which works only on platforms using XPCOM. Refer to the
|
---|
2278 | old SDK documentation (included in the SDK packages for version 4.3.6
|
---|
2279 | or earlier) since it still applies unchanged. The fundamental concepts
|
---|
2280 | are similar (but the syntactical details are quite different) to the
|
---|
2281 | newer cross-platform C bindings which should be used for all new code,
|
---|
2282 | as the support for the old C bindings will go away in a major release
|
---|
2283 | after version 4.3.</para>
|
---|
2284 | </sect3>
|
---|
2285 | </sect2>
|
---|
2286 | </sect1>
|
---|
2287 | </chapter>
|
---|
2288 |
|
---|
2289 | <chapter id="concepts">
|
---|
2290 | <title>Basic VirtualBox concepts; some examples</title>
|
---|
2291 |
|
---|
2292 | <para>The following explains some basic VirtualBox concepts such as the
|
---|
2293 | VirtualBox object, sessions and how virtual machines are manipulated and
|
---|
2294 | launched using the Main API. The coding examples use a pseudo-code style
|
---|
2295 | closely related to the object-oriented web service (OOWS) for JAX-WS.
|
---|
2296 | Depending on which environment you are using, you will need to adjust the
|
---|
2297 | examples.</para>
|
---|
2298 |
|
---|
2299 | <sect1>
|
---|
2300 | <title>Obtaining basic machine information. Reading attributes</title>
|
---|
2301 |
|
---|
2302 | <para>Any program using the Main API will first need access to the
|
---|
2303 | global VirtualBox object (see
|
---|
2304 | <link linkend="IVirtualBox">IVirtualBox</link>), from which all other
|
---|
2305 | functionality of the API is derived. With the OOWS for JAX-WS, this is
|
---|
2306 | returned from the
|
---|
2307 | <link linkend="IWebsessionManager__logon">IWebsessionManager::logon()</link>
|
---|
2308 | call.</para>
|
---|
2309 |
|
---|
2310 | <para>To enumerate virtual machines, one would look at the "machines"
|
---|
2311 | array attribute in the VirtualBox object (see
|
---|
2312 | <link linkend="IVirtualBox__machines">IVirtualBox::machines</link>).
|
---|
2313 | This array contains all virtual machines currently registered with the
|
---|
2314 | host, each of them being an instance of
|
---|
2315 | <link linkend="IMachine">IMachine</link>.
|
---|
2316 | From each such instance, one can query additional information, such as
|
---|
2317 | the UUID, the name, memory, operating system and more by looking at the
|
---|
2318 | attributes; see the attributes list in
|
---|
2319 | <link linkend="IMachine">IMachine</link> documentation.</para>
|
---|
2320 |
|
---|
2321 | <para>As mentioned in the preceding chapters, depending on your
|
---|
2322 | programming environment, attributes are mapped to corresponding "get"
|
---|
2323 | and (if the attribute is not read-only) "set" methods. So when the
|
---|
2324 | documentation says that IMachine has a
|
---|
2325 | "<link linkend="IMachine__name">name</link>" attribute, this means you
|
---|
2326 | need to code something
|
---|
2327 | like the following to get the machine's name:
|
---|
2328 | <screen>IMachine machine = ...;
|
---|
2329 | String name = machine.getName();</screen>
|
---|
2330 | Boolean attribute getters can sometimes be called
|
---|
2331 | <computeroutput>isAttribute()</computeroutput> due to JAX-WS naming
|
---|
2332 | conventions.</para>
|
---|
2333 | </sect1>
|
---|
2334 |
|
---|
2335 | <sect1>
|
---|
2336 | <title>Changing machine settings: Sessions</title>
|
---|
2337 |
|
---|
2338 | <para>As described in the previous section, to read a machine's attribute,
|
---|
2339 | one invokes the corresponding "get" method. One would think that to
|
---|
2340 | change settings of a machine, it would suffice to call the corresponding
|
---|
2341 | "set" method -- for example, to set a VM's memory to 1024 MB, one would
|
---|
2342 | call <computeroutput>setMemorySize(1024)</computeroutput>. Try that, and
|
---|
2343 | you will get an error: "The machine is not mutable."</para>
|
---|
2344 |
|
---|
2345 | <para>So unfortunately, things are not that easy. VirtualBox is a
|
---|
2346 | complicated environment in which multiple processes compete for possibly
|
---|
2347 | the same resources, especially machine settings. As a result, machines
|
---|
2348 | must be "locked" before they can either be modified or started. This is
|
---|
2349 | to prevent multiple processes from making conflicting changes to a
|
---|
2350 | machine: it should, for example, not be allowed to change the memory
|
---|
2351 | size of a virtual machine while it is running. (You can't add more
|
---|
2352 | memory to a real computer while it is running either, at least not to an
|
---|
2353 | ordinary PC.) Also, two processes must not change settings at the same
|
---|
2354 | time, or start a machine at the same time.</para>
|
---|
2355 |
|
---|
2356 | <para>These requirements are implemented in the Main API by way of
|
---|
2357 | "sessions", in particular, the <link linkend="ISession">ISession</link>
|
---|
2358 | interface. Each process which talks to
|
---|
2359 | VirtualBox needs its own instance of ISession. In the web service, you
|
---|
2360 | can request the creation of such an object by calling
|
---|
2361 | <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>.
|
---|
2362 | More complex management tasks might need multiple instances of ISession,
|
---|
2363 | and each call returns a new one.</para>
|
---|
2364 |
|
---|
2365 | <para>This session object must then be used like a mutex semaphore in
|
---|
2366 | common programming environments. Before you can change machine settings,
|
---|
2367 | you must write-lock the machine by calling
|
---|
2368 | <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
|
---|
2369 | with your process's session object.</para>
|
---|
2370 |
|
---|
2371 | <para>After the machine has been locked, the
|
---|
2372 | <link linkend="ISession__machine">ISession::machine</link> attribute
|
---|
2373 | contains a copy of the original IMachine object upon which the session
|
---|
2374 | was opened, but this copy is "mutable": you can invoke "set" methods on
|
---|
2375 | it.</para>
|
---|
2376 |
|
---|
2377 | <para>When done making the changes to the machine, you must call
|
---|
2378 | <link linkend="IMachine__saveSettings">IMachine::saveSettings()</link>,
|
---|
2379 | which will copy the changes you have made from your "mutable" machine
|
---|
2380 | back to the real machine and write them out to the machine settings XML
|
---|
2381 | file. This will make your changes permanent.</para>
|
---|
2382 |
|
---|
2383 | <para>Finally, it is important to always unlock the machine again, by
|
---|
2384 | calling
|
---|
2385 | <link linkend="ISession__unlockMachine">ISession::unlockMachine()</link>.
|
---|
2386 | Otherwise, when the calling process exits, the machine will be moved to the
|
---|
2387 | "aborted" state, which can lead to loss of data.</para>
|
---|
2388 |
|
---|
2389 | <para>So, as an example, the sequence to change a machine's memory to
|
---|
2390 | 1024 MB is something like this:<screen>IWebsessionManager mgr ...;
|
---|
2391 | IVirtualBox vbox = mgr.logon(user, pass);
|
---|
2392 | ...
|
---|
2393 | IMachine machine = ...; // read-only machine
|
---|
2394 | ISession session = mgr.getSessionObject();
|
---|
2395 | machine.lockMachine(session, LockType.Write); // machine is now locked for writing
|
---|
2396 | IMachine mutable = session.getMachine(); // obtain the mutable machine copy
|
---|
2397 | mutable.setMemorySize(1024);
|
---|
2398 | mutable.saveSettings(); // write settings to XML
|
---|
2399 | session.unlockMachine();</screen></para>
|
---|
2400 | </sect1>
|
---|
2401 |
|
---|
2402 | <sect1>
|
---|
2403 | <title>Launching virtual machines</title>
|
---|
2404 |
|
---|
2405 | <para>To launch a virtual machine, you call
|
---|
2406 | <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>.
|
---|
2407 | This instructs the VirtualBox engine to start a new process containing the
|
---|
2408 | virtual machine. The host system sees each virtual machine as a single
|
---|
2409 | process, even if the virtual machine has hundreds of its own processes
|
---|
2410 | running inside it. (This new VM process in turn obtains a write lock on
|
---|
2411 | the machine, as described above, to prevent conflicting changes from
|
---|
2412 | other processes; this is why opening another session will fail while the
|
---|
2413 | VM is running.)</para>
|
---|
2414 |
|
---|
2415 | <para>Starting a machine looks something like this:
|
---|
2416 | <screen>IWebsessionManager mgr ...;
|
---|
2417 | IVirtualBox vbox = mgr.logon(user, pass);
|
---|
2418 | ...
|
---|
2419 | IMachine machine = ...; // read-only machine
|
---|
2420 | ISession session = mgr.getSessionObject();
|
---|
2421 | IProgress prog = machine.launchVMProcess(session,
|
---|
2422 | "gui", // session type
|
---|
2423 | ""); // possibly environment setting
|
---|
2424 | prog.waitForCompletion(10000); // give the process 10 secs
|
---|
2425 | if (prog.getResultCode() != 0) // check success
|
---|
2426 | System.out.println("Cannot launch VM!")</screen></para>
|
---|
2427 |
|
---|
2428 | <para>The caller's session object can then be used as a sort of remote
|
---|
2429 | control to the VM process that was launched. It contains a "console"
|
---|
2430 | object (see <link linkend="ISession__console">ISession::console</link>)
|
---|
2431 | with which the VM can be paused,
|
---|
2432 | stopped, snapshotted or other things.</para>
|
---|
2433 | </sect1>
|
---|
2434 |
|
---|
2435 | <sect1 id="events">
|
---|
2436 | <title>VirtualBox events</title>
|
---|
2437 |
|
---|
2438 | <para>In VirtualBox, "events" provide a uniform mechanism to register
|
---|
2439 | for and consume specific events. A VirtualBox client can register an
|
---|
2440 | "event listener" (represented by the
|
---|
2441 | <link linkend="IEventListener">IEventListener</link> interface), which
|
---|
2442 | will then get notified by the server when an event (represented by the
|
---|
2443 | <link linkend="IEvent">IEvent</link> interface) happens.</para>
|
---|
2444 |
|
---|
2445 | <para>The IEvent interface is an abstract parent interface for all
|
---|
2446 | events that can occur in VirtualBox. The actual events that the server
|
---|
2447 | sends out belong to one of the specific subclasses, for example
|
---|
2448 | <link linkend="IMachineStateChangedEvent">IMachineStateChangedEvent</link>
|
---|
2449 | or
|
---|
2450 | <link linkend="IMediumChangedEvent">IMediumChangedEvent</link>.</para>
|
---|
2451 |
|
---|
2452 | <para>As an example, the VirtualBox GUI waits for machine events so it can
|
---|
2453 | update its display when the machine state changes or machine settings are
|
---|
2454 | modified, even if this happens in another client. This is how the GUI can
|
---|
2455 | automatically refresh its display even if you manipulate a machine from
|
---|
2456 | a different client such as VBoxManage.</para>
|
---|
2457 |
|
---|
2458 | <para>To register an event listener to listen for events, you would use code
|
---|
2459 | similar to the following:<screen>EventSource es = console.getEventSource();
|
---|
2460 | IEventListener listener = es.createListener();
|
---|
2461 | VBoxEventType aTypes[] = (VBoxEventType.OnMachineStateChanged);
|
---|
2462 | // list of event types to listen for
|
---|
2463 | es.registerListener(listener, aTypes, false /* active */);
|
---|
2464 | // register passive listener
|
---|
2465 | IEvent ev = es.getEvent(listener, 1000);
|
---|
2466 | // wait up to one second for event to happen
|
---|
2467 | if (ev != null)
|
---|
2468 | {
|
---|
2469 | // downcast to specific event interface (in this case we have only registered
|
---|
2470 | // for one type, otherwise IEvent::type would tell us)
|
---|
2471 | IMachineStateChangedEvent mcse = IMachineStateChangedEvent.queryInterface(ev);
|
---|
2472 | ... // inspect and do something
|
---|
2473 | es.eventProcessed(listener, ev);
|
---|
2474 | }
|
---|
2475 | ...
|
---|
2476 | es.unregisterListener(listener); </screen></para>
|
---|
2477 |
|
---|
2478 | <para>A graphical user interface application would most likely want to start
|
---|
2479 | its own thread to wait for events and then process these in a loop.</para>
|
---|
2480 |
|
---|
2481 | <para>The events mechanism was introduced with VirtualBox 3.3 and
|
---|
2482 | replaces various callback interfaces which were called for each event in
|
---|
2483 | the interface. The callback mechanism was not compatible with scripting
|
---|
2484 | languages, local Java bindings, and remote web services as they do not
|
---|
2485 | support callbacks. The new mechanism with events and event listeners
|
---|
2486 | works with all of these.</para>
|
---|
2487 |
|
---|
2488 | <para>To simplify development of applications using events, the concept of
|
---|
2489 | an event aggregator was introduced. Essentially it's a mechanism to
|
---|
2490 | aggregate multiple event sources into one single event source, and then work
|
---|
2491 | with this single aggregated event source instead of the original sources. As
|
---|
2492 | an example, one can try out the VirtualBox Python shell's
|
---|
2493 | <computeroutput>recordDemo</computeroutput> option which records mouse and
|
---|
2494 | keyboard events using an event aggregator and displays them as separate event
|
---|
2495 | sources. The VirtualBox Python shell (vboxshell.py) is shipped with the SDK.
|
---|
2496 | The <computeroutput>recordDemo</computeroutput> code is essentially:<screen>
|
---|
2497 | listener = console.eventSource.createListener()
|
---|
2498 | agg = console.eventSource.createAggregator([console.keyboard.eventSource, console.mouse.eventSource])
|
---|
2499 | agg.registerListener(listener, [ctx['global'].constants.VBoxEventType_Any], False)
|
---|
2500 | registered = True
|
---|
2501 | end = time.time() + dur
|
---|
2502 | while time.time() < end:
|
---|
2503 | ev = agg.getEvent(listener, 1000)
|
---|
2504 | processEent(ev)
|
---|
2505 | agg.unregisterListener(listener)</screen> Without using aggregators
|
---|
2506 | consumers would have to either poll on both sources or start multiple
|
---|
2507 | threads to block on those sources.</para>
|
---|
2508 | </sect1>
|
---|
2509 | </chapter>
|
---|
2510 |
|
---|
2511 | <chapter id="vboxshell">
|
---|
2512 | <title>The VirtualBox shell</title>
|
---|
2513 |
|
---|
2514 | <para>VirtualBox comes with an extensible shell which allows you to
|
---|
2515 | control your virtual machines from the command line. It is also a
|
---|
2516 | non-trivial example of how to use the VirtualBox APIs from Python for all
|
---|
2517 | three styles of the API (COM/XPCOM/WS).</para>
|
---|
2518 |
|
---|
2519 | <para>You can easily extend this shell with your own commands. Simply create
|
---|
2520 | a subdirectory named
|
---|
2521 | <computeroutput>.config/VirtualBox/shexts</computeroutput> in your home
|
---|
2522 | directory (<computeroutput>.VirtualBox/shexts</computeroutput>
|
---|
2523 | on Windows systems and
|
---|
2524 | <computeroutput>Library/VirtualBox/shexts</computeroutput> on macOS systems)
|
---|
2525 | and put a Python file implementing your shell extension commands in this
|
---|
2526 | directory. This file must have an array named
|
---|
2527 | <computeroutput>commands</computeroutput> which contains your command
|
---|
2528 | definitions: <screen>
|
---|
2529 | commands = {
|
---|
2530 | 'cmd1': ['Command cmd1 help', cmd1],
|
---|
2531 | 'cmd2': ['Command cmd2 help', cmd2]
|
---|
2532 | }
|
---|
2533 | </screen> For example, to create a command for creating hard drive
|
---|
2534 | images, the following code can be used: <screen>
|
---|
2535 | def createHdd(ctx,args):
|
---|
2536 | # Show some meaningful error message on wrong input
|
---|
2537 | if (len(args) < 3):
|
---|
2538 | print "usage: createHdd sizeM location type"
|
---|
2539 | return 0
|
---|
2540 |
|
---|
2541 | # Get arguments
|
---|
2542 | size = int(args[1])
|
---|
2543 | loc = args[2]
|
---|
2544 | if len(args) > 3:
|
---|
2545 | format = args[3]
|
---|
2546 | else:
|
---|
2547 | # And provide some meaningful defaults
|
---|
2548 | format = "vdi"
|
---|
2549 |
|
---|
2550 | # Call VirtualBox API, using context's fields
|
---|
2551 | hdd = ctx['vb'].createMedium(format, loc, ctx['global'].constants.AccessMode_ReadWrite, \
|
---|
2552 | ctx['global'].constants.DeviceType_HardDisk)
|
---|
2553 | # Access constants using ctx['global'].constants
|
---|
2554 | progress = hdd.createBaseStorage(size, (ctx['global'].constants.MediumVariant_Standard, ))
|
---|
2555 | # use standard progress bar mechanism
|
---|
2556 | ctx['progressBar'](progress)
|
---|
2557 |
|
---|
2558 |
|
---|
2559 | # Report errors
|
---|
2560 | if not hdd.id:
|
---|
2561 | print "cannot create disk (file %s exist?)" %(loc)
|
---|
2562 | return 0
|
---|
2563 |
|
---|
2564 | # Give user some feedback on success too
|
---|
2565 | print "created HDD with id: %s" %(hdd.id)
|
---|
2566 |
|
---|
2567 | # 0 means continue execution, other values mean exit from the interpreter
|
---|
2568 | return 0
|
---|
2569 |
|
---|
2570 | commands = {
|
---|
2571 | 'myCreateHDD': ['Create virtual HDD, createHdd size location type', createHdd]
|
---|
2572 | }
|
---|
2573 | </screen> Just store the above text in a file named
|
---|
2574 | <computeroutput>createHdd</computeroutput> (or any other meaningful name)
|
---|
2575 | in the <computeroutput>shexts</computeroutput> directory located as
|
---|
2576 | described above and then start the VirtualBox shell or just issue the
|
---|
2577 | <computeroutput>reloadExts</computeroutput> command if the shell is
|
---|
2578 | already running. Your new command will now be available.</para>
|
---|
2579 | </chapter>
|
---|
2580 |
|
---|
2581 | <chapter id="vboxarm">
|
---|
2582 | <title>Main API changes to support the ARM64 architecture</title>
|
---|
2583 |
|
---|
2584 | <para>VirtualBox 7.1 introduces support for running virtual machines on
|
---|
2585 | hosts containing an ARM CPU. Since VirtualBox has been designed and
|
---|
2586 | developed for virtualizing x86 hardware since its inception adding
|
---|
2587 | support for ARM CPUs required a variety of changes to the Main API to
|
---|
2588 | accommodate two different CPU architectures.</para>
|
---|
2589 |
|
---|
2590 | <sect1>
|
---|
2591 | <title>Overview of the Changes to the Main API</title>
|
---|
2592 |
|
---|
2593 | <para>In order to support two different types of processor architecture
|
---|
2594 | in the VirtualBox Main API the key abstraction was the addition of a new
|
---|
2595 | interface named <link linkend="IPlatform">IPlatform</link> which contains
|
---|
2596 | the details which relate to the operating environment of a VM. The
|
---|
2597 | <link linkend="IPlatform">IPlatform</link> interface is distinct from the
|
---|
2598 | VM itself (the <link linkend="IMachine">IMachine</link> interface), the VM
|
---|
2599 | management interfaces (<link linkend="IVirtualBox">IVirtualBox</link> and
|
---|
2600 | <link linkend="IConsole">IConsole</link>), as well as the global properties of
|
---|
2601 | the VM (the <link linkend="ISystemProperties">ISystemProperties</link> interface).
|
---|
2602 | The contents of the <link linkend="IPlatform">IPlatform</link> interface can be
|
---|
2603 | broken down into three different categories:</para>
|
---|
2604 | <itemizedlist>
|
---|
2605 | <listitem>
|
---|
2606 | <para>properties relating to the VM which are CPU architecture-neutral (<link linkend="IPlatformProperties">IPlatformProperties</link>)</para>
|
---|
2607 | </listitem>
|
---|
2608 | <listitem>
|
---|
2609 | <para>properties which are CPU architecture-specific (<link linkend="IPlatformX86">IPlatformX86</link> or <link linkend="IPlatformARM">IPlatformARM</link>)</para>
|
---|
2610 | </listitem>
|
---|
2611 | <listitem>
|
---|
2612 | <para>attributes of the VM which are CPU architecture-neutral such as:</para>
|
---|
2613 | <itemizedlist>
|
---|
2614 | <listitem><para>the architecture of the VM (<link linkend="IPlatform__architecture">IPlatform::architecture</link>)</para>
|
---|
2615 | </listitem>
|
---|
2616 | <listitem><para>the type of chipset used by the VM (<link linkend="IPlatform__chipsetType">IPlatform::chipsetType</link>)</para>
|
---|
2617 | </listitem>
|
---|
2618 | <listitem><para>the type of IOMMU used by the VM (<link linkend="IPlatform__iommuType">IPlatform::iommuType</link>).</para>
|
---|
2619 | </listitem>
|
---|
2620 | </itemizedlist>
|
---|
2621 | </listitem>
|
---|
2622 | </itemizedlist>
|
---|
2623 |
|
---|
2624 | <para>The <link linkend="IPlatform">IPlatform</link> interface can be retrieved from
|
---|
2625 | the <link linkend="IMachine">IMachine</link> interface via the new
|
---|
2626 | <link linkend="IMachine__platform">IMachine::platform</link> attribute. The
|
---|
2627 | <link linkend="IPlatform__architecture">IPlatform::architecture</link> attribute
|
---|
2628 | returns the <emphasis>architecture</emphasis> type in a new enumeration named
|
---|
2629 | <link linkend="PlatformArchitecture">PlatformArchitecture</link>. This enumeration value
|
---|
2630 | can be used to determine which CPU-specific properties to query, for example:
|
---|
2631 | <screen>
|
---|
2632 | IPlatform platform;
|
---|
2633 | result = machine.getPlatform(platform);
|
---|
2634 |
|
---|
2635 | PlatformArchitecture_T platformArch;
|
---|
2636 | result = platform.getArchitecture(platformArch);
|
---|
2637 | if (platformArch == x86)
|
---|
2638 | IPlatformX86 platformX86;
|
---|
2639 | result = platform.getX86(platformX86);
|
---|
2640 | else if (platformArch == ARM)
|
---|
2641 | IPlatformARM platformARM;
|
---|
2642 | result = platform.getARM(platformARM);
|
---|
2643 | else
|
---|
2644 | error;
|
---|
2645 | </screen>
|
---|
2646 |
|
---|
2647 | The value of the <link linkend="PlatformArchitecture">PlatformArchitecture</link> enumeration
|
---|
2648 | can also be used when creating a new VM using <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine</link>.
|
---|
2649 | </para>
|
---|
2650 |
|
---|
2651 | <para>The CPU architecture-neutral properties in (<link linkend="IPlatformProperties">IPlatformProperties</link>)
|
---|
2652 | can be found in several places:</para>
|
---|
2653 | <itemizedlist>
|
---|
2654 | <listitem>
|
---|
2655 | <para>They can be retrieved from the <link linkend="IPlatform__properties">IPlatform::properties</link>
|
---|
2656 | attribute.</para>
|
---|
2657 | </listitem>
|
---|
2658 | <listitem>
|
---|
2659 | <para>They can be retrieved from the <link linkend="ISystemProperties__platform">ISystemProperties::platform</link>
|
---|
2660 | attribute.</para>
|
---|
2661 | </listitem>
|
---|
2662 | <listitem>
|
---|
2663 | <para>They can retrieved from the <link linkend="IVirtualBox">IVirtualBox</link> interface
|
---|
2664 | using the new <link linkend="IVirtualBox__getPlatformProperties">IVirtualBox::getPlatformProperties</link> method.
|
---|
2665 | </para>
|
---|
2666 | </listitem>
|
---|
2667 | </itemizedlist>
|
---|
2668 |
|
---|
2669 | <para>The attributes and methods contained in <link linkend="IPlatformProperties">IPlatformProperties</link>
|
---|
2670 | were moved from the <link linkend="ISystemProperties">ISystemProperties</link> interface as they
|
---|
2671 | can vary based on the platform of the VM:</para>
|
---|
2672 |
|
---|
2673 | <table>
|
---|
2674 | <title>IPlatformProperties Attributes</title>
|
---|
2675 | <tgroup cols="2" style="verywide">
|
---|
2676 | <tbody>
|
---|
2677 | <row>
|
---|
2678 | <entry><emphasis role="bold">Original Attribute</emphasis></entry>
|
---|
2679 | <entry><emphasis role="bold">New Attribute</emphasis></entry>
|
---|
2680 | </row>
|
---|
2681 |
|
---|
2682 | <row>
|
---|
2683 | <entry>IPlatformProperties::rawModeSupported</entry>
|
---|
2684 | <entry><link linkend="IPlatformProperties__rawModeSupported">IPlatformProperties::rawModeSupported</link></entry>
|
---|
2685 | </row>
|
---|
2686 |
|
---|
2687 | <row>
|
---|
2688 | <entry>IPlatformProperties::exclusiveHwVirt</entry>
|
---|
2689 | <entry><link linkend="IPlatformProperties__exclusiveHwVirt">IPlatformProperties::exclusiveHwVirt</link></entry>
|
---|
2690 | </row>
|
---|
2691 |
|
---|
2692 | <row>
|
---|
2693 | <entry>IPlatformProperties::serialPortCount</entry>
|
---|
2694 | <entry><link linkend="IPlatformProperties__serialPortCount">IPlatformProperties::serialPortCount</link></entry>
|
---|
2695 | </row>
|
---|
2696 |
|
---|
2697 | <row>
|
---|
2698 | <entry>IPlatformProperties::parallelPortCount</entry>
|
---|
2699 | <entry><link linkend="IPlatformProperties__parallelPortCount">IPlatformProperties::parallelPortCount</link></entry>
|
---|
2700 | </row>
|
---|
2701 |
|
---|
2702 | <row>
|
---|
2703 | <entry>IPlatformProperties::maxBootPosition</entry>
|
---|
2704 | <entry><link linkend="IPlatformProperties__maxBootPosition">IPlatformProperties::maxBootPosition</link></entry>
|
---|
2705 | </row>
|
---|
2706 |
|
---|
2707 | <row>
|
---|
2708 | <entry>IPlatformProperties::supportedParavirtProviders[]</entry>
|
---|
2709 | <entry><link linkend="IPlatformProperties__supportedParavirtProviders">IPlatformProperties::supportedParavirtProviders[]</link></entry>
|
---|
2710 | </row>
|
---|
2711 |
|
---|
2712 | <row>
|
---|
2713 | <entry>IPlatformProperties::supportedFirmwareTypes[]</entry>
|
---|
2714 | <entry><link linkend="IPlatformProperties__supportedFirmwareTypes">IPlatformProperties::supportedFirmwareTypes[]</link></entry>
|
---|
2715 | </row>
|
---|
2716 |
|
---|
2717 | <row>
|
---|
2718 | <entry>IPlatformProperties::supportedGuestOSTypes[]</entry>
|
---|
2719 | <entry><link linkend="IPlatformProperties__supportedGuestOSTypes">IPlatformProperties::supportedGuestOSTypes[]</link></entry>
|
---|
2720 | </row>
|
---|
2721 |
|
---|
2722 | <row>
|
---|
2723 | <entry>IPlatformProperties::getSupportedGfxControllerTypes[]</entry>
|
---|
2724 | <entry><link linkend="IPlatformProperties__supportedGfxControllerTypes">IPlatformProperties::getSupportedGfxControllerTypes[]</link></entry>
|
---|
2725 | </row>
|
---|
2726 |
|
---|
2727 | <row>
|
---|
2728 | <entry>IPlatformProperties::supportedNetAdpPromiscModePols[]</entry>
|
---|
2729 | <entry><link linkend="IPlatformProperties__supportedNetAdpPromiscModePols">IPlatformProperties::supportedNetAdpPromiscModePols[]</link></entry>
|
---|
2730 | </row>
|
---|
2731 |
|
---|
2732 | <row>
|
---|
2733 | <entry>IPlatformProperties::supportedNetworkAdapterTypes[]</entry>
|
---|
2734 | <entry><link linkend="IPlatformProperties__supportedNetworkAdapterTypes">IPlatformProperties::supportedNetworkAdapterTypes[]</link></entry>
|
---|
2735 | </row>
|
---|
2736 |
|
---|
2737 | <row>
|
---|
2738 | <entry>IPlatformProperties::supportedUartTypes[]</entry>
|
---|
2739 | <entry><link linkend="IPlatformProperties__supportedUartTypes">IPlatformProperties::supportedUartTypes[]</link></entry>
|
---|
2740 | </row>
|
---|
2741 |
|
---|
2742 | <row>
|
---|
2743 | <entry>IPlatformProperties::supportedUSBControllerTypes[]</entry>
|
---|
2744 | <entry><link linkend="IPlatformProperties__supportedUSBControllerTypes">IPlatformProperties::supportedUSBControllerTypes[]</link></entry>
|
---|
2745 | </row>
|
---|
2746 |
|
---|
2747 | <row>
|
---|
2748 | <entry>IPlatformProperties::supportedAudioControllerTypes[]</entry>
|
---|
2749 | <entry><link linkend="IPlatformProperties__supportedAudioControllerTypes">IPlatformProperties::supportedAudioControllerTypes[]</link></entry>
|
---|
2750 | </row>
|
---|
2751 |
|
---|
2752 | <row>
|
---|
2753 | <entry>IPlatformProperties::supportedBootDevices[]</entry>
|
---|
2754 | <entry><link linkend="IPlatformProperties__supportedBootDevices">IPlatformProperties::supportedBootDevices[]</link></entry>
|
---|
2755 | </row>
|
---|
2756 |
|
---|
2757 | <row>
|
---|
2758 | <entry>IPlatformProperties::supportedStorageBuses[]</entry>
|
---|
2759 | <entry><link linkend="IPlatformProperties__supportedStorageBuses">IPlatformProperties::supportedStorageBuses[]</link></entry>
|
---|
2760 | </row>
|
---|
2761 |
|
---|
2762 | <row>
|
---|
2763 | <entry>IPlatformProperties::supportedStorageControllerTypes[]</entry>
|
---|
2764 | <entry><link linkend="IPlatformProperties__supportedStorageControllerTypes">IPlatformProperties::supportedStorageControllerTypes[]</link></entry>
|
---|
2765 | </row>
|
---|
2766 |
|
---|
2767 | <row>
|
---|
2768 | <entry>IPlatformProperties::supportedChipsetTypes[]</entry>
|
---|
2769 | <entry><link linkend="IPlatformProperties__supportedChipsetTypes">IPlatformProperties::supportedChipsetTypes[]</link></entry>
|
---|
2770 | </row>
|
---|
2771 |
|
---|
2772 | <row>
|
---|
2773 | <entry>IPlatformProperties::supportedIommuTypes[]</entry>
|
---|
2774 | <entry><link linkend="IPlatformProperties__supportedIommuTypes">IPlatformProperties::supportedIommuTypes[]</link></entry>
|
---|
2775 | </row>
|
---|
2776 |
|
---|
2777 | <row>
|
---|
2778 | <entry>IPlatformProperties::supportedTpmTypes[]</entry>
|
---|
2779 | <entry><link linkend="IPlatformProperties__supportedTpmTypes">IPlatformProperties::supportedTpmTypes[]</link></entry>
|
---|
2780 | </row>
|
---|
2781 |
|
---|
2782 | </tbody>
|
---|
2783 | </tgroup>
|
---|
2784 | </table>
|
---|
2785 |
|
---|
2786 | <table>
|
---|
2787 | <title>IPlatformProperties Attributes</title>
|
---|
2788 | <tgroup cols="2" style="verywide">
|
---|
2789 | <tbody>
|
---|
2790 | <row>
|
---|
2791 | <entry><emphasis role="bold">Original Method</emphasis></entry>
|
---|
2792 | <entry><emphasis role="bold">New Method</emphasis></entry>
|
---|
2793 | </row>
|
---|
2794 |
|
---|
2795 | <row>
|
---|
2796 | <entry>IPlatformProperties::getDeviceTypesForStorageBus</entry>
|
---|
2797 | <entry><link linkend="IPlatformProperties__getDeviceTypesForStorageBus">IPlatformProperties::getDeviceTypesForStorageBus</link></entry>
|
---|
2798 | </row>
|
---|
2799 |
|
---|
2800 | <row>
|
---|
2801 | <entry>IPlatformProperties::getMaxDevicesPerPortForStorageBus</entry>
|
---|
2802 | <entry><link linkend="IPlatformProperties__getMaxDevicesPerPortForStorageBus">IPlatformProperties::getMaxDevicesPerPortForStorageBus</link></entry>
|
---|
2803 | </row>
|
---|
2804 |
|
---|
2805 | <row>
|
---|
2806 | <entry>IPlatformProperties::getMaxInstancesOfStorageBus</entry>
|
---|
2807 | <entry><link linkend="IPlatformProperties__getMaxInstancesOfStorageBus">IPlatformProperties::getMaxInstancesOfStorageBus</link></entry>
|
---|
2808 | </row>
|
---|
2809 |
|
---|
2810 | <row>
|
---|
2811 | <entry>IPlatformProperties::getMaxInstancesOfUSBControllerType</entry>
|
---|
2812 | <entry><link linkend="IPlatformProperties__getMaxInstancesOfUSBControllerType">IPlatformProperties::getMaxInstancesOfUSBControllerType</link></entry>
|
---|
2813 | </row>
|
---|
2814 |
|
---|
2815 | <row>
|
---|
2816 | <entry>IPlatformProperties::getMaxNetworkAdapters</entry>
|
---|
2817 | <entry><link linkend="IPlatformProperties__getMaxNetworkAdapters">IPlatformProperties::getMaxNetworkAdapters</link></entry>
|
---|
2818 | </row>
|
---|
2819 |
|
---|
2820 | <row>
|
---|
2821 | <entry>IPlatformProperties::getMaxNetworkAdaptersOfType</entry>
|
---|
2822 | <entry><link linkend="IPlatformProperties__getMaxNetworkAdaptersOfType">IPlatformProperties::getMaxNetworkAdaptersOfType</link></entry>
|
---|
2823 | </row>
|
---|
2824 |
|
---|
2825 | <row>
|
---|
2826 | <entry>IPlatformProperties::getMaxPortCountForStorageBus</entry>
|
---|
2827 | <entry><link linkend="IPlatformProperties__getMaxPortCountForStorageBus">IPlatformProperties::getMaxPortCountForStorageBus</link></entry>
|
---|
2828 | </row>
|
---|
2829 |
|
---|
2830 | <row>
|
---|
2831 | <entry>IPlatformProperties::getMinPortCountForStorageBus</entry>
|
---|
2832 | <entry><link linkend="IPlatformProperties__getMinPortCountForStorageBus">IPlatformProperties::getMinPortCountForStorageBus</link></entry>
|
---|
2833 | </row>
|
---|
2834 |
|
---|
2835 | <row>
|
---|
2836 | <entry>IPlatformProperties::getStorageBusForControllerType</entry>
|
---|
2837 | <entry><link linkend="IPlatformProperties__getStorageBusForControllerType">IPlatformProperties::getStorageBusForControllerType</link></entry>
|
---|
2838 | </row>
|
---|
2839 |
|
---|
2840 | <row>
|
---|
2841 | <entry>IPlatformProperties::getStorageControllerHotplugCapable</entry>
|
---|
2842 | <entry><link linkend="IPlatformProperties__getStorageControllerHotplugCapable">IPlatformProperties::getStorageControllerHotplugCapable</link></entry>
|
---|
2843 | </row>
|
---|
2844 |
|
---|
2845 | <row>
|
---|
2846 | <entry>IPlatformProperties::getStorageControllerTypesForBus</entry>
|
---|
2847 | <entry><link linkend="IPlatformProperties__getStorageControllerTypesForBus">IPlatformProperties::getStorageControllerTypesForBus</link></entry>
|
---|
2848 | </row>
|
---|
2849 |
|
---|
2850 | </tbody>
|
---|
2851 | </tgroup>
|
---|
2852 | </table>
|
---|
2853 |
|
---|
2854 | <para>The single attribute and all of the properties contained in the new
|
---|
2855 | <link linkend="IPlatformX86">IPlatformX86</link> interface were moved from the
|
---|
2856 | <link linkend="IMachine">IMachine</link> interface as they are specific to the x86
|
---|
2857 | CPU architecture:</para>
|
---|
2858 |
|
---|
2859 | <table>
|
---|
2860 | <title>IPlatformX86 Attribute</title>
|
---|
2861 | <tgroup cols="2">
|
---|
2862 | <tbody>
|
---|
2863 | <row>
|
---|
2864 | <entry><emphasis role="bold">Original Attribute</emphasis></entry>
|
---|
2865 | <entry><emphasis role="bold">New Attribute</emphasis></entry>
|
---|
2866 | </row>
|
---|
2867 |
|
---|
2868 | <row>
|
---|
2869 | <entry>IMachine::HPETEnabled</entry>
|
---|
2870 | <entry><link linkend="IPlatformX86__HPETEnabled">IPlatformX86::HPETEnabled</link></entry>
|
---|
2871 | </row>
|
---|
2872 | </tbody>
|
---|
2873 | </tgroup>
|
---|
2874 | </table>
|
---|
2875 |
|
---|
2876 | <table>
|
---|
2877 | <title>IPlatformX86 Methods</title>
|
---|
2878 | <tgroup cols="2">
|
---|
2879 | <tbody>
|
---|
2880 | <row>
|
---|
2881 | <entry><emphasis role="bold">Original Method</emphasis></entry>
|
---|
2882 | <entry><emphasis role="bold">New Method</emphasis></entry>
|
---|
2883 | </row>
|
---|
2884 |
|
---|
2885 | <row>
|
---|
2886 | <entry>IMachine::getCPUIDLeaf</entry>
|
---|
2887 | <entry><link linkend="IPlatformX86__getCPUIDLeaf">IPlatformX86::getCPUIDLeaf</link></entry>
|
---|
2888 | </row>
|
---|
2889 |
|
---|
2890 | <row>
|
---|
2891 | <entry>IMachine::getCPUIDLeafByOrdinal</entry>
|
---|
2892 | <entry><link linkend="IPlatformX86__getCPUIDLeafByOrdinal">IPlatformX86::getCPUIDLeafByOrdinal</link></entry>
|
---|
2893 | </row>
|
---|
2894 |
|
---|
2895 | <row>
|
---|
2896 | <entry>IMachine::getCPUProperty</entry>
|
---|
2897 | <entry><link linkend="IPlatformX86__getCPUProperty">IPlatformX86::getCPUProperty</link></entry>
|
---|
2898 | </row>
|
---|
2899 |
|
---|
2900 | <row>
|
---|
2901 | <entry>IMachine::getHWVirtExProperty</entry>
|
---|
2902 | <entry><link linkend="IPlatformX86__getHWVirtExProperty">IPlatformX86::getHWVirtExProperty</link></entry>
|
---|
2903 | </row>
|
---|
2904 |
|
---|
2905 | <row>
|
---|
2906 | <entry>IMachine::removeAllCPUIDLeaves</entry>
|
---|
2907 | <entry><link linkend="IPlatformX86__removeAllCPUIDLeaves">IPlatformX86::removeAllCPUIDLeaves</link></entry>
|
---|
2908 | </row>
|
---|
2909 |
|
---|
2910 | <row>
|
---|
2911 | <entry>IMachine::removeCPUIDLeaf</entry>
|
---|
2912 | <entry><link linkend="IPlatformX86__removeCPUIDLeaf">IPlatformX86::removeCPUIDLeaf</link></entry>
|
---|
2913 | </row>
|
---|
2914 |
|
---|
2915 | <row>
|
---|
2916 | <entry>IMachine::setCPUIDLeaf</entry>
|
---|
2917 | <entry><link linkend="IPlatformX86__setCPUIDLeaf">IPlatformX86::setCPUIDLeaf</link></entry>
|
---|
2918 | </row>
|
---|
2919 |
|
---|
2920 | <row>
|
---|
2921 | <entry>IMachine::setCPUProperty</entry>
|
---|
2922 | <entry><link linkend="IPlatformX86__setCPUProperty">IPlatformX86::setCPUProperty</link></entry>
|
---|
2923 | </row>
|
---|
2924 |
|
---|
2925 | <row>
|
---|
2926 | <entry>IMachine::setHWVirtExProperty</entry>
|
---|
2927 | <entry><link linkend="IPlatformX86__setHWVirtExProperty">IPlatformX86::setHWVirtExProperty</link></entry>
|
---|
2928 | </row>
|
---|
2929 |
|
---|
2930 | </tbody>
|
---|
2931 | </tgroup>
|
---|
2932 | </table>
|
---|
2933 |
|
---|
2934 | <para>An itemized breakdown of the changes made to the Main API for ARM64 support is described below.</para>
|
---|
2935 |
|
---|
2936 | <sect2>
|
---|
2937 | <title>Changes to Classes (Interfaces)</title>
|
---|
2938 |
|
---|
2939 | <sect3>
|
---|
2940 | <title>New Classes (Interfaces) Added</title>
|
---|
2941 |
|
---|
2942 | <itemizedlist>
|
---|
2943 | <listitem>
|
---|
2944 | <para><link linkend="IPlatform">IPlatform</link></para>
|
---|
2945 | <para>An umbrella-like interface containing a collection of properties and attributes
|
---|
2946 | of the software environment of the VM.</para>
|
---|
2947 | </listitem>
|
---|
2948 | <listitem>
|
---|
2949 | <para><link linkend="IPlatformX86">IPlatformX86</link></para>
|
---|
2950 | <para>An interface containing the x86-specific properties of the software
|
---|
2951 | environment of the VM.</para>
|
---|
2952 | </listitem>
|
---|
2953 | <listitem>
|
---|
2954 | <para><link linkend="IPlatformARM">IPlatformARM</link></para>
|
---|
2955 | <para>An interface containing the ARM-specific properties of the software
|
---|
2956 | environment of the VM.</para>
|
---|
2957 | </listitem>
|
---|
2958 | <listitem>
|
---|
2959 | <para><link linkend="IPlatformProperties">IPlatformProperties</link></para>
|
---|
2960 | <para>An interface containing the properties specific to the platform of the VM.</para>
|
---|
2961 | </listitem>
|
---|
2962 | <listitem>
|
---|
2963 | <para><link linkend="IHostX86">IHostX86</link></para>
|
---|
2964 | <para>An interface which provides further classification of the x86-specific
|
---|
2965 | properties of the physical host machine.</para>
|
---|
2966 | </listitem>
|
---|
2967 | </itemizedlist>
|
---|
2968 | </sect3>
|
---|
2969 |
|
---|
2970 | <sect3>
|
---|
2971 | <title>Classes (Interfaces) Renamed</title>
|
---|
2972 |
|
---|
2973 | <table>
|
---|
2974 | <title>Classes (Interfaces) Renamed</title>
|
---|
2975 | <tgroup cols="2" style="verywide">
|
---|
2976 | <tbody>
|
---|
2977 | <row>
|
---|
2978 | <entry><emphasis role="bold">Original Class Name</emphasis></entry>
|
---|
2979 | <entry><emphasis role="bold">New Class Name</emphasis></entry>
|
---|
2980 | </row>
|
---|
2981 | <row>
|
---|
2982 | <entry>IBIOSSettings</entry>
|
---|
2983 | <entry><link linkend="IFirmwareSettings">IFirmwareSettings</link></entry>
|
---|
2984 | </row>
|
---|
2985 | </tbody>
|
---|
2986 | </tgroup>
|
---|
2987 | </table>
|
---|
2988 | <para>The IBIOSSettings interface has been renamed to the more platform-neutral IFirmwareSettings.</para>
|
---|
2989 |
|
---|
2990 | </sect3>
|
---|
2991 |
|
---|
2992 | <sect3>
|
---|
2993 | <title>New Methods Added to Classes (Interfaces)</title>
|
---|
2994 | <itemizedlist>
|
---|
2995 | <listitem>
|
---|
2996 | <para><link
|
---|
2997 | linkend="IPlatformProperties">IPlatformProperties</link> <link linkend="IVirtualBox__getPlatformProperties">IVirtualBox::getPlatformProperties</link></para>
|
---|
2998 | <para>The new IVirtualBox::getPlatformProperties method returns
|
---|
2999 | an IPlatformProperties object which contains the platform-specific
|
---|
3000 | properties of a VM as described above.</para>
|
---|
3001 | </listitem>
|
---|
3002 | <listitem>
|
---|
3003 | <para><link linkend="IGraphicsAdapter__isFeatureEnabled">IGraphicsAdapter::isFeatureEnabled</link></para>
|
---|
3004 | <para>The new IGraphicsAdapter::isFeatureEnabled method returns
|
---|
3005 | whether a graphics feature is enabled for a specific adapter or not.</para>
|
---|
3006 | </listitem>
|
---|
3007 | <listitem>
|
---|
3008 | <para><link linkend="IGraphicsAdapter__setFeature">IGraphicsAdapter::setFeature</link></para>
|
---|
3009 | <para>The new IGraphicsAdapter::setFeature enables or disables a graphics feature
|
---|
3010 | for a specific adapter.</para>
|
---|
3011 | </listitem>
|
---|
3012 | </itemizedlist>
|
---|
3013 | </sect3>
|
---|
3014 |
|
---|
3015 | <sect3>
|
---|
3016 | <title>New Attributes Added to Classes (Interfaces)</title>
|
---|
3017 | <itemizedlist>
|
---|
3018 | <listitem>
|
---|
3019 | <para><link linkend="IPlatformProperties">IPlatformProperties</link><link linkend="ISystemProperties__platform">
|
---|
3020 | ISystemProperties::platform</link></para>
|
---|
3021 | <para>The ISystemProperties interface gets a new <emphasis>platform</emphasis>
|
---|
3022 | attribute which returns an IPlatformProperties object which contains the
|
---|
3023 | platform-specific properties of a VM as described above.</para>
|
---|
3024 | </listitem>
|
---|
3025 | <listitem>
|
---|
3026 | <para><link linkend="FirmwareType">FirmwareType</link> <link linkend="IFirmwareSettings__firmwareType">IFirmwareSettings::firmwareType</link></para>
|
---|
3027 | <para>The new IFirmwareSettings interface (renamed from IBIOSSettings) gets a new
|
---|
3028 | <emphasis>firmwareType</emphasis> attribute which returns a FirmwareType enumeration which
|
---|
3029 | contains the VM's firmware type.</para>
|
---|
3030 | </listitem>
|
---|
3031 | <listitem>
|
---|
3032 | <para><link linkend="PlatformArchitecture">PlatformArchitecture</link> <link linkend="IHost__architecture">IHost::architecture</link></para>
|
---|
3033 | <para>The IHost interface gets a new <emphasis>architecture</emphasis>
|
---|
3034 | attribute which returns a PlatformArchitecture enumeration which contains the
|
---|
3035 | platform's architecture.</para>
|
---|
3036 | </listitem>
|
---|
3037 | <listitem>
|
---|
3038 | <para><link linkend="IHostX86">IHostX86</link> <link linkend="IHost__x86">IHost::x86</link></para>
|
---|
3039 | <para>The IHost interface gets a new <emphasis>x86</emphasis>
|
---|
3040 | attribute which returns an IHostX86 object which contains the
|
---|
3041 | x86-specific properties of the physical host machine.</para>
|
---|
3042 | </listitem>
|
---|
3043 | <listitem>
|
---|
3044 | <para><link linkend="IPlatform">IPlatform</link> <link linkend="IMachine__platform">IMachine::platform</link></para>
|
---|
3045 | <para>The IMachine interface gets a new <emphasis>platform</emphasis>
|
---|
3046 | attribute which returns an IPlatform object which contains the
|
---|
3047 | properties related to the platform of the VM.</para>
|
---|
3048 | </listitem>
|
---|
3049 | <listitem>
|
---|
3050 | <para><link linkend="IFirmwareSettings">IFirmwareSettings</link> <link linkend="IMachine__firmwareSettings">IMachine::firmwareSettings</link></para>
|
---|
3051 | <para>The IMachine interface gets a new <emphasis>firmwareSettings</emphasis>
|
---|
3052 | attribute which returns an IFirmWareSettings object which contains the
|
---|
3053 | properties related to the platform of the VM.</para>
|
---|
3054 | </listitem>
|
---|
3055 | </itemizedlist>
|
---|
3056 | </sect3>
|
---|
3057 |
|
---|
3058 | <sect3>
|
---|
3059 | <title>Class (Interface) Attribute Changes</title>
|
---|
3060 |
|
---|
3061 | <table>
|
---|
3062 | <title>Classes Renamed</title>
|
---|
3063 | <tgroup cols="2" style="verywide">
|
---|
3064 | <tbody>
|
---|
3065 | <row>
|
---|
3066 | <entry><emphasis role="bold">Original Class Name</emphasis></entry>
|
---|
3067 | <entry><emphasis role="bold">New Class Name</emphasis></entry>
|
---|
3068 | </row>
|
---|
3069 | <row>
|
---|
3070 | <entry>BIOSBootMenuMode IBIOSSettings::bootMenuMode</entry>
|
---|
3071 | <entry><link linkend="FirmwareBootMenuMode">FirmwareBootMenuMode</link><link linkend="IFirmwareSettings__bootMenuMode"> IFirmwareSettings::bootMenuMode</link></entry>
|
---|
3072 | </row>
|
---|
3073 | <row>
|
---|
3074 | <entry>IGraphicsAdapter::accelerate3DEnabled</entry>
|
---|
3075 | <entry><link linkend="IGraphicsAdapter__setFeature"> IGraphicsAdapter::setFeature</link> and
|
---|
3076 | <link linkend="IGraphicsAdapter__isFeatureEnabled"> IGraphicsAdapter::isFeatureEnabled</link></entry>
|
---|
3077 | </row>
|
---|
3078 | <row>
|
---|
3079 | <entry>IGraphicsAdapter::accelerate2DVideoEnabled</entry>
|
---|
3080 | <entry><link linkend="IGraphicsAdapter__setFeature"> IGraphicsAdapter::setFeature</link> and
|
---|
3081 | <link linkend="IGraphicsAdapter__isFeatureEnabled"> IGraphicsAdapter::isFeatureEnabled</link></entry>
|
---|
3082 | </row>
|
---|
3083 | </tbody>
|
---|
3084 | </tgroup>
|
---|
3085 | </table>
|
---|
3086 |
|
---|
3087 | <para>The IBIOSSettings::bootMenuMode attribute has been moved to the new
|
---|
3088 | IFirmwareSettings interface and now returns the firmware boot menu mode in
|
---|
3089 | the new <link linkend="FirmwareBootMenuMode">FirmwareBootMenuMode</link> enumeration.</para>
|
---|
3090 |
|
---|
3091 | <table>
|
---|
3092 | <title>Classes Renamed</title>
|
---|
3093 | <tgroup cols="2" style="verywide">
|
---|
3094 | <tbody>
|
---|
3095 | <row>
|
---|
3096 | <entry><emphasis role="bold">Original Class Name</emphasis></entry>
|
---|
3097 | <entry><emphasis role="bold">New Class Name</emphasis></entry>
|
---|
3098 | </row>
|
---|
3099 | <row>
|
---|
3100 | <entry>unsigned long ISerialPort::IOBase</entry>
|
---|
3101 | <entry>unsigned long <link linkend="ISerialPort__IOAddress">ISerialPort::IOAddress</link></entry>
|
---|
3102 | </row>
|
---|
3103 | </tbody>
|
---|
3104 | </tgroup>
|
---|
3105 | </table>
|
---|
3106 |
|
---|
3107 | <para>The ISerialPort::IOBase attribute has been renamed to ISerialPort::IOAddress.</para>
|
---|
3108 |
|
---|
3109 | </sect3>
|
---|
3110 |
|
---|
3111 | </sect2>
|
---|
3112 |
|
---|
3113 | <sect2>
|
---|
3114 | <title>Changes to Enumerations</title>
|
---|
3115 |
|
---|
3116 | <sect3>
|
---|
3117 | <title>New Enumerations Added</title>
|
---|
3118 | <itemizedlist>
|
---|
3119 | <listitem>
|
---|
3120 | <para><link linkend="PlatformArchitecture">PlatformArchitecture</link></para>
|
---|
3121 | <para>The new PlatformArchitecture enumeration contains the CPU
|
---|
3122 | architecture type of the VM.</para>
|
---|
3123 | </listitem>
|
---|
3124 | <listitem>
|
---|
3125 | <para><link linkend="GraphicsFeature">GraphicsFeature</link></para>
|
---|
3126 | <para>The new GraphicsFeature enumeration contains graphics features to be
|
---|
3127 | used with the host and / or virtual graphics controller.</para>
|
---|
3128 | </listitem>
|
---|
3129 | </itemizedlist>
|
---|
3130 | </sect3>
|
---|
3131 |
|
---|
3132 | <sect3>
|
---|
3133 | <title>New Enumerations Values</title>
|
---|
3134 | <itemizedlist>
|
---|
3135 | <listitem>
|
---|
3136 | <para><link linkend="CPUArchitecture">CPUArchitecture</link>
|
---|
3137 | <itemizedlist>
|
---|
3138 | <listitem><para><link linkend="CPUArchitecture__ARMv8_32">ARMv8_32</link></para></listitem>
|
---|
3139 | <listitem><para><link linkend="CPUArchitecture__ARMv8_64">ARMv8_64</link></para></listitem>
|
---|
3140 | </itemizedlist>
|
---|
3141 | </para>
|
---|
3142 | <para>The CPUArchitecture enumeration gets two new additions corresponding
|
---|
3143 | to 32-bit and 64-bit ARMv8 CPUs respectively.</para>
|
---|
3144 | </listitem>
|
---|
3145 | <listitem>
|
---|
3146 | <para><link linkend="AudioControllerType">AudioControllerType</link>
|
---|
3147 | <itemizedlist>
|
---|
3148 | <listitem><para><link linkend="AudioControllerType__VirtioSound">VirtioSound</link></para></listitem>
|
---|
3149 | </itemizedlist>
|
---|
3150 | </para>
|
---|
3151 | <para>The AudioControllerType enumeration gets a new value named <emphasis>VirtioSound</emphasis>.
|
---|
3152 | </para>
|
---|
3153 | </listitem>
|
---|
3154 | <listitem>
|
---|
3155 | <para><link linkend="ChipsetType">ChipsetType</link>
|
---|
3156 | <itemizedlist>
|
---|
3157 | <listitem><para><link linkend="ChipsetType__ARMv8Virtual">ARMv8Virtual</link></para></listitem>
|
---|
3158 | </itemizedlist>
|
---|
3159 | </para>
|
---|
3160 | <para>The ChipsetType enumeration gets a new value named <emphasis>ARMv8Virtual</emphasis>.
|
---|
3161 | </para>
|
---|
3162 | </listitem>
|
---|
3163 | </itemizedlist>
|
---|
3164 | </sect3>
|
---|
3165 |
|
---|
3166 | <sect3>
|
---|
3167 | <title>Enumerations Renamed</title>
|
---|
3168 |
|
---|
3169 | <table>
|
---|
3170 | <title>Enumerations Renamed</title>
|
---|
3171 | <tgroup cols="2" style="verywide">
|
---|
3172 | <tbody>
|
---|
3173 | <row>
|
---|
3174 | <entry><emphasis role="bold">Original Enumeration Name</emphasis></entry>
|
---|
3175 | <entry><emphasis role="bold">New Enumeration Name</emphasis></entry>
|
---|
3176 | </row>
|
---|
3177 | <row>
|
---|
3178 | <entry>CPUPropertyType</entry>
|
---|
3179 | <entry><link linkend="CPUPropertyTypeX86">CPUPropertyTypeX86</link></entry>
|
---|
3180 | </row>
|
---|
3181 | </tbody>
|
---|
3182 | </tgroup>
|
---|
3183 | </table>
|
---|
3184 |
|
---|
3185 | <para>The CPUPropertyType enumeration has been renamed to CPUPropertyTypeX86.</para>
|
---|
3186 |
|
---|
3187 | <table>
|
---|
3188 | <title>Enumerations Renamed</title>
|
---|
3189 | <tgroup cols="2" style="verywide">
|
---|
3190 | <tbody>
|
---|
3191 | <row>
|
---|
3192 | <entry><emphasis role="bold">Original Enumeration Name</emphasis></entry>
|
---|
3193 | <entry><emphasis role="bold">New Enumeration Name</emphasis></entry>
|
---|
3194 | </row>
|
---|
3195 | <row>
|
---|
3196 | <entry>BIOSBootMenuMode</entry>
|
---|
3197 | <entry><link linkend="FirmwareBootMenuMode">FirmwareBootMenuMode</link></entry>
|
---|
3198 | </row>
|
---|
3199 | </tbody>
|
---|
3200 | </tgroup>
|
---|
3201 | </table>
|
---|
3202 |
|
---|
3203 | <para>The BIOSBootMenuMode enumeration has been renamed to FirmwareBootMenuMode.</para>
|
---|
3204 |
|
---|
3205 | </sect3>
|
---|
3206 | </sect2>
|
---|
3207 | </sect1>
|
---|
3208 |
|
---|
3209 | </chapter>
|
---|
3210 |
|
---|
3211 | <xi:include href="SDKRef_apiref.xml" xpointer="xpointer(/book/*)"
|
---|
3212 | xmlns:xi="http://www.w3.org/2001/XInclude" />
|
---|
3213 |
|
---|
3214 | <chapter id="cloud">
|
---|
3215 | <title>Working with the Cloud</title>
|
---|
3216 |
|
---|
3217 | <para>VirtualBox supports and goes towards the Oracle tendencies like "move to the Cloud".</para>
|
---|
3218 |
|
---|
3219 | <sect1>
|
---|
3220 | <title>OCI features</title>
|
---|
3221 | <para>VirtualBox supports the Oracle Cloud Infrastructure (OCI). See the interfaces:
|
---|
3222 | <link linkend="ICloudClient">ICloudClient</link>,
|
---|
3223 | <link linkend="ICloudProvider">ICloudProvider</link>,
|
---|
3224 | <link linkend="ICloudProfile">ICloudProfile</link>,
|
---|
3225 | <link linkend="ICloudProviderManager">ICloudProviderManager</link>.
|
---|
3226 | </para>
|
---|
3227 | <para>Each cloud interface has own implementation to support OCI features. There are everal functions in the implementation
|
---|
3228 | which should be explained in details because OCI requires some special data or settings.
|
---|
3229 | </para>
|
---|
3230 | <para>
|
---|
3231 | Also see the enumeration <link linkend="VirtualSystemDescriptionType">VirtualSystemDescriptionType</link> for the possible values.
|
---|
3232 | </para>
|
---|
3233 | </sect1>
|
---|
3234 |
|
---|
3235 | <sect1>
|
---|
3236 | <title>Function ICloudClient::exportVM</title>
|
---|
3237 | <para>
|
---|
3238 | See the <link linkend="ICloudClient__exportVM">ICloudClient::exportVM</link>.
|
---|
3239 | The function exports an existing virtual machine into OCI. The final result of this operation is creation a custom image
|
---|
3240 | from the bootable image of VM. The Id of created image is returned in the parameter "description" (which is
|
---|
3241 | <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>) as an entry with the type
|
---|
3242 | VirtualSystemDescriptionType::CloudImageId. The standard steps here are:
|
---|
3243 | <itemizedlist>
|
---|
3244 | <listitem>
|
---|
3245 | <para>Upload VBox image to OCI Object Storage.</para>
|
---|
3246 | </listitem>
|
---|
3247 | <listitem>
|
---|
3248 | <para>Create OCI custom image from the uploaded object.</para>
|
---|
3249 | </listitem>
|
---|
3250 | </itemizedlist>
|
---|
3251 | Parameter "description" must contain all information and settings needed for creation a custom image in OCI.
|
---|
3252 | At least next entries must be presented there before the call:
|
---|
3253 | <itemizedlist>
|
---|
3254 | <listitem>
|
---|
3255 | <para>VirtualSystemDescriptionType::Name - Name of new instance in OCI.</para>
|
---|
3256 | </listitem>
|
---|
3257 | <listitem>
|
---|
3258 | <para>VirtualSystemDescriptionType::HardDiskImage - The local path or id of bootable VM image.</para>
|
---|
3259 | </listitem>
|
---|
3260 | <listitem>
|
---|
3261 | <para>VirtualSystemDescriptionType::CloudBucket - A cloud bucket name where the exported image is uploaded.</para>
|
---|
3262 | </listitem>
|
---|
3263 | <listitem>
|
---|
3264 | <para>VirtualSystemDescriptionType::CloudImageDisplayName - A name which is assigned to a new custom image in the OCI.</para>
|
---|
3265 | </listitem>
|
---|
3266 | <listitem>
|
---|
3267 | <para>VirtualSystemDescriptionType::CloudKeepObject - Whether keep or delete an uploaded object after its usage.</para>
|
---|
3268 | </listitem>
|
---|
3269 | <listitem>
|
---|
3270 | <para>VirtualSystemDescriptionType::CloudLaunchInstance - Whether launch or not a new instance.</para>
|
---|
3271 | </listitem>
|
---|
3272 | </itemizedlist>
|
---|
3273 | </para>
|
---|
3274 | </sect1>
|
---|
3275 |
|
---|
3276 | <sect1>
|
---|
3277 | <title>Function ICloudClient::launchVM</title>
|
---|
3278 | <para>
|
---|
3279 | See the <link linkend="ICloudClient__launchVM">ICloudClient::launchVM</link>.
|
---|
3280 | The function launches a new instance in OCI with a bootable volume previously created from a custom image in OCI or
|
---|
3281 | as the source may be used an existing bootable volume which shouldn't be attached to any instance.
|
---|
3282 | For launching instance from a custom image use the parameter VirtualSystemDescriptionType::CloudImageId.
|
---|
3283 | For launching instance from a bootable volume use the parameter VirtualSystemDescriptionType::CloudBootVolumeId.
|
---|
3284 | Only one of them must be presented otherwise the error will occur.
|
---|
3285 | The final result of this operation is a running instance. The id of created instance is returned
|
---|
3286 | in the parameter "description" (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
|
---|
3287 | as an entry with the type VirtualSystemDescriptionType::CloudInstanceId. Parameter "description" must contain all information
|
---|
3288 | and settings needed for creation a new instance in OCI. At least next entries must be presented there before the call:
|
---|
3289 | <itemizedlist>
|
---|
3290 | <listitem>
|
---|
3291 | <para>VirtualSystemDescriptionType::Name - Name of new instance in OCI.</para>
|
---|
3292 | </listitem>
|
---|
3293 | <listitem>
|
---|
3294 | <para>VirtualSystemDescriptionType::CloudOCISubnet - OCID of existing subnet in OCI which will be used by the instance.</para>
|
---|
3295 | </listitem>
|
---|
3296 | <listitem>
|
---|
3297 | <para>
|
---|
3298 | Use VirtualSystemDescriptionType::CloudImageId - OCID of custom image used as a bootable image for the instance
|
---|
3299 | or
|
---|
3300 | VirtualSystemDescriptionType::CloudBootVolumeId - OCID of existing and non-attached bootable volume used as a bootable volume for the instance.
|
---|
3301 | </para>
|
---|
3302 | </listitem>
|
---|
3303 | <listitem>
|
---|
3304 | <para>Add VirtualSystemDescriptionType::CloudBootDiskSize - The size of instance bootable volume in GB,
|
---|
3305 | If you use VirtualSystemDescriptionType::CloudImageId.</para>
|
---|
3306 | </listitem>
|
---|
3307 | <listitem>
|
---|
3308 | <para>VirtualSystemDescriptionType::CloudInstanceShape - The shape of instance according to OCI documentation,
|
---|
3309 | defines the number of CPUs and RAM memory.</para>
|
---|
3310 | </listitem>
|
---|
3311 | <listitem>
|
---|
3312 | <para>VirtualSystemDescriptionType::CloudLaunchInstance - Whether launch or not a new instance.</para>
|
---|
3313 | </listitem>
|
---|
3314 | <listitem>
|
---|
3315 | <para>VirtualSystemDescriptionType::CloudDomain - Availability domain in OCI where new instance is created.</para>
|
---|
3316 | </listitem>
|
---|
3317 | <listitem>
|
---|
3318 | <para>VirtualSystemDescriptionType::CloudPublicIP - Whether the instance will have a public IP or not.</para>
|
---|
3319 | </listitem>
|
---|
3320 | <listitem>
|
---|
3321 | <para>VirtualSystemDescriptionType::CloudPublicSSHKey - Public SSH key which is used to connect to an instance via SSH.
|
---|
3322 | It may be one or more records with the type VirtualSystemDescriptionType::CloudPublicSSHKey in the VirtualSystemDescription.
|
---|
3323 | But at least one should be presented otherwise user won't be able to connect to the instance via SSH.
|
---|
3324 | </para>
|
---|
3325 | </listitem>
|
---|
3326 | </itemizedlist>
|
---|
3327 | </para>
|
---|
3328 | </sect1>
|
---|
3329 |
|
---|
3330 | <sect1>
|
---|
3331 | <title>Function ICloudClient::getInstanceInfo</title>
|
---|
3332 | <para>
|
---|
3333 | See the <link linkend="ICloudClient__getInstanceInfo">ICloudClient::getInstanceInfo</link>.
|
---|
3334 | The function takes an instance id (parameter "uid"), finds the requested instance in OCI and gets back information
|
---|
3335 | about the found instance in the parameter "description" (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
|
---|
3336 | The entries with next types will be presented in the object:
|
---|
3337 | <itemizedlist>
|
---|
3338 | <listitem>
|
---|
3339 | <para>VirtualSystemDescriptionType::Name - Displayed name of the instance.</para>
|
---|
3340 | </listitem>
|
---|
3341 | <listitem>
|
---|
3342 | <para>VirtualSystemDescriptionType::CloudDomain - Availability domain in OCI.</para>
|
---|
3343 | </listitem>
|
---|
3344 | <listitem>
|
---|
3345 | <para>VirtualSystemDescriptionType::CloudImageId - Name of custom image used for creation this instance.</para>
|
---|
3346 | </listitem>
|
---|
3347 | <listitem>
|
---|
3348 | <para>VirtualSystemDescriptionType::CloudInstanceId - The OCID of the instance.</para>
|
---|
3349 | </listitem>
|
---|
3350 | <listitem>
|
---|
3351 | <para>VirtualSystemDescriptionType::OS - Guest OS type of the instance.</para>
|
---|
3352 | </listitem>
|
---|
3353 | <listitem>
|
---|
3354 | <para>VirtualSystemDescriptionType::CloudBootDiskSize - Size of instance bootable image.</para>
|
---|
3355 | </listitem>
|
---|
3356 | <listitem>
|
---|
3357 | <para>VirtualSystemDescriptionType::CloudInstanceState - The instance state according to OCI documentation.</para>
|
---|
3358 | </listitem>
|
---|
3359 | <listitem>
|
---|
3360 | <para>VirtualSystemDescriptionType::CloudInstanceShape - The instance shape according to OCI documentation</para>
|
---|
3361 | </listitem>
|
---|
3362 | <listitem>
|
---|
3363 | <para>VirtualSystemDescriptionType::Memory - RAM memory in GB allocated for the instance.</para>
|
---|
3364 | </listitem>
|
---|
3365 | <listitem>
|
---|
3366 | <para>VirtualSystemDescriptionType::CPU - Number of virtual CPUs allocated for the instance.</para>
|
---|
3367 | </listitem>
|
---|
3368 | </itemizedlist>
|
---|
3369 | </para>
|
---|
3370 | </sect1>
|
---|
3371 |
|
---|
3372 | <sect1>
|
---|
3373 | <title>Function ICloudClient::importInstance</title>
|
---|
3374 | <para>
|
---|
3375 | See the <link linkend="ICloudClient__importInstance">ICloudClient::importInstance</link>.
|
---|
3376 | The API function imports an existing instance from the OCI to the local host.
|
---|
3377 | The standard steps here are:
|
---|
3378 | <itemizedlist>
|
---|
3379 | <listitem>
|
---|
3380 | <para>Create a custom image from an existing OCI instance.</para>
|
---|
3381 | </listitem>
|
---|
3382 | <listitem>
|
---|
3383 | <para>Export the custom image to OCI object (the object is created in the OCI Object Storage).</para>
|
---|
3384 | </listitem>
|
---|
3385 | <listitem>
|
---|
3386 | <para>Download the OCI object to the local host.</para>
|
---|
3387 | </listitem>
|
---|
3388 | </itemizedlist>
|
---|
3389 | As the result of operation user will have a file with the suffix ".oci" on the local host. This file is a TAR archive which
|
---|
3390 | contains a bootable instance image in QCOW2 format and a JSON file with some metadata related to
|
---|
3391 | the imported instance. The function takes the parameter "description"
|
---|
3392 | (which is <link linkend="IVirtualSystemDescription">IVirtualSystemDescription</link>)
|
---|
3393 | Parameter "description" must contain all information and settings needed for successful operation result.
|
---|
3394 | At least next entries must be presented there before the call:
|
---|
3395 | <itemizedlist>
|
---|
3396 | <listitem>
|
---|
3397 | <para>VirtualSystemDescriptionType::Name is used for the several purposes:
|
---|
3398 | <itemizedlist>
|
---|
3399 | <listitem>
|
---|
3400 | <para>As a custom image name. A custom image is created from an instance.</para>
|
---|
3401 | </listitem>
|
---|
3402 | <listitem>
|
---|
3403 | <para>As OCI object name. An object is a file in OCI Object Storage. The object is created from the custom image.</para>
|
---|
3404 | </listitem>
|
---|
3405 | <listitem>
|
---|
3406 | <para>Name of imported instance on the local host. Because the result of import is a file, the file will have this
|
---|
3407 | name and extension ".oci".</para>
|
---|
3408 | </listitem>
|
---|
3409 | </itemizedlist>
|
---|
3410 | </para>
|
---|
3411 | </listitem>
|
---|
3412 | <listitem>
|
---|
3413 | <para>VirtualSystemDescriptionType::CloudInstanceId - The OCID of the existing instance.</para>
|
---|
3414 | </listitem>
|
---|
3415 | <listitem>
|
---|
3416 | <para>VirtualSystemDescriptionType::CloudBucket - a cloud bucket name in OCI Object Storage where created an OCI object
|
---|
3417 | from a custom image.
|
---|
3418 | </para>
|
---|
3419 | </listitem>
|
---|
3420 | </itemizedlist>
|
---|
3421 | </para>
|
---|
3422 | </sect1>
|
---|
3423 |
|
---|
3424 | </chapter>
|
---|
3425 |
|
---|
3426 | <chapter id="hgcm">
|
---|
3427 | <title>Host-Guest Communication Manager</title>
|
---|
3428 |
|
---|
3429 | <para>The VirtualBox Host-Guest Communication Manager (HGCM) allows a
|
---|
3430 | guest application or a guest driver to call a host shared library. The
|
---|
3431 | following features of VirtualBox are implemented using HGCM: <itemizedlist>
|
---|
3432 | <listitem>
|
---|
3433 | <para>Shared Folders</para>
|
---|
3434 | </listitem>
|
---|
3435 |
|
---|
3436 | <listitem>
|
---|
3437 | <para>Shared Clipboard</para>
|
---|
3438 | </listitem>
|
---|
3439 |
|
---|
3440 | <listitem>
|
---|
3441 | <para>Guest configuration interface</para>
|
---|
3442 | </listitem>
|
---|
3443 | </itemizedlist></para>
|
---|
3444 |
|
---|
3445 | <para>The shared library on the host contains a so called HGCM service.
|
---|
3446 | The guest HGCM client establishes a connection to the HGCM service on the
|
---|
3447 | host in order to call that HGCM service's entry point. When calling an
|
---|
3448 | HGCM service the client supplies a function code, the number of parameters
|
---|
3449 | for the function, and an array of the parameter arguments.</para>
|
---|
3450 |
|
---|
3451 | <sect1>
|
---|
3452 | <title>Virtual hardware implementation</title>
|
---|
3453 |
|
---|
3454 | <para>HGCM uses the Virtual Machine Monitor (VMM) virtual PCI device to
|
---|
3455 | exchange data between the guest and the host. The guest always acts as an
|
---|
3456 | initiator of requests. A request is constructed in the guest's physical
|
---|
3457 | memory which must be locked by the guest. The physical address is passed
|
---|
3458 | to the VMM device using a 32-bit
|
---|
3459 | <computeroutput>out edx, eax</computeroutput>
|
---|
3460 | instruction. The physical memory must be allocated below 4GB on 64-bit
|
---|
3461 | guests.</para>
|
---|
3462 |
|
---|
3463 | <para>The host parses the request header and data and queues the request
|
---|
3464 | for the corresponding host HGCM service type. The guest continues
|
---|
3465 | execution and usually waits on an HGCM event semaphore.</para>
|
---|
3466 |
|
---|
3467 | <para>When the request has been processed by the HGCM service, the VMM
|
---|
3468 | device sets the completion flag in the request header, sets the HGCM
|
---|
3469 | event and raises an IRQ for the guest. The IRQ handler signals the HGCM
|
---|
3470 | event semaphore and all HGCM callers check the completion flag in the
|
---|
3471 | corresponding request header. If the flag is set, the request is
|
---|
3472 | considered completed.</para>
|
---|
3473 | </sect1>
|
---|
3474 |
|
---|
3475 | <sect1>
|
---|
3476 | <title>Protocol specification</title>
|
---|
3477 |
|
---|
3478 | <para>The HGCM protocol definitions are contained in the
|
---|
3479 | <computeroutput>VBox/VBoxGuest.h</computeroutput> header file.</para>
|
---|
3480 |
|
---|
3481 | <sect2>
|
---|
3482 | <title>Request header</title>
|
---|
3483 |
|
---|
3484 | <para>HGCM request structures contains a generic header
|
---|
3485 | (VMMDevHGCMRequestHeader): <table>
|
---|
3486 | <title>HGCM Request Generic Header</title>
|
---|
3487 |
|
---|
3488 | <tgroup cols="2">
|
---|
3489 | <tbody>
|
---|
3490 | <row>
|
---|
3491 | <entry><emphasis role="bold">Name</emphasis></entry>
|
---|
3492 |
|
---|
3493 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3494 | </row>
|
---|
3495 |
|
---|
3496 | <row>
|
---|
3497 | <entry>size</entry>
|
---|
3498 |
|
---|
3499 | <entry>Size of the entire request.</entry>
|
---|
3500 | </row>
|
---|
3501 |
|
---|
3502 | <row>
|
---|
3503 | <entry>version</entry>
|
---|
3504 |
|
---|
3505 | <entry>Version of the header, must be set to
|
---|
3506 | <computeroutput>0x10001</computeroutput>.</entry>
|
---|
3507 | </row>
|
---|
3508 |
|
---|
3509 | <row>
|
---|
3510 | <entry>type</entry>
|
---|
3511 |
|
---|
3512 | <entry>Type of the request.</entry>
|
---|
3513 | </row>
|
---|
3514 |
|
---|
3515 | <row>
|
---|
3516 | <entry>rc</entry>
|
---|
3517 |
|
---|
3518 | <entry>HGCM return code, which will be set by the VMM
|
---|
3519 | device.</entry>
|
---|
3520 | </row>
|
---|
3521 |
|
---|
3522 | <row>
|
---|
3523 | <entry>reserved1</entry>
|
---|
3524 |
|
---|
3525 | <entry>A reserved field 1.</entry>
|
---|
3526 | </row>
|
---|
3527 |
|
---|
3528 | <row>
|
---|
3529 | <entry>reserved2</entry>
|
---|
3530 |
|
---|
3531 | <entry>A reserved field 2.</entry>
|
---|
3532 | </row>
|
---|
3533 |
|
---|
3534 | <row>
|
---|
3535 | <entry>flags</entry>
|
---|
3536 |
|
---|
3537 | <entry>HGCM flags, set by the VMM device.</entry>
|
---|
3538 | </row>
|
---|
3539 |
|
---|
3540 | <row>
|
---|
3541 | <entry>result</entry>
|
---|
3542 |
|
---|
3543 | <entry>The HGCM result code, set by the VMM device.</entry>
|
---|
3544 | </row>
|
---|
3545 | </tbody>
|
---|
3546 | </tgroup>
|
---|
3547 | </table> <note>
|
---|
3548 | <itemizedlist>
|
---|
3549 | <listitem>
|
---|
3550 | <para>All fields are 32-bit.</para>
|
---|
3551 | </listitem>
|
---|
3552 |
|
---|
3553 | <listitem>
|
---|
3554 | <para>Fields from <computeroutput>size</computeroutput> to
|
---|
3555 | <computeroutput>reserved2</computeroutput> are a standard VMM
|
---|
3556 | device request header, which is used for other interfaces as
|
---|
3557 | well.</para>
|
---|
3558 | </listitem>
|
---|
3559 | </itemizedlist>
|
---|
3560 | </note></para>
|
---|
3561 |
|
---|
3562 | <para>The <emphasis role="bold">type</emphasis> field indicates the
|
---|
3563 | type of the HGCM request: <table>
|
---|
3564 | <title>Request Types</title>
|
---|
3565 |
|
---|
3566 | <tgroup cols="2">
|
---|
3567 | <tbody>
|
---|
3568 | <row>
|
---|
3569 | <entry><emphasis role="bold">Name (decimal
|
---|
3570 | value)</emphasis></entry>
|
---|
3571 |
|
---|
3572 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3573 | </row>
|
---|
3574 |
|
---|
3575 | <row>
|
---|
3576 | <entry>VMMDevReq_HGCMConnect
|
---|
3577 | (<computeroutput>60</computeroutput>)</entry>
|
---|
3578 |
|
---|
3579 | <entry>Connect to an HGCM service.</entry>
|
---|
3580 | </row>
|
---|
3581 |
|
---|
3582 | <row>
|
---|
3583 | <entry>VMMDevReq_HGCMDisconnect
|
---|
3584 | (<computeroutput>61</computeroutput>)</entry>
|
---|
3585 |
|
---|
3586 | <entry>Disconnect from the service.</entry>
|
---|
3587 | </row>
|
---|
3588 |
|
---|
3589 | <row>
|
---|
3590 | <entry>VMMDevReq_HGCMCall32
|
---|
3591 | (<computeroutput>62</computeroutput>)</entry>
|
---|
3592 |
|
---|
3593 | <entry>Call an HGCM function using the 32-bit
|
---|
3594 | interface.</entry>
|
---|
3595 | </row>
|
---|
3596 |
|
---|
3597 | <row>
|
---|
3598 | <entry>VMMDevReq_HGCMCall64
|
---|
3599 | (<computeroutput>63</computeroutput>)</entry>
|
---|
3600 |
|
---|
3601 | <entry>Call an HGCM function using the 64-bit
|
---|
3602 | interface.</entry>
|
---|
3603 | </row>
|
---|
3604 |
|
---|
3605 | <row>
|
---|
3606 | <entry>VMMDevReq_HGCMCancel
|
---|
3607 | (<computeroutput>64</computeroutput>)</entry>
|
---|
3608 |
|
---|
3609 | <entry>Cancel an HGCM request currently being processed by a
|
---|
3610 | host HGCM service.</entry>
|
---|
3611 | </row>
|
---|
3612 | </tbody>
|
---|
3613 | </tgroup>
|
---|
3614 | </table></para>
|
---|
3615 |
|
---|
3616 | <para>The <emphasis role="bold">flags</emphasis> field may contain:
|
---|
3617 | <table>
|
---|
3618 | <title>Flags</title>
|
---|
3619 |
|
---|
3620 | <tgroup cols="2">
|
---|
3621 | <tbody>
|
---|
3622 | <row>
|
---|
3623 | <entry><emphasis role="bold">Name (hexadecimal
|
---|
3624 | value)</emphasis></entry>
|
---|
3625 |
|
---|
3626 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3627 | </row>
|
---|
3628 |
|
---|
3629 | <row>
|
---|
3630 | <entry>VBOX_HGCM_REQ_DONE
|
---|
3631 | (<computeroutput>0x00000001</computeroutput>)</entry>
|
---|
3632 |
|
---|
3633 | <entry>The request has been processed by the host
|
---|
3634 | service.</entry>
|
---|
3635 | </row>
|
---|
3636 |
|
---|
3637 | <row>
|
---|
3638 | <entry>VBOX_HGCM_REQ_CANCELLED
|
---|
3639 | (<computeroutput>0x00000002</computeroutput>)</entry>
|
---|
3640 |
|
---|
3641 | <entry>This request was cancelled.</entry>
|
---|
3642 | </row>
|
---|
3643 | </tbody>
|
---|
3644 | </tgroup>
|
---|
3645 | </table></para>
|
---|
3646 | </sect2>
|
---|
3647 |
|
---|
3648 | <sect2>
|
---|
3649 | <title>Connect</title>
|
---|
3650 |
|
---|
3651 | <para>The connection request must be issued by the guest HGCM client
|
---|
3652 | before it can call the HGCM service (VMMDevHGCMConnect): <table>
|
---|
3653 | <title>Connect request</title>
|
---|
3654 |
|
---|
3655 | <tgroup cols="2">
|
---|
3656 | <tbody>
|
---|
3657 | <row>
|
---|
3658 | <entry><emphasis role="bold">Name</emphasis></entry>
|
---|
3659 |
|
---|
3660 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3661 | </row>
|
---|
3662 |
|
---|
3663 | <row>
|
---|
3664 | <entry>header</entry>
|
---|
3665 |
|
---|
3666 | <entry>The generic HGCM request header with type equal to
|
---|
3667 | VMMDevReq_HGCMConnect
|
---|
3668 | (<computeroutput>60</computeroutput>).</entry>
|
---|
3669 | </row>
|
---|
3670 |
|
---|
3671 | <row>
|
---|
3672 | <entry>type</entry>
|
---|
3673 |
|
---|
3674 | <entry>The type of the service location information (32
|
---|
3675 | bit).</entry>
|
---|
3676 | </row>
|
---|
3677 |
|
---|
3678 | <row>
|
---|
3679 | <entry>location</entry>
|
---|
3680 |
|
---|
3681 | <entry>The service location information (128 bytes).</entry>
|
---|
3682 | </row>
|
---|
3683 |
|
---|
3684 | <row>
|
---|
3685 | <entry>clientId</entry>
|
---|
3686 |
|
---|
3687 | <entry>The client identifier assigned to the connecting
|
---|
3688 | client by the HGCM subsystem (32-bit).</entry>
|
---|
3689 | </row>
|
---|
3690 | </tbody>
|
---|
3691 | </tgroup>
|
---|
3692 | </table> The <emphasis role="bold">type</emphasis> field tells the
|
---|
3693 | HGCM how to look for the requested service: <table>
|
---|
3694 | <title>Location Information Types</title>
|
---|
3695 |
|
---|
3696 | <tgroup cols="2">
|
---|
3697 | <tbody>
|
---|
3698 | <row>
|
---|
3699 | <entry><emphasis role="bold">Name (hexadecimal
|
---|
3700 | value)</emphasis></entry>
|
---|
3701 |
|
---|
3702 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3703 | </row>
|
---|
3704 |
|
---|
3705 | <row>
|
---|
3706 | <entry>VMMDevHGCMLoc_LocalHost
|
---|
3707 | (<computeroutput>0x1</computeroutput>)</entry>
|
---|
3708 |
|
---|
3709 | <entry>The requested service is a shared library located on
|
---|
3710 | the host and the location information contains the library
|
---|
3711 | name.</entry>
|
---|
3712 | </row>
|
---|
3713 |
|
---|
3714 | <row>
|
---|
3715 | <entry>VMMDevHGCMLoc_LocalHost_Existing
|
---|
3716 | (<computeroutput>0x2</computeroutput>)</entry>
|
---|
3717 |
|
---|
3718 | <entry>The requested service is a preloaded one and the
|
---|
3719 | location information contains the service name.</entry>
|
---|
3720 | </row>
|
---|
3721 | </tbody>
|
---|
3722 | </tgroup>
|
---|
3723 | </table> <note>
|
---|
3724 | <para>Currently preloaded HGCM services are hard-coded in
|
---|
3725 | VirtualBox: <itemizedlist>
|
---|
3726 | <listitem>
|
---|
3727 | <para>VBoxSharedFolders</para>
|
---|
3728 | </listitem>
|
---|
3729 |
|
---|
3730 | <listitem>
|
---|
3731 | <para>VBoxSharedClipboard</para>
|
---|
3732 | </listitem>
|
---|
3733 |
|
---|
3734 | <listitem>
|
---|
3735 | <para>VBoxGuestPropSvc</para>
|
---|
3736 | </listitem>
|
---|
3737 |
|
---|
3738 | <listitem>
|
---|
3739 | <para>VBoxSharedOpenGL</para>
|
---|
3740 | </listitem>
|
---|
3741 | </itemizedlist></para>
|
---|
3742 | </note> There is no difference between both types of HGCM services,
|
---|
3743 | only the location mechanism is different.</para>
|
---|
3744 |
|
---|
3745 | <para>The client identifier is returned by the host and must be used
|
---|
3746 | in all subsequent requests by the client.</para>
|
---|
3747 | </sect2>
|
---|
3748 |
|
---|
3749 | <sect2>
|
---|
3750 | <title>Disconnect</title>
|
---|
3751 |
|
---|
3752 | <para>This request disconnects the client and makes the client
|
---|
3753 | identifier invalid (VMMDevHGCMDisconnect): <table>
|
---|
3754 | <title>Disconnect request</title>
|
---|
3755 |
|
---|
3756 | <tgroup cols="2">
|
---|
3757 | <tbody>
|
---|
3758 | <row>
|
---|
3759 | <entry><emphasis role="bold">Name</emphasis></entry>
|
---|
3760 |
|
---|
3761 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3762 | </row>
|
---|
3763 |
|
---|
3764 | <row>
|
---|
3765 | <entry>header</entry>
|
---|
3766 |
|
---|
3767 | <entry>The generic HGCM request header with type equal to
|
---|
3768 | VMMDevReq_HGCMDisconnect
|
---|
3769 | (<computeroutput>61</computeroutput>).</entry>
|
---|
3770 | </row>
|
---|
3771 |
|
---|
3772 | <row>
|
---|
3773 | <entry>clientId</entry>
|
---|
3774 |
|
---|
3775 | <entry>The client identifier previously returned by the
|
---|
3776 | connect request (32-bit).</entry>
|
---|
3777 | </row>
|
---|
3778 | </tbody>
|
---|
3779 | </tgroup>
|
---|
3780 | </table></para>
|
---|
3781 | </sect2>
|
---|
3782 |
|
---|
3783 | <sect2>
|
---|
3784 | <title>Call32 and Call64</title>
|
---|
3785 |
|
---|
3786 | <para>Calls the HGCM service entry point (VMMDevHGCMCall) using 32-bit
|
---|
3787 | or 64-bit addresses: <table>
|
---|
3788 | <title>Call request</title>
|
---|
3789 |
|
---|
3790 | <tgroup cols="2">
|
---|
3791 | <tbody>
|
---|
3792 | <row>
|
---|
3793 | <entry><emphasis role="bold">Name</emphasis></entry>
|
---|
3794 |
|
---|
3795 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3796 | </row>
|
---|
3797 |
|
---|
3798 | <row>
|
---|
3799 | <entry>header</entry>
|
---|
3800 |
|
---|
3801 | <entry>The generic HGCM request header with type equal to
|
---|
3802 | either VMMDevReq_HGCMCall32
|
---|
3803 | (<computeroutput>62</computeroutput>) or
|
---|
3804 | VMMDevReq_HGCMCall64
|
---|
3805 | (<computeroutput>63</computeroutput>).</entry>
|
---|
3806 | </row>
|
---|
3807 |
|
---|
3808 | <row>
|
---|
3809 | <entry>clientId</entry>
|
---|
3810 |
|
---|
3811 | <entry>The client identifier previously returned by the
|
---|
3812 | connect request (32-bit).</entry>
|
---|
3813 | </row>
|
---|
3814 |
|
---|
3815 | <row>
|
---|
3816 | <entry>function</entry>
|
---|
3817 |
|
---|
3818 | <entry>The function code to be processed by the service (32
|
---|
3819 | bit).</entry>
|
---|
3820 | </row>
|
---|
3821 |
|
---|
3822 | <row>
|
---|
3823 | <entry>cParms</entry>
|
---|
3824 |
|
---|
3825 | <entry>The number of following parameters (32-bit). This
|
---|
3826 | value is 0 if the function requires no parameters.</entry>
|
---|
3827 | </row>
|
---|
3828 |
|
---|
3829 | <row>
|
---|
3830 | <entry>parms</entry>
|
---|
3831 |
|
---|
3832 | <entry>An array of parameter description structures
|
---|
3833 | (HGCMFunctionParameter32 or
|
---|
3834 | HGCMFunctionParameter64).</entry>
|
---|
3835 | </row>
|
---|
3836 | </tbody>
|
---|
3837 | </tgroup>
|
---|
3838 | </table></para>
|
---|
3839 |
|
---|
3840 | <para>The 32-bit parameter description (HGCMFunctionParameter32)
|
---|
3841 | consists of a 32-bit type field and 8 bytes of an opaque value, so 12
|
---|
3842 | bytes in total. The 64-bit variant (HGCMFunctionParameter64) consists
|
---|
3843 | of the 32-bit type and 12 bytes of a value, so 16 bytes in total.</para>
|
---|
3844 |
|
---|
3845 | <para><table>
|
---|
3846 | <title>Parameter types</title>
|
---|
3847 |
|
---|
3848 | <tgroup cols="2">
|
---|
3849 | <tbody>
|
---|
3850 | <row>
|
---|
3851 | <entry><emphasis role="bold">Type</emphasis></entry>
|
---|
3852 |
|
---|
3853 | <entry><emphasis role="bold">Format of the
|
---|
3854 | value</emphasis></entry>
|
---|
3855 | </row>
|
---|
3856 |
|
---|
3857 | <row>
|
---|
3858 | <entry>VMMDevHGCMParmType_32bit (1)</entry>
|
---|
3859 |
|
---|
3860 | <entry>A 32-bit value.</entry>
|
---|
3861 | </row>
|
---|
3862 |
|
---|
3863 | <row>
|
---|
3864 | <entry>VMMDevHGCMParmType_64bit (2)</entry>
|
---|
3865 |
|
---|
3866 | <entry>A 64-bit value.</entry>
|
---|
3867 | </row>
|
---|
3868 |
|
---|
3869 | <row>
|
---|
3870 | <entry>VMMDevHGCMParmType_PhysAddr (3)</entry>
|
---|
3871 |
|
---|
3872 | <entry>A 32-bit size followed by a 32-bit or 64-bit guest
|
---|
3873 | physical address.</entry>
|
---|
3874 | </row>
|
---|
3875 |
|
---|
3876 | <row>
|
---|
3877 | <entry>VMMDevHGCMParmType_LinAddr (4)</entry>
|
---|
3878 |
|
---|
3879 | <entry>A 32-bit size followed by a 32-bit or 64-bit guest
|
---|
3880 | linear address. The buffer is used both for guest to host
|
---|
3881 | and for host to guest data.</entry>
|
---|
3882 | </row>
|
---|
3883 |
|
---|
3884 | <row>
|
---|
3885 | <entry>VMMDevHGCMParmType_LinAddr_In (5)</entry>
|
---|
3886 |
|
---|
3887 | <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
|
---|
3888 | used only for host to guest data.</entry>
|
---|
3889 | </row>
|
---|
3890 |
|
---|
3891 | <row>
|
---|
3892 | <entry>VMMDevHGCMParmType_LinAddr_Out (6)</entry>
|
---|
3893 |
|
---|
3894 | <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
|
---|
3895 | used only for guest to host data.</entry>
|
---|
3896 | </row>
|
---|
3897 |
|
---|
3898 | <row>
|
---|
3899 | <entry>VMMDevHGCMParmType_LinAddr_Locked (7)</entry>
|
---|
3900 |
|
---|
3901 | <entry>Same as VMMDevHGCMParmType_LinAddr but the buffer is
|
---|
3902 | already locked by the guest.</entry>
|
---|
3903 | </row>
|
---|
3904 |
|
---|
3905 | <row>
|
---|
3906 | <entry>VMMDevHGCMParmType_LinAddr_Locked_In (1)</entry>
|
---|
3907 |
|
---|
3908 | <entry>Same as VMMDevHGCMParmType_LinAddr_In but the buffer
|
---|
3909 | is already locked by the guest.</entry>
|
---|
3910 | </row>
|
---|
3911 |
|
---|
3912 | <row>
|
---|
3913 | <entry>VMMDevHGCMParmType_LinAddr_Locked_Out (1)</entry>
|
---|
3914 |
|
---|
3915 | <entry>Same as VMMDevHGCMParmType_LinAddr_Out but the buffer
|
---|
3916 | is already locked by the guest.</entry>
|
---|
3917 | </row>
|
---|
3918 | </tbody>
|
---|
3919 | </tgroup>
|
---|
3920 | </table></para>
|
---|
3921 |
|
---|
3922 | </sect2>
|
---|
3923 |
|
---|
3924 | <sect2>
|
---|
3925 | <title>Cancel</title>
|
---|
3926 |
|
---|
3927 | <para>This request cancels a call request (VMMDevHGCMCancel): <table>
|
---|
3928 | <title>Cancel request</title>
|
---|
3929 |
|
---|
3930 | <tgroup cols="2">
|
---|
3931 | <tbody>
|
---|
3932 | <row>
|
---|
3933 | <entry><emphasis role="bold">Name</emphasis></entry>
|
---|
3934 |
|
---|
3935 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
3936 | </row>
|
---|
3937 |
|
---|
3938 | <row>
|
---|
3939 | <entry>header</entry>
|
---|
3940 |
|
---|
3941 | <entry>The generic HGCM request header with type equal to
|
---|
3942 | VMMDevReq_HGCMCancel
|
---|
3943 | (<computeroutput>64</computeroutput>).</entry>
|
---|
3944 | </row>
|
---|
3945 | </tbody>
|
---|
3946 | </tgroup>
|
---|
3947 | </table></para>
|
---|
3948 | </sect2>
|
---|
3949 | </sect1>
|
---|
3950 |
|
---|
3951 | <sect1>
|
---|
3952 | <title>Guest software interface</title>
|
---|
3953 |
|
---|
3954 | <para>Guest HGCM clients can call HGCM services from both drivers
|
---|
3955 | and applications.</para>
|
---|
3956 |
|
---|
3957 | <sect2>
|
---|
3958 | <title>The guest driver interface</title>
|
---|
3959 |
|
---|
3960 | <para>The driver interface is implemented in the VirtualBox guest
|
---|
3961 | additions driver (VBoxGuest) which works with the VMM virtual device.
|
---|
3962 | Drivers must use the VBox Guest Library (VBGL) which provides an API
|
---|
3963 | for HGCM clients (<computeroutput>VBox/VBoxGuestLib.h</computeroutput>
|
---|
3964 | and <computeroutput>VBox/VBoxGuest.h</computeroutput>). The key VBGL API
|
---|
3965 | routines are as follows:</para>
|
---|
3966 |
|
---|
3967 | <para><screen>
|
---|
3968 | DECLR0VBGL(int) VbglR0HGCMConnect(VBGLHGCMHANDLE *pHandle, const char *pszServiceName, HGCMCLIENTID *pidClient);
|
---|
3969 | </screen> VbglR0HGCMConnect() connects to the HGCM service on the host. An
|
---|
3970 | example of a guest driver connecting to the VirtualBox Shared Folder
|
---|
3971 | HGCM service follows:<screen>
|
---|
3972 | VBoxGuestHGCMConnectInfo data;
|
---|
3973 |
|
---|
3974 | memset(&data, sizeof(VBoxGuestHGCMConnectInfo));
|
---|
3975 |
|
---|
3976 | data.result = VINF_SUCCESS;
|
---|
3977 | data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
|
---|
3978 | strcpy(data.Loc.u.host.achName, "VBoxSharedFolders");
|
---|
3979 |
|
---|
3980 | rc = VbglR0HGCMConnect(&handle, "VBoxSharedFolders"&, data);
|
---|
3981 |
|
---|
3982 | if (RT_SUCCESS(rc))
|
---|
3983 | {
|
---|
3984 | rc = data.result;
|
---|
3985 | }
|
---|
3986 |
|
---|
3987 | if (RT_SUCCESS(rc))
|
---|
3988 | {
|
---|
3989 | /* Get the assigned client identifier. */
|
---|
3990 | ulClientID = data.u32ClientID;
|
---|
3991 | }
|
---|
3992 | </screen></para>
|
---|
3993 |
|
---|
3994 | <para><screen>
|
---|
3995 | DECLVBGL(int) VbglR0HGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
|
---|
3996 | </screen> VbglR0HGCMDisconnect() disconnects from the HGCM service on the
|
---|
3997 | host. An example of a guest driver disconnecting from an HGCM service
|
---|
3998 | using the client identifier from an earlier call to VbglR0HGCMConnect()
|
---|
3999 | follows:<screen>
|
---|
4000 | VBoxGuestHGCMDisconnectInfo data;
|
---|
4001 |
|
---|
4002 | RtlZeroMemory(&data, sizeof (VBoxGuestHGCMDisconnectInfo));
|
---|
4003 |
|
---|
4004 | data.result = VINF_SUCCESS;
|
---|
4005 | data.u32ClientID = ulClientID;
|
---|
4006 |
|
---|
4007 | rc = VbglR0HGCMDisconnect(handle, &data);
|
---|
4008 | </screen></para>
|
---|
4009 |
|
---|
4010 | <para><screen>
|
---|
4011 | DECLVBGL(int) VbglR0HGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
|
---|
4012 | </screen> VbglR0HGCMCall() calls a function specified in the
|
---|
4013 | VBoxGuestHGCMCallInfo argument in the HGCM service on the host. An
|
---|
4014 | example of a guest driver calling the Shared Folders HGCM service to
|
---|
4015 | issue a read of an object in a shared folder follows:<screen>
|
---|
4016 | typedef struct _VBoxSFRead
|
---|
4017 | {
|
---|
4018 | VBoxGuestHGCMCallInfo callInfo;
|
---|
4019 |
|
---|
4020 | /** pointer, in: SHFLROOT
|
---|
4021 | * Root handle of the mapping which name is queried.
|
---|
4022 | */
|
---|
4023 | HGCMFunctionParameter root;
|
---|
4024 |
|
---|
4025 | /** value64, in:
|
---|
4026 | * SHFLHANDLE of object to read from.
|
---|
4027 | */
|
---|
4028 | HGCMFunctionParameter handle;
|
---|
4029 |
|
---|
4030 | /** value64, in:
|
---|
4031 | * Offset to read from.
|
---|
4032 | */
|
---|
4033 | HGCMFunctionParameter offset;
|
---|
4034 |
|
---|
4035 | /** value64, in/out:
|
---|
4036 | * Bytes to read/How many were read.
|
---|
4037 | */
|
---|
4038 | HGCMFunctionParameter cb;
|
---|
4039 |
|
---|
4040 | /** pointer, out:
|
---|
4041 | * Buffer to place data to.
|
---|
4042 | */
|
---|
4043 | HGCMFunctionParameter buffer;
|
---|
4044 |
|
---|
4045 | } VBoxSFRead;
|
---|
4046 |
|
---|
4047 | /** Number of parameters */
|
---|
4048 | #define SHFL_CPARMS_READ (5)
|
---|
4049 |
|
---|
4050 | ...
|
---|
4051 |
|
---|
4052 | VBoxSFRead data;
|
---|
4053 |
|
---|
4054 | /* The call information. */
|
---|
4055 | data.callInfo.result = VINF_SUCCESS; /* Will be returned by HGCM. */
|
---|
4056 | data.callInfo.u32ClientID = ulClientID; /* Client identifier. */
|
---|
4057 | data.callInfo.u32Function = SHFL_FN_READ; /* The function code. */
|
---|
4058 | data.callInfo.cParms = SHFL_CPARMS_READ; /* Number of parameters. */
|
---|
4059 |
|
---|
4060 | /* Initialize parameters. */
|
---|
4061 | data.root.type = VMMDevHGCMParmType_32bit;
|
---|
4062 | data.root.u.value32 = pMap->root;
|
---|
4063 |
|
---|
4064 | data.handle.type = VMMDevHGCMParmType_64bit;
|
---|
4065 | data.handle.u.value64 = hFile;
|
---|
4066 |
|
---|
4067 | data.offset.type = VMMDevHGCMParmType_64bit;
|
---|
4068 | data.offset.u.value64 = offset;
|
---|
4069 |
|
---|
4070 | data.cb.type = VMMDevHGCMParmType_32bit;
|
---|
4071 | data.cb.u.value32 = *pcbBuffer;
|
---|
4072 |
|
---|
4073 | data.buffer.type = VMMDevHGCMParmType_LinAddr_Out;
|
---|
4074 | data.buffer.u.Pointer.size = *pcbBuffer;
|
---|
4075 | data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
|
---|
4076 |
|
---|
4077 | rc = VbglR0HGCMCall(handle, &data.callInfo, sizeof (data));
|
---|
4078 |
|
---|
4079 | if (RT_SUCCESS(rc))
|
---|
4080 | {
|
---|
4081 | rc = data.callInfo.result;
|
---|
4082 | *pcbBuffer = data.cb.u.value32; /* This is returned by the HGCM service. */
|
---|
4083 | }
|
---|
4084 | </screen></para>
|
---|
4085 | </sect2>
|
---|
4086 |
|
---|
4087 | <sect2>
|
---|
4088 | <title>Guest application interface</title>
|
---|
4089 |
|
---|
4090 | <para>Applications call the VirtualBox Guest Additions driver to
|
---|
4091 | utilize the HGCM interface. The following IOCTLs correspond to the
|
---|
4092 | <computeroutput>VbglR0HGCM*</computeroutput> functions listed above:
|
---|
4093 | <itemizedlist>
|
---|
4094 | <listitem>
|
---|
4095 | <para><computeroutput>VBGL_IOCTL_HGCM_CONNECT =>
|
---|
4096 | VbglR0HGCMConnect()</computeroutput></para>
|
---|
4097 | </listitem>
|
---|
4098 |
|
---|
4099 | <listitem>
|
---|
4100 | <para><computeroutput>VBGL_IOCTL_HGCM_DISCONNECT =>
|
---|
4101 | VbglR0HGCMDisconnect()</computeroutput></para>
|
---|
4102 | </listitem>
|
---|
4103 |
|
---|
4104 | <listitem>
|
---|
4105 | <para><computeroutput>VBGL_IOCTL_HGCM_CALL =>
|
---|
4106 | VbglR0HGCMCall()</computeroutput></para>
|
---|
4107 | </listitem>
|
---|
4108 | </itemizedlist></para>
|
---|
4109 |
|
---|
4110 | <para>These IOCTLs get the same input buffer as the
|
---|
4111 | <computeroutput>VbglR0HGCM*</computeroutput> functions and the output
|
---|
4112 | buffer has the same format as the input buffer. The same address can
|
---|
4113 | be used for both the input and output buffers.</para>
|
---|
4114 | </sect2>
|
---|
4115 | </sect1>
|
---|
4116 |
|
---|
4117 | <sect1>
|
---|
4118 | <title>HGCM Service Implementation</title>
|
---|
4119 |
|
---|
4120 | <para>The HGCM service is a shared library with a specific set of entry
|
---|
4121 | points. The library must export the
|
---|
4122 | <computeroutput>VBoxHGCMSvcLoad</computeroutput> entry point: <screen>
|
---|
4123 | extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad(VBOXHGCMSVCFNTABLE *ptable)
|
---|
4124 | </screen></para>
|
---|
4125 |
|
---|
4126 | <para>The service must check the
|
---|
4127 | <computeroutput>ptable->cbSize</computeroutput> and
|
---|
4128 | <computeroutput>ptable->u32Version</computeroutput> fields of the
|
---|
4129 | input structure and fill in the remaining fields with function pointers of
|
---|
4130 | service entry points (listed below) and the size of the required client
|
---|
4131 | buffer size.</para>
|
---|
4132 |
|
---|
4133 | <para>The HGCM service gets a dedicated thread which calls service
|
---|
4134 | entry points synchronously, thus the service entry point will only be called
|
---|
4135 | again once a previous call has returned. However, the guest calls can be
|
---|
4136 | processed asynchronously. Therefore the service must call a completion
|
---|
4137 | callback when the operation is actually completed. The callback can be
|
---|
4138 | issued from another thread as well.</para>
|
---|
4139 |
|
---|
4140 | <para>Service entry points are listed in the
|
---|
4141 | <computeroutput>VBox/hgcmsvc.h</computeroutput> in the
|
---|
4142 | <computeroutput>VBOXHGCMSVCFNTABLE</computeroutput> structure. <table>
|
---|
4143 | <title>Service entry points</title>
|
---|
4144 |
|
---|
4145 | <tgroup cols="2">
|
---|
4146 | <tbody>
|
---|
4147 | <row>
|
---|
4148 | <entry><emphasis role="bold">Entry Point</emphasis></entry>
|
---|
4149 |
|
---|
4150 | <entry><emphasis role="bold">Description</emphasis></entry>
|
---|
4151 | </row>
|
---|
4152 |
|
---|
4153 | <row>
|
---|
4154 | <entry>int pfnUnload(void *pvService)</entry>
|
---|
4155 |
|
---|
4156 | <entry>The service is being unloaded.</entry>
|
---|
4157 | </row>
|
---|
4158 |
|
---|
4159 | <row>
|
---|
4160 | <entry>int pfnConnect(void *pvService, uint32_t u32ClientID, void *pvClient,
|
---|
4161 | uint32_t fRequestor, bool fRestoring)</entry>
|
---|
4162 |
|
---|
4163 | <entry>A client <computeroutput>u32ClientID</computeroutput>
|
---|
4164 | is connected to the service. The
|
---|
4165 | <computeroutput>pvClient</computeroutput> parameter points to
|
---|
4166 | an allocated memory buffer which can be used by the service to
|
---|
4167 | store the client information.</entry>
|
---|
4168 | </row>
|
---|
4169 |
|
---|
4170 | <row>
|
---|
4171 | <entry>int pfnDisconnect(void *pvService, uint32_t u32ClientID,
|
---|
4172 | void *pvClient)</entry>
|
---|
4173 |
|
---|
4174 | <entry>A client is being disconnected.</entry>
|
---|
4175 | </row>
|
---|
4176 |
|
---|
4177 | <row>
|
---|
4178 | <entry>void pfnCall(void *pvService, VBOXHGCMCALLHANDLE callHandle,
|
---|
4179 | uint32_t u32ClientID, void *pvClient, uint32_t function,
|
---|
4180 | uint32_t cParms, VBOXHGCMSVCPARM paParms[],
|
---|
4181 | uint64_t tsArrival)</entry>
|
---|
4182 |
|
---|
4183 | <entry>A guest client calls a service function. The
|
---|
4184 | <computeroutput>callHandle</computeroutput> must be used in
|
---|
4185 | the VBOXHGCMSVCHELPERS::pfnCallComplete callback when the call
|
---|
4186 | has been processed.</entry>
|
---|
4187 | </row>
|
---|
4188 |
|
---|
4189 | <row>
|
---|
4190 | <entry>int pfnHostCall(void *pvService, uint32_t function, uint32_t cParms,
|
---|
4191 | VBOXHGCMSVCPARM paParms[])</entry>
|
---|
4192 |
|
---|
4193 | <entry>Called by the VirtualBox host components to perform
|
---|
4194 | functions which should be not accessible by the guest. Usually
|
---|
4195 | this entry point is used by VirtualBox to configure the
|
---|
4196 | service.</entry>
|
---|
4197 | </row>
|
---|
4198 |
|
---|
4199 | <row>
|
---|
4200 | <entry>int pfnSaveState(void *pvService, uint32_t u32ClientID, void *pvClient,
|
---|
4201 | PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM)</entry>
|
---|
4202 |
|
---|
4203 | <entry>The VM state is being saved and the service must save
|
---|
4204 | relevant information using the SSM API
|
---|
4205 | (<computeroutput>VBox/ssm.h</computeroutput>).</entry>
|
---|
4206 | </row>
|
---|
4207 |
|
---|
4208 | <row>
|
---|
4209 | <entry>int pfnLoadState(void *pvService, uint32_t u32ClientID, void *pvClient,
|
---|
4210 | PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, uint32_t uVersion)</entry>
|
---|
4211 |
|
---|
4212 | <entry>The VM is being restored from the saved state and the
|
---|
4213 | service must load the saved information and be able to
|
---|
4214 | continue operations from the saved state.</entry>
|
---|
4215 | </row>
|
---|
4216 | </tbody>
|
---|
4217 | </tgroup>
|
---|
4218 | </table></para>
|
---|
4219 | </sect1>
|
---|
4220 | </chapter>
|
---|
4221 |
|
---|
4222 | <chapter id="rdpweb">
|
---|
4223 | <title>RDP Web Control</title>
|
---|
4224 |
|
---|
4225 | <para>The VirtualBox <emphasis>RDP Web Control</emphasis> (RDPWeb)
|
---|
4226 | provides remote access to a running VM. RDPWeb is an RDP (Remote Desktop
|
---|
4227 | Protocol) client based on Flash technology and can be used from a Web
|
---|
4228 | browser with a Flash plugin.</para>
|
---|
4229 |
|
---|
4230 | <sect1>
|
---|
4231 | <title>RDPWeb features</title>
|
---|
4232 |
|
---|
4233 | <para>RDPWeb is embedded into a Web page and connects to a VRDP server
|
---|
4234 | in order to display the remote VM screen and pass keyboard and mouse events
|
---|
4235 | to the VM.</para>
|
---|
4236 | </sect1>
|
---|
4237 |
|
---|
4238 | <sect1>
|
---|
4239 | <title>RDPWeb reference</title>
|
---|
4240 |
|
---|
4241 | <para>RDPWeb consists of two required components:<itemizedlist>
|
---|
4242 | <listitem>
|
---|
4243 | <para>Flash movie file
|
---|
4244 | <computeroutput>RDPClientUI.swf</computeroutput></para>
|
---|
4245 | </listitem>
|
---|
4246 |
|
---|
4247 | <listitem>
|
---|
4248 | <para>JavaScript helpers contained in
|
---|
4249 | <computeroutput>webclient.js</computeroutput></para>
|
---|
4250 | </listitem>
|
---|
4251 | </itemizedlist></para>
|
---|
4252 |
|
---|
4253 | <para>The VirtualBox SDK contains sample HTML code
|
---|
4254 | including:<itemizedlist>
|
---|
4255 | <listitem>
|
---|
4256 | <para>A JavaScript library for embedding Flash content:
|
---|
4257 | <computeroutput>SWFObject.js</computeroutput></para>
|
---|
4258 | </listitem>
|
---|
4259 |
|
---|
4260 | <listitem>
|
---|
4261 | <para>A sample HTML page:
|
---|
4262 | <computeroutput>webclient3.html</computeroutput></para>
|
---|
4263 | </listitem>
|
---|
4264 | </itemizedlist></para>
|
---|
4265 |
|
---|
4266 | <sect2>
|
---|
4267 | <title>RDPWeb functions</title>
|
---|
4268 |
|
---|
4269 | <para><computeroutput>RDPClientUI.swf</computeroutput> and
|
---|
4270 | <computeroutput>webclient.js</computeroutput> work together to provide the
|
---|
4271 | RDP Web Control functionality. The JavaScript code is responsible for
|
---|
4272 | proper Flash initialization, delivering mouse events to the Flash object,
|
---|
4273 | and processing resize requests from the Flash object. On the other hand,
|
---|
4274 | the SWF file contains a few JavaScript callable methods, which are used
|
---|
4275 | both from <computeroutput>webclient.js</computeroutput> and the user HTML
|
---|
4276 | page.</para>
|
---|
4277 |
|
---|
4278 | <sect3>
|
---|
4279 | <title>JavaScript functions</title>
|
---|
4280 |
|
---|
4281 | <para>The <computeroutput>webclient.js</computeroutput> file contains
|
---|
4282 | several helper JavaScript functions. In the following table ElementId
|
---|
4283 | refers to an HTML element name or attribute, and Element to the HTML
|
---|
4284 | element itself.
|
---|
4285 | The HTML code<programlisting>
|
---|
4286 | <div id="FlashRDP">
|
---|
4287 | </div>
|
---|
4288 | </programlisting> would have ElementId equal to FlashRDP and Element equal to
|
---|
4289 | the div element.</para>
|
---|
4290 |
|
---|
4291 | <para><itemizedlist>
|
---|
4292 | <listitem>
|
---|
4293 | <programlisting>RDPWebClient.embedSWF(SWFFileName, ElementId)</programlisting>
|
---|
4294 |
|
---|
4295 | <para>Uses the open-source SWFObject library to replace the HTML
|
---|
4296 | element with the Flash movie.</para>
|
---|
4297 | </listitem>
|
---|
4298 |
|
---|
4299 | <listitem>
|
---|
4300 | <programlisting>RDPWebClient.isRDPWebControlById(ElementId)</programlisting>
|
---|
4301 |
|
---|
4302 | <para>Returns true if the given ElementId refers to an RDPWeb
|
---|
4303 | Flash element.</para>
|
---|
4304 | </listitem>
|
---|
4305 |
|
---|
4306 | <listitem>
|
---|
4307 | <programlisting>RDPWebClient.isRDPWebControlByElement(Element)</programlisting>
|
---|
4308 |
|
---|
4309 | <para>Returns true if the given Element is an RDPWeb Flash
|
---|
4310 | element.</para>
|
---|
4311 | </listitem>
|
---|
4312 |
|
---|
4313 | <listitem>
|
---|
4314 | <programlisting>RDPWebClient.getFlashById(ElementId)</programlisting>
|
---|
4315 |
|
---|
4316 | <para>Returns an element, which is referenced by the given
|
---|
4317 | ElementId. This function will try to resolve any element, even if
|
---|
4318 | it is not a Flash movie.</para>
|
---|
4319 | </listitem>
|
---|
4320 | </itemizedlist></para>
|
---|
4321 | </sect3>
|
---|
4322 |
|
---|
4323 | <sect3>
|
---|
4324 | <title>Flash methods callable from JavaScript</title>
|
---|
4325 |
|
---|
4326 | <para>The <computeroutput>RDPWebClienUI.swf</computeroutput> methods can
|
---|
4327 | be called directly from JavaScript code on an HTML page:</para>
|
---|
4328 |
|
---|
4329 | <itemizedlist>
|
---|
4330 | <listitem>
|
---|
4331 | <para>getProperty(Name)</para>
|
---|
4332 | </listitem>
|
---|
4333 |
|
---|
4334 | <listitem>
|
---|
4335 | <para>setProperty(Name)</para>
|
---|
4336 | </listitem>
|
---|
4337 |
|
---|
4338 | <listitem>
|
---|
4339 | <para>connect()</para>
|
---|
4340 | </listitem>
|
---|
4341 |
|
---|
4342 | <listitem>
|
---|
4343 | <para>disconnect()</para>
|
---|
4344 | </listitem>
|
---|
4345 |
|
---|
4346 | <listitem>
|
---|
4347 | <para>keyboardSendCAD()</para>
|
---|
4348 | </listitem>
|
---|
4349 | </itemizedlist>
|
---|
4350 | </sect3>
|
---|
4351 |
|
---|
4352 | <sect3>
|
---|
4353 | <title>Flash JavaScript callbacks</title>
|
---|
4354 |
|
---|
4355 | <para><computeroutput>RDPWebClienUI.swf</computeroutput> calls
|
---|
4356 | JavaScript functions provided by the HTML page.</para>
|
---|
4357 | </sect3>
|
---|
4358 | </sect2>
|
---|
4359 |
|
---|
4360 | <sect2>
|
---|
4361 | <title>Embedding RDPWeb in an HTML page</title>
|
---|
4362 |
|
---|
4363 | <para>It is necessary to include the
|
---|
4364 | <computeroutput>webclient.js</computeroutput> helper script. If
|
---|
4365 | the SWFObject library is used, the
|
---|
4366 | <computeroutput>swfobject.js</computeroutput> must also be included.
|
---|
4367 | Using the SWFObject library allows RDPWeb flash content to be embedded in
|
---|
4368 | a Web page using dynamic HTML. The HTML must include a "placeholder",
|
---|
4369 | which consists of 2 <computeroutput>div</computeroutput> elements.</para>
|
---|
4370 | </sect2>
|
---|
4371 | </sect1>
|
---|
4372 |
|
---|
4373 | <sect1>
|
---|
4374 | <title>RDPWeb change log</title>
|
---|
4375 |
|
---|
4376 | <sect2>
|
---|
4377 | <title>Version 1.2.28</title>
|
---|
4378 |
|
---|
4379 | <itemizedlist>
|
---|
4380 | <listitem>
|
---|
4381 | <para><computeroutput>keyboardLayout</computeroutput>,
|
---|
4382 | <computeroutput>keyboardLayouts</computeroutput>,
|
---|
4383 | <computeroutput>UUID</computeroutput> properties.</para>
|
---|
4384 | </listitem>
|
---|
4385 |
|
---|
4386 | <listitem>
|
---|
4387 | <para>Support for German keyboard layout on the client.</para>
|
---|
4388 | </listitem>
|
---|
4389 |
|
---|
4390 | <listitem>
|
---|
4391 | <para>Rebranding to Oracle.</para>
|
---|
4392 | </listitem>
|
---|
4393 | </itemizedlist>
|
---|
4394 | </sect2>
|
---|
4395 |
|
---|
4396 | <sect2>
|
---|
4397 | <title>Version 1.1.26</title>
|
---|
4398 |
|
---|
4399 | <itemizedlist>
|
---|
4400 | <listitem>
|
---|
4401 | <para><computeroutput>webclient.js</computeroutput> is a part of
|
---|
4402 | the distribution package.</para>
|
---|
4403 | </listitem>
|
---|
4404 |
|
---|
4405 | <listitem>
|
---|
4406 | <para><computeroutput>lastError</computeroutput> property.</para>
|
---|
4407 | </listitem>
|
---|
4408 |
|
---|
4409 | <listitem>
|
---|
4410 | <para><computeroutput>keyboardSendScancodes</computeroutput> and
|
---|
4411 | <computeroutput>keyboardSendCAD</computeroutput> methods.</para>
|
---|
4412 | </listitem>
|
---|
4413 | </itemizedlist>
|
---|
4414 | </sect2>
|
---|
4415 |
|
---|
4416 | <sect2>
|
---|
4417 | <title>Version 1.0.24</title>
|
---|
4418 |
|
---|
4419 | <itemizedlist>
|
---|
4420 | <listitem>
|
---|
4421 | <para>Initial release.</para>
|
---|
4422 | </listitem>
|
---|
4423 | </itemizedlist>
|
---|
4424 | </sect2>
|
---|
4425 | </sect1>
|
---|
4426 | </chapter>
|
---|
4427 |
|
---|
4428 | <chapter id="dnd">
|
---|
4429 | <title>Drag and Drop</title>
|
---|
4430 |
|
---|
4431 | <para>As of VirtualBox 4.2 it's possible to transfer files from the host to
|
---|
4432 | Linux, Solaris, and macOS guests by dragging files, directories, or text
|
---|
4433 | from the host into the guest's screen. This is called <emphasis>drag and drop
|
---|
4434 | (DnD)</emphasis>.</para>
|
---|
4435 |
|
---|
4436 | <para>VirtualBox 5.0 added support for Windows guests as well as the ability
|
---|
4437 | to transfer data in the opposite direction, that is, from the guest to the
|
---|
4438 | host.</para>
|
---|
4439 |
|
---|
4440 | <note><para>Currently only the VirtualBox Manager front-end supports drag and
|
---|
4441 | drop.</para></note>
|
---|
4442 |
|
---|
4443 | <para>This chapter will show how to use the required interfaces provided
|
---|
4444 | by VirtualBox for adding drag and drop functionality to third-party
|
---|
4445 | front-ends.</para>
|
---|
4446 |
|
---|
4447 | <sect1>
|
---|
4448 | <title>Basic concepts</title>
|
---|
4449 |
|
---|
4450 | <para>In order to use the interfaces provided by VirtualBox, some basic
|
---|
4451 | concepts need to be understood first: a drag and drop operation logically
|
---|
4452 | contains both a <emphasis>source</emphasis> and a
|
---|
4453 | <emphasis>target</emphasis>:</para>
|
---|
4454 |
|
---|
4455 | <para>The <emphasis>source</emphasis> provides the data, i.e., it is the
|
---|
4456 | origin of data. This data can be stored within the source directly or it can
|
---|
4457 | be retrieved on-demand by the source itself.</para>
|
---|
4458 |
|
---|
4459 | <para>The <emphasis>target</emphasis> on the other hand provides a visual
|
---|
4460 | representation to the source where the user can drop the data the source
|
---|
4461 | offers. This representation can be a window (or just a certain part of
|
---|
4462 | it), for example.</para>
|
---|
4463 |
|
---|
4464 | <para>The source and the target have abstract interfaces called
|
---|
4465 | <link linkend="IDnDSource">IDnDSource</link> and
|
---|
4466 | <link linkend="IDnDTarget">IDnDTarget</link>. VirtualBox also
|
---|
4467 | provides implementations of both interfaces, called
|
---|
4468 | <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
|
---|
4469 | <link linkend="IGuestDnDTarget">IGuestDnDTarget</link>. Both
|
---|
4470 | implementations are used in the VirtualBox Manager front-end.</para>
|
---|
4471 | </sect1>
|
---|
4472 |
|
---|
4473 | <sect1>
|
---|
4474 | <title>Supported formats</title>
|
---|
4475 |
|
---|
4476 | <para>As the target needs to perform specific actions depending on the
|
---|
4477 | data the source provided, the target first needs to know what type of
|
---|
4478 | data it is actually going to retrieve. It might be that the source offers
|
---|
4479 | data the target cannot (or intentionally does not want to)
|
---|
4480 | support.</para>
|
---|
4481 |
|
---|
4482 | <para>VirtualBox describes the data types using
|
---|
4483 | <emphasis>MIME types</emphasis> -- which were originally defined in
|
---|
4484 | <ulink url="https://tools.ietf.org/html/rfc2046">RFC 2046</ulink> and
|
---|
4485 | are also called <emphasis>Content-types</emphasis> or
|
---|
4486 | <emphasis>media types</emphasis>.
|
---|
4487 | <link linkend="IGuestDnDSource">IGuestDnDSource</link> and
|
---|
4488 | <link linkend="IGuestDnDTarget">IGuestDnDTarget</link> support
|
---|
4489 | the following MIME types by default:<itemizedlist>
|
---|
4490 | <listitem>
|
---|
4491 | <para><emphasis role="bold">text/uri-list</emphasis> - A list of
|
---|
4492 | URIs (Uniform Resource Identifier, see
|
---|
4493 | <ulink url="https://tools.ietf.org/html/rfc3986">RFC 3986</ulink>)
|
---|
4494 | pointing to the file and/or directory paths already transferred
|
---|
4495 | from the source to the target.</para>
|
---|
4496 | </listitem>
|
---|
4497 | <listitem>
|
---|
4498 | <para><emphasis role="bold">text/plain;charset=utf-8</emphasis> and
|
---|
4499 | <emphasis role="bold">UTF8_STRING</emphasis> - text in UTF-8
|
---|
4500 | format.</para>
|
---|
4501 | </listitem>
|
---|
4502 | <listitem>
|
---|
4503 | <para><emphasis role="bold">text/plain, TEXT</emphasis>
|
---|
4504 | and <emphasis role="bold">STRING</emphasis> - plain ASCII text,
|
---|
4505 | depending on the source's active ANSI page (if any).</para>
|
---|
4506 | </listitem>
|
---|
4507 | </itemizedlist>
|
---|
4508 | </para>
|
---|
4509 |
|
---|
4510 | <para>If, for whatever reason, a certain default format should not be
|
---|
4511 | supported or a new format should be registered,
|
---|
4512 | <link linkend="IDnDSource">IDnDSource</link> and
|
---|
4513 | <link linkend="IDnDTarget">IDnDTarget</link> have methods derived from
|
---|
4514 | <link linkend="IDnDBase">IDnDBase</link> which provide adding,
|
---|
4515 | removing and enumerating specific formats.
|
---|
4516 | <note><para>Registering new or removing default formats on the guest side
|
---|
4517 | is not currently implemented.</para></note></para>
|
---|
4518 | </sect1>
|
---|
4519 |
|
---|
4520 | </chapter>
|
---|
4521 |
|
---|
4522 | <chapter id="vbox-auth">
|
---|
4523 | <title>VirtualBox external authentication modules</title>
|
---|
4524 |
|
---|
4525 | <para>VirtualBox supports arbitrary external modules to perform
|
---|
4526 | authentication. External authentication modules are used for remote
|
---|
4527 | desktop access to a VM when the VRDE authentication type is set to
|
---|
4528 | "external". VRDE authentication will then use the authentication module
|
---|
4529 | which was specified with
|
---|
4530 | <computeroutput>VBoxManage setproperty vrdeauthlibrary</computeroutput>.
|
---|
4531 | The web service will use the external authentication module specified with
|
---|
4532 | <computeroutput>VBoxManage setproperty websrvauthlibrary</computeroutput>.
|
---|
4533 | </para>
|
---|
4534 |
|
---|
4535 | <para>This library will be loaded by the VM or web service process on
|
---|
4536 | demand, i.e. when the first remote desktop connection is made by a client
|
---|
4537 | or when a client that wants to use the web service logs on.</para>
|
---|
4538 |
|
---|
4539 | <para>External authentication is the most flexible authentication type
|
---|
4540 | since the external handler can choose to both grant access to everyone
|
---|
4541 | (like the "null" authentication method) as well as delegate the request to
|
---|
4542 | the guest authentication component. When delegating the request to the guest
|
---|
4543 | component the external handler will still be called afterwards with the
|
---|
4544 | option to override the result.</para>
|
---|
4545 |
|
---|
4546 | <para>An authentication library is required to implement exactly one entry
|
---|
4547 | point:</para>
|
---|
4548 |
|
---|
4549 | <screen>#include "VBoxAuth.h"
|
---|
4550 |
|
---|
4551 | /**
|
---|
4552 | * Authentication library entry point.
|
---|
4553 | *
|
---|
4554 | * Parameters:
|
---|
4555 | *
|
---|
4556 | * szCaller The name of the component which calls the library (UTF8).
|
---|
4557 | * pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL.
|
---|
4558 | * guestJudgement Result of the guest authentication.
|
---|
4559 | * szUser User name passed in by the client (UTF8).
|
---|
4560 | * szPassword Password passed in by the client (UTF8).
|
---|
4561 | * szDomain Domain passed in by the client (UTF8).
|
---|
4562 | * fLogon Boolean flag. Indicates whether the entry point is called
|
---|
4563 | * for a client logon or the client disconnect.
|
---|
4564 | * clientId Server side unique identifier of the client.
|
---|
4565 | *
|
---|
4566 | * Return code:
|
---|
4567 | *
|
---|
4568 | * AuthResultAccessDenied Client access has been denied.
|
---|
4569 | * AuthResultAccessGranted Client has the right to use the
|
---|
4570 | * virtual machine.
|
---|
4571 | * AuthResultDelegateToGuest Guest operating system must
|
---|
4572 | * authenticate the client and the
|
---|
4573 | * library must be called again with
|
---|
4574 | * the result of the guest
|
---|
4575 | * authentication.
|
---|
4576 | *
|
---|
4577 | * Note: When 'fLogon' is 0, only pszCaller, pUuid and clientId are valid and the return
|
---|
4578 | * code is ignored.
|
---|
4579 | */
|
---|
4580 | AuthResult AUTHCALL AuthEntry(
|
---|
4581 | const char *szCaller,
|
---|
4582 | PAUTHUUID pUuid,
|
---|
4583 | AuthGuestJudgement guestJudgement,
|
---|
4584 | const char *szUser,
|
---|
4585 | const char *szPassword
|
---|
4586 | const char *szDomain
|
---|
4587 | int fLogon,
|
---|
4588 | unsigned clientId)
|
---|
4589 | {
|
---|
4590 | /* Process request against your authentication source of choice. */
|
---|
4591 | // if (authSucceeded(...))
|
---|
4592 | // return AuthResultAccessGranted;
|
---|
4593 | return AuthResultAccessDenied;
|
---|
4594 | }</screen>
|
---|
4595 |
|
---|
4596 | <para>A note regarding the UUID implementation of the
|
---|
4597 | <computeroutput>pUuid</computeroutput> argument: VirtualBox uses a
|
---|
4598 | consistent binary representation of UUIDs on all platforms. For this
|
---|
4599 | reason the integer fields comprising the UUID are stored as little endian
|
---|
4600 | values. If you want to pass such UUIDs to code which assumes that
|
---|
4601 | integer fields are big endian (often also called network byte order), you
|
---|
4602 | need to adjust the contents of the UUID to achieve the same string
|
---|
4603 | representation. The required changes are:<itemizedlist>
|
---|
4604 | <listitem>
|
---|
4605 | <para>reverse the order of bytes 0, 1, 2 and 3</para>
|
---|
4606 | </listitem>
|
---|
4607 |
|
---|
4608 | <listitem>
|
---|
4609 | <para>reverse the order of bytes 4 and 5</para>
|
---|
4610 | </listitem>
|
---|
4611 |
|
---|
4612 | <listitem>
|
---|
4613 | <para>reverse the order of bytes 6 and 7.</para>
|
---|
4614 | </listitem>
|
---|
4615 | </itemizedlist>Using this conversion you will get identical results when
|
---|
4616 | converting the binary UUID to the string representation.</para>
|
---|
4617 |
|
---|
4618 | <para>The <computeroutput>guestJudgement</computeroutput> argument
|
---|
4619 | contains information about the guest authentication status. For the first
|
---|
4620 | call, it is always set to
|
---|
4621 | <computeroutput>AuthGuestNotAsked</computeroutput>. If the
|
---|
4622 | <computeroutput>AuthEntry</computeroutput> function returns
|
---|
4623 | <computeroutput>AuthResultDelegateToGuest</computeroutput>, a guest
|
---|
4624 | authentication will be attempted and another call to the
|
---|
4625 | <computeroutput>AuthEntry</computeroutput> is made with its result. The
|
---|
4626 | guest authentication can return either granted, denied, or no judgement
|
---|
4627 | (the guest component chose for whatever reason to not make a decision).
|
---|
4628 | In case there is a problem with the guest authentication module (e.g. the
|
---|
4629 | Guest Additions are not installed or not running or the guest did not
|
---|
4630 | respond within a timeout), the "not reacted" status will be returned.</para>
|
---|
4631 | </chapter>
|
---|
4632 |
|
---|
4633 | <chapter id="javaapi">
|
---|
4634 | <title>Using the Java API</title>
|
---|
4635 |
|
---|
4636 | <sect1>
|
---|
4637 | <title>Introduction</title>
|
---|
4638 |
|
---|
4639 | <para>VirtualBox can be controlled by a Java API, both locally using
|
---|
4640 | COM/XPCOM and remotely using SOAP. As with the Python bindings,
|
---|
4641 | a generic glue layer tries to hide all platform differences, allowing
|
---|
4642 | for source and binary compatibility on different platforms.</para>
|
---|
4643 | </sect1>
|
---|
4644 |
|
---|
4645 | <sect1>
|
---|
4646 | <title>Requirements</title>
|
---|
4647 |
|
---|
4648 | <para>To use the Java bindings, there are certain requirements depending
|
---|
4649 | on the platform. First of all, you need JDK 1.5 (Java 5) or later. Also
|
---|
4650 | please make sure that the version of the VirtualBox API .jar file
|
---|
4651 | exactly matches the version of VirtualBox in use. To avoid confusion,
|
---|
4652 | the VirtualBox API provides versioning in the Java package name, e.g.
|
---|
4653 | the package is named <computeroutput>org.virtualbox_3_2</computeroutput>
|
---|
4654 | for VirtualBox version 3.2. <itemizedlist>
|
---|
4655 | <listitem>
|
---|
4656 | <para><emphasis role="bold">XPCOM</emphasis> - for all platforms
|
---|
4657 | except Microsoft Windows. A Java bridge based on JavaXPCOM is shipped
|
---|
4658 | with VirtualBox. The classpath must contain
|
---|
4659 | <computeroutput>vboxjxpcom.jar</computeroutput> and the
|
---|
4660 | <computeroutput>vbox.home</computeroutput> property must be set to the
|
---|
4661 | location where the VirtualBox binaries are. Please make sure that
|
---|
4662 | the JVM bitness matches the bitness of VirtualBox in use as the XPCOM
|
---|
4663 | bridge relies on native libraries.</para>
|
---|
4664 |
|
---|
4665 | <para>Start your application like this: <programlisting>
|
---|
4666 | java -cp vboxjxpcom.jar -Dvbox.home=/opt/virtualbox MyProgram
|
---|
4667 | </programlisting></para>
|
---|
4668 | </listitem>
|
---|
4669 |
|
---|
4670 | <listitem>
|
---|
4671 | <para><emphasis role="bold">COM</emphasis> - for Microsoft
|
---|
4672 | Windows. We rely on <computeroutput>Jacob</computeroutput> - a
|
---|
4673 | generic Java to COM bridge - which has to be installed separately.
|
---|
4674 | See <ulink
|
---|
4675 | url="http://sourceforge.net/projects/jacob-project/">http://sourceforge.net/projects/jacob-project/</ulink>
|
---|
4676 | for installation instructions. Also, the VirtualBox provided
|
---|
4677 | <computeroutput>vboxjmscom.jar</computeroutput> file must be in the
|
---|
4678 | class path.</para>
|
---|
4679 |
|
---|
4680 | <para>Start your application like this:
|
---|
4681 | <programlisting>java -cp vboxjmscom.jar;c:\jacob\jacob.jar -Djava.library.path=c:\jacob MyProgram</programlisting></para>
|
---|
4682 | </listitem>
|
---|
4683 |
|
---|
4684 | <listitem>
|
---|
4685 | <para><emphasis role="bold">SOAP</emphasis> - all platforms. Java
|
---|
4686 | 6 is required as it comes with built-in support for SOAP via the
|
---|
4687 | JAX-WS library. Also, the VirtualBox provided
|
---|
4688 | <computeroutput>vbojws.jar</computeroutput> must be in the class
|
---|
4689 | path. In the SOAP case it's possible to create several
|
---|
4690 | VirtualBoxManager instances to communicate with multiple
|
---|
4691 | VirtualBox hosts.</para>
|
---|
4692 |
|
---|
4693 | <para>Start your application like this: <programlisting>
|
---|
4694 | java -cp vboxjws.jar MyProgram
|
---|
4695 | </programlisting></para>
|
---|
4696 | </listitem>
|
---|
4697 | </itemizedlist></para>
|
---|
4698 |
|
---|
4699 | <para>Exception handling is also generalized by the generic glue layer,
|
---|
4700 | so that all methods can throw
|
---|
4701 | <computeroutput>VBoxException</computeroutput> containing a human-readable
|
---|
4702 | text message (see <computeroutput>getMessage()</computeroutput> method)
|
---|
4703 | along with the wrapped original exception (see
|
---|
4704 | <computeroutput>getWrapped()</computeroutput> method).</para>
|
---|
4705 | </sect1>
|
---|
4706 |
|
---|
4707 | <sect1>
|
---|
4708 | <title>Example</title>
|
---|
4709 |
|
---|
4710 | <para>This example shows a simple use case of the Java API. Differences
|
---|
4711 | for SOAP vs. local execution are minimal and limited to the connection
|
---|
4712 | setup phase (see <computeroutput>ws</computeroutput> variable). In the
|
---|
4713 | SOAP case it's possible to create several VirtualBoxManager instances to
|
---|
4714 | communicate with multiple VirtualBox hosts. <programlisting>
|
---|
4715 | import org.virtualbox_4_3.*;
|
---|
4716 | ....
|
---|
4717 | VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
|
---|
4718 | boolean ws = false; // or true, if we need the SOAP version
|
---|
4719 | if (ws)
|
---|
4720 | {
|
---|
4721 | String url = "http://myhost:18034";
|
---|
4722 | String user = "test";
|
---|
4723 | String passwd = "test";
|
---|
4724 | mgr.connect(url, user, passwd);
|
---|
4725 | }
|
---|
4726 | IVirtualBox vbox = mgr.getVBox();
|
---|
4727 | System.out.println("VirtualBox version: " + vbox.getVersion() + "\n");
|
---|
4728 | // get first VM name
|
---|
4729 | String m = vbox.getMachines().get(0).getName();
|
---|
4730 | System.out.println("\nAttempting to start VM '" + m + "'");
|
---|
4731 | // start it
|
---|
4732 | mgr.startVm(m, null, 7000);
|
---|
4733 |
|
---|
4734 | if (ws)
|
---|
4735 | mgr.disconnect();
|
---|
4736 |
|
---|
4737 | mgr.cleanup();
|
---|
4738 | </programlisting> For a more complete example, see
|
---|
4739 | <computeroutput>TestVBox.java</computeroutput>, shipped with the
|
---|
4740 | SDK. It contains exception handling and error printing code which
|
---|
4741 | is important for reliable larger scale projects.</para>
|
---|
4742 |
|
---|
4743 | <para>It is good practice in long-running API clients to process the
|
---|
4744 | system events every now and then in the main thread (this does not work
|
---|
4745 | in other threads). As a rule of thumb it makes sense to process them
|
---|
4746 | every few 100msec to every few seconds). This is done by
|
---|
4747 | calling<programlisting>
|
---|
4748 | mgr.waitForEvents(0);
|
---|
4749 | </programlisting>
|
---|
4750 | This helps prevent a large number of system events from accumulating which
|
---|
4751 | can need a significant amount of memory, and as they also play a role in
|
---|
4752 | object cleanup it helps freeing additional memory in a timely manner
|
---|
4753 | which is used by the API implementation itself. Java's garbage collection
|
---|
4754 | approach already needs more memory due to the delayed freeing of memory
|
---|
4755 | used by no longer accessible objects and not processing the system
|
---|
4756 | events exacerbates the memory usage. The
|
---|
4757 | <computeroutput>TestVBox.java</computeroutput> example code sprinkles
|
---|
4758 | such lines over the code to achieve the desired effect. In multi-threaded
|
---|
4759 | applications it can be called from the main thread periodically.
|
---|
4760 | Sometimes it's possible to use the non-zero timeout variant of the
|
---|
4761 | method, which then waits the specified number of milliseconds for
|
---|
4762 | events, processing them immediately as they arrive. It achieves better
|
---|
4763 | runtime behavior than separate sleeping/processing.</para>
|
---|
4764 | </sect1>
|
---|
4765 | </chapter>
|
---|
4766 |
|
---|
4767 | <chapter>
|
---|
4768 | <title>License information</title>
|
---|
4769 |
|
---|
4770 | <para>The sample code files shipped with the SDK are generally licensed
|
---|
4771 | liberally to make it easy for anyone to use this code for their own
|
---|
4772 | application code.</para>
|
---|
4773 |
|
---|
4774 | <para>The Java files under
|
---|
4775 | <computeroutput>sdk/bindings/webservice/java/jax-ws/</computeroutput> (library
|
---|
4776 | files for the object-oriented web service) are, by contrast, licensed
|
---|
4777 | under the GNU Lesser General Public License (LGPL) V2.1.</para>
|
---|
4778 |
|
---|
4779 | <para>See
|
---|
4780 | <computeroutput>sdk/bindings/webservice/java/jax-ws/src/COPYING.LIB</computeroutput>
|
---|
4781 | for the full text of the LGPL 2.1.</para>
|
---|
4782 |
|
---|
4783 | <para>When in doubt, please refer to the individual source code files
|
---|
4784 | shipped with this SDK.</para>
|
---|
4785 | </chapter>
|
---|
4786 |
|
---|
4787 | <chapter>
|
---|
4788 | <title>Main API change log</title>
|
---|
4789 |
|
---|
4790 | <para>Generally, VirtualBox will maintain API compatibility within a major
|
---|
4791 | release; a major release occurs when the first or the second of the three
|
---|
4792 | version components of VirtualBox change (that is, in the x.y.z scheme, a
|
---|
4793 | major release is one where x or y change, but not when only z
|
---|
4794 | changes).</para>
|
---|
4795 |
|
---|
4796 | <para>In other words, updates like those from 2.0.0 to 2.0.2 will not come
|
---|
4797 | with API breakages.</para>
|
---|
4798 |
|
---|
4799 | <para>Migration between major releases most likely will lead to API
|
---|
4800 | breakage, so please make sure you updated code accordingly. The OOWS Java
|
---|
4801 | wrappers enforce that mechanism by putting VirtualBox classes into
|
---|
4802 | version-specific packages such as
|
---|
4803 | <computeroutput>org.virtualbox_2_2</computeroutput>. This approach allows
|
---|
4804 | for connecting to multiple VirtualBox versions simultaneously from the
|
---|
4805 | same Java application.</para>
|
---|
4806 |
|
---|
4807 | <para>The following sections list incompatible changes that the Main API
|
---|
4808 | underwent since the original release of this SDK Reference with VirtualBox
|
---|
4809 | 2.0. A change is deemed "incompatible" only if it breaks existing client
|
---|
4810 | code (e.g. changes in method parameter lists, renamed or removed
|
---|
4811 | interfaces and similar). In other words, the list does not contain new
|
---|
4812 | interfaces, methods or attributes or other changes that do not affect
|
---|
4813 | existing client code.</para>
|
---|
4814 |
|
---|
4815 | <sect1>
|
---|
4816 | <title>Incompatible API changes with version 7.1</title>
|
---|
4817 |
|
---|
4818 | <itemizedlist>
|
---|
4819 |
|
---|
4820 | <listitem><para>Review the Main API changes made for the ARM64 CPU architecture <link linkend="vboxarm">here</link>
|
---|
4821 | for incompatible changes to interfaces, methods, and attributes.</para>
|
---|
4822 | </listitem>
|
---|
4823 |
|
---|
4824 | <listitem><para>The Python API bindings for Python 2.x is now marked as being deprecated and will
|
---|
4825 | be removed in a future version. Please upgrade your code to use Python 3.</para>
|
---|
4826 | </listitem>
|
---|
4827 |
|
---|
4828 | <listitem><para>The Python API bindings now live in a separate <computeroutput>python</computeroutput>
|
---|
4829 | sub directory and also now support installing via the pip package manager
|
---|
4830 | (e.g. <computeroutput>pip -v install ./vboxapi</computeroutput>). This also allows installing into
|
---|
4831 | Python virtual environments.</para>
|
---|
4832 | </listitem>
|
---|
4833 |
|
---|
4834 | <listitem><para>The Windows host installer now uses the sub directory <computeroutput>installer</computeroutput>
|
---|
4835 | instead of <computeroutput>install</computeroutput> for housing the bindings installers. This now matches
|
---|
4836 | the directory layout for the other platforms. Please adapt your scripts if needed.</para>
|
---|
4837 | </listitem>
|
---|
4838 |
|
---|
4839 | <listitem><para>Guest process creation requires a new parameter for specifying the current working directory for the new
|
---|
4840 | guest process. This is optional and can be empty.
|
---|
4841 | See <link linkend="IGuestSession__processCreate">IGuestSession::processCreate</link> and
|
---|
4842 | <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx</link> for more information.</para>
|
---|
4843 | </listitem>
|
---|
4844 |
|
---|
4845 | <listitem><para>The APIs <link linkend="IGuestSession__fsQueryInfo">IGuestSession::fsQueryInfo</link> and
|
---|
4846 | <link linkend="IGuestSession__fsQueryFreeSpace">IGuestSession::fsQueryFreeSpace</link> are now implemented.
|
---|
4847 | See <link linkend="IGuestSession__fsQueryInfo">IGuestSession::fsQueryInfo</link> and
|
---|
4848 | <link linkend="IGuestSession__fsQueryFreeSpace">IGuestSession::fsQueryFreeSpace</link> for more information.</para>
|
---|
4849 | </listitem>
|
---|
4850 |
|
---|
4851 | <listitem><para>The APIs <link linkend="IGuestSession__waitFor">IGuestSession::waitFor</link> and
|
---|
4852 | <link linkend="IProcess__waitFor">IProcess::waitFor</link> are now marked
|
---|
4853 | as being deprecated. Use <link linkend="IGuestSession__waitForArray">IGuestSession::waitForArray</link>
|
---|
4854 | and <link linkend="IProcess__waitForArray">IProcess::waitForArray</link> instead.</para>
|
---|
4855 | </listitem>
|
---|
4856 |
|
---|
4857 | <listitem><para>The attribute <link linkend="IGuestSession__mountPoints">IGuestSession::mountPoints</link> has been
|
---|
4858 | added. This requires 7.1 (or newer) Guest Additions to be installed on the guest.</para>
|
---|
4859 | </listitem>
|
---|
4860 |
|
---|
4861 | <listitem><para>The attribute IHost::acceleration3DAvailable has been removed. Use
|
---|
4862 | <link linkend="ISystemProperties__supportedGraphicsFeatures">ISystempProperties::supportedGraphicsFeatures</link>
|
---|
4863 | instead.</para>
|
---|
4864 | </listitem>
|
---|
4865 |
|
---|
4866 | <listitem><para>Starting a recording now has to be done via the newly introduced method
|
---|
4867 | <link linkend="IRecordingSettings__start">IRecordingSettings::start</link>. This method also will return
|
---|
4868 | a recording progress object on success, which also can be retrieved at a later time via the new attribute
|
---|
4869 | <link linkend="IRecordingSettings__progress">IRecordingSettings::progress</link>.</para>
|
---|
4870 | </listitem>
|
---|
4871 |
|
---|
4872 | <listitem><para>The recording settings attribute
|
---|
4873 | <link linkend="IRecordingSettings__enabled">IRecordingSettings::enabled</link> does not implicitly start or stop
|
---|
4874 | a recording anymore, but only will indicate that recording for a VM is enabled or disabled.
|
---|
4875 | This attribute also will be used to determine if recording will be started automatically on VM start or restore.</para>
|
---|
4876 | </listitem>
|
---|
4877 |
|
---|
4878 | <listitem><para>The recording settings now expose a progress object attribute via
|
---|
4879 | <link linkend="IRecordingSettings__progress">IRecordingSettings::progress</link>, which can be used to stop an
|
---|
4880 | ongoing recording, track the recording progress or getting notified of recording errors.</para>
|
---|
4881 | </listitem>
|
---|
4882 |
|
---|
4883 | </itemizedlist>
|
---|
4884 | </sect1>
|
---|
4885 |
|
---|
4886 | <sect1>
|
---|
4887 | <title>Incompatible API changes with version 7.0</title>
|
---|
4888 |
|
---|
4889 | <itemizedlist>
|
---|
4890 |
|
---|
4891 | <listitem><para>The machine's audio adapter has been moved into the new IAudioSettings interface, which in turn
|
---|
4892 | takes care of of all audio settings of a virtual machine.
|
---|
4893 | See <link linkend="IMachine__audioSettings">IMachine::audioSettings</link> and
|
---|
4894 | <link linkend="IAudioSettings">IAudioSettings</link> for more information.</para>
|
---|
4895 | </listitem>
|
---|
4896 |
|
---|
4897 | <listitem><para>The <link linkend="IVirtualBox__openMachine">IVirtualBox::openMachine</link> call now
|
---|
4898 | requires an additional password parameter. If the machine is not encrypted the parameter is ignored.</para>
|
---|
4899 | </listitem>
|
---|
4900 |
|
---|
4901 | <listitem><para>When a new VM is being created, the default audio driver will be now
|
---|
4902 | <link linkend="AudioDriverType__Default">AudioDriverType_Default</link>. This driver
|
---|
4903 | type will automatically choose the best audio driver (backend) for the host OS &VBOX_PRODUCT;
|
---|
4904 | currently is running on.</para>
|
---|
4905 | </listitem>
|
---|
4906 |
|
---|
4907 | <listitem><para>The host update functionality at IHost::update has been refactored into
|
---|
4908 | <link linkend="IHost__updateHost">IHost::updateHost</link>, which in turn uses the new
|
---|
4909 | <link linkend="IHostUpdateAgent">IHostUpdateAgent</link> interface, derived from the new
|
---|
4910 | <link linkend="IUpdateAgent">IUpdateAgent</link> interface.</para>
|
---|
4911 | </listitem>
|
---|
4912 |
|
---|
4913 | <listitem><para><link linkend="IGuestSession__directoryCopyFromGuest">IGuestSession::directoryCopyFromGuest()</link> and
|
---|
4914 | <link linkend="IGuestSession__directoryCopyToGuest">IGuestSession::directoryCopyToGuest()</link> no longer implicitly
|
---|
4915 | copy recursively and follow symbolic links -- for this to continue working, the newly introduced flags
|
---|
4916 | <link linkend="DirectoryCopyFlag__Recursive">DirectoryCopyFlag::Recursive</link> and/or
|
---|
4917 | <link linkend="DirectoryCopyFlag__FollowLinks">DirectoryCopyFlag::FollowLinks</link> have to be used.</para>
|
---|
4918 | </listitem>
|
---|
4919 |
|
---|
4920 | <listitem><para>VBoxEventType_Last has been renamed to <link linkend="VBoxEventType__End">VBoxEventType_End</link>
|
---|
4921 | for consistency.</para></listitem>
|
---|
4922 |
|
---|
4923 | </itemizedlist>
|
---|
4924 |
|
---|
4925 | </sect1>
|
---|
4926 |
|
---|
4927 | <sect1>
|
---|
4928 | <title>Incompatible API changes with version 6.1</title>
|
---|
4929 |
|
---|
4930 | <itemizedlist>
|
---|
4931 |
|
---|
4932 | <listitem><para>Split off the graphics adapter part of
|
---|
4933 | <link linkend="IMachine">IMachine</link> into
|
---|
4934 | <link linkend="IGraphicsAdapter">IGraphicsAdapter</link>.
|
---|
4935 | This moved 5 attributes.</para>
|
---|
4936 | </listitem>
|
---|
4937 |
|
---|
4938 | </itemizedlist>
|
---|
4939 |
|
---|
4940 | </sect1>
|
---|
4941 |
|
---|
4942 | <sect1>
|
---|
4943 | <title>Incompatible API changes with version 6.0</title>
|
---|
4944 |
|
---|
4945 | <itemizedlist>
|
---|
4946 |
|
---|
4947 | <listitem><para>Video recording APIs were changed as follows:
|
---|
4948 | <itemizedlist>
|
---|
4949 | <listitem><para>All attributes which were living in <link linkend="IMachine">IMachine</link> before
|
---|
4950 | have been moved to an own, dedicated interface named <link linkend="IRecordingSettings">IRecordingSettings</link>.
|
---|
4951 | This new interface can be accessed via the new <link linkend="IMachine__recordingSettings">IMachine::recordingSettings</link>
|
---|
4952 | attribute. This should emphasize that recording is not limited to video capturing as such.</para>
|
---|
4953 | </listitem>
|
---|
4954 |
|
---|
4955 | <listitem><para>For further flexibility all specific per-VM-screen settings have been moved to a new interface
|
---|
4956 | called <link linkend="IRecordingScreenSettings">IRecordingScreenSettings</link>. Such settings now exist per configured
|
---|
4957 | VM display and can be retrieved via the <link linkend="IRecordingSettings__screens">IRecordingSettings::screens</link>
|
---|
4958 | attribute or the <link linkend="IRecordingSettings__getScreenSettings">IRecordingSettings::getScreenSettings</link>
|
---|
4959 | method.
|
---|
4960 | <note><para>For now all screen settings will share the same settings, e.g. different settings on a per-screen basis
|
---|
4961 | is not implemented yet.</para></note>
|
---|
4962 | </para>
|
---|
4963 | </listitem>
|
---|
4964 |
|
---|
4965 | <listitem><para>The event <computeroutput>IVideoCaptureChangedEvent</computeroutput> was renamed into
|
---|
4966 | <computeroutput>IRecordingChangedEvent</computeroutput>.</para>
|
---|
4967 | </listitem>
|
---|
4968 |
|
---|
4969 | </itemizedlist>
|
---|
4970 | </para></listitem>
|
---|
4971 |
|
---|
4972 | <listitem><para>Guest Control APIs were changed as follows:
|
---|
4973 | <itemizedlist>
|
---|
4974 | <listitem><para><link linkend="IGuest__createSession">IGuest::createSession()</link>,
|
---|
4975 | <link linkend="IGuestSession__processCreate">IGuestSession::processCreate()</link>,
|
---|
4976 | <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx()</link>,
|
---|
4977 | <link linkend="IGuestSession__directoryOpen">IGuestSession::directoryOpen()</link> and
|
---|
4978 | <link linkend="IGuestSession__fileOpen">IGuestSession::fileOpen()</link> now will
|
---|
4979 | return the new error code VBOX_E_MAXIMUM_REACHED if the limit for the according object
|
---|
4980 | group has been reached.</para>
|
---|
4981 | </listitem>
|
---|
4982 |
|
---|
4983 | <listitem><para>The enumerations FileOpenExFlags, FsObjMoveFlags and DirectoryCopyFlags have
|
---|
4984 | been renamed to <link linkend="FileOpenExFlag">FileOpenExFlag</link>,
|
---|
4985 | <link linkend="FsObjMoveFlag">FsObjMoveFlag</link> and <link linkend="DirectoryCopyFlag">DirectoryCopyFlag</link>
|
---|
4986 | accordingly to match the rest of the API.</para>
|
---|
4987 | </listitem>
|
---|
4988 |
|
---|
4989 | <listitem>
|
---|
4990 | <para>The following methods have been implemented:
|
---|
4991 | <computeroutput>IGuestSession::directoryCopyFromGuest()</computeroutput> and
|
---|
4992 | <computeroutput>IGuestSession::directoryCopyToGuest()</computeroutput>.
|
---|
4993 | </para>
|
---|
4994 |
|
---|
4995 | <para>The following attributes have been implemented:
|
---|
4996 | <computeroutput>IGuestFsObjInfo::accessTime</computeroutput>,
|
---|
4997 | <computeroutput>IGuestFsObjInfo::birthTime</computeroutput>,
|
---|
4998 | <computeroutput>IGuestFsObjInfo::changeTime</computeroutput> and
|
---|
4999 | <computeroutput>IGuestFsObjInfo::modificationTime</computeroutput>.
|
---|
5000 | </para>
|
---|
5001 |
|
---|
5002 | </listitem>
|
---|
5003 | </itemizedlist>
|
---|
5004 | </para></listitem>
|
---|
5005 |
|
---|
5006 | <listitem><para>The webservice version of the <link linkend="ISharedFolder">ISharedFolder</link>
|
---|
5007 | interface was changed from a struct to a managed object. This causes incompatibilities on the
|
---|
5008 | protocol level as the shared folder attributes are not returned in the responses of
|
---|
5009 | <link linkend="IVirtualBox__sharedFolders">IVirtualBox::getSharedFolders</link> and
|
---|
5010 | <link linkend="IMachine__sharedFolders">IMachine::getSharedFolders</link> anymore. They
|
---|
5011 | return object UUIDs instead which need be wrapped by stub objects. The change is not visible when
|
---|
5012 | using the appropriate client bindings from the most recent VirtualBox SDK.
|
---|
5013 | </para></listitem>
|
---|
5014 |
|
---|
5015 | </itemizedlist>
|
---|
5016 |
|
---|
5017 | </sect1>
|
---|
5018 |
|
---|
5019 | <sect1>
|
---|
5020 | <title>Incompatible API changes with version 5.x</title>
|
---|
5021 |
|
---|
5022 | <itemizedlist>
|
---|
5023 | <listitem><para>ProcessCreateFlag::NoProfile has been renamed to
|
---|
5024 | <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>,
|
---|
5025 | and the semantics have also been changed: ProcessCreateFlag::NoProfile
|
---|
5026 | explicitly <emphasis role="bold">did not</emphasis> utilize the guest user's profile data
|
---|
5027 | whereas <link linkend="ProcessCreateFlag__Profile">ProcessCreateFlag::Profile</link>
|
---|
5028 | explicitly <emphasis role="bold">does</emphasis> utilize the guest
|
---|
5029 | user’s profile data.</para>
|
---|
5030 | </listitem>
|
---|
5031 | </itemizedlist>
|
---|
5032 |
|
---|
5033 | </sect1>
|
---|
5034 |
|
---|
5035 | <sect1>
|
---|
5036 | <title>Incompatible API changes with version 5.1.28</title>
|
---|
5037 |
|
---|
5038 | <itemizedlist>
|
---|
5039 | <listitem><para>The Host-Guest Communication Manager (HGCM) guest driver
|
---|
5040 | interfaces were renamed:
|
---|
5041 | <itemizedlist>
|
---|
5042 | <listitem><para>VbglHGCMConnect() was renamed to VbglR0HGCMConnect()
|
---|
5043 | </para></listitem>
|
---|
5044 | <listitem><para>VbglHGCMDisconnect() was renamed to VbglR0HGCMDisconnect()
|
---|
5045 | </para></listitem>
|
---|
5046 | <listitem><para>VbglHGCMCall() was renamed to VbglR0HGCMCall()
|
---|
5047 | </para></listitem>
|
---|
5048 | </itemizedlist>
|
---|
5049 | </para>
|
---|
5050 | </listitem>
|
---|
5051 |
|
---|
5052 | <listitem><para>The Host-Guest Communication Manager (HGCM) guest
|
---|
5053 | application interface IOCTLs were renamed:
|
---|
5054 | <itemizedlist>
|
---|
5055 | <listitem><para>VBOXGUEST_IOCTL_HGCM_CONNECT was renamed to
|
---|
5056 | VBGL_IOCTL_HGCM_CONNECT
|
---|
5057 | </para></listitem>
|
---|
5058 | <listitem><para>VBOXGUEST_IOCTL_HGCM_DISCONNECT was renamed to
|
---|
5059 | VBGL_IOCTL_HGCM_DISCONNECT
|
---|
5060 | </para></listitem>
|
---|
5061 | <listitem><para>VBOXGUEST_IOCTL_HGCM_CALL was renamed to
|
---|
5062 | VBGL_IOCTL_HGCM_CALL
|
---|
5063 | </para></listitem>
|
---|
5064 | </itemizedlist>
|
---|
5065 | </para>
|
---|
5066 | </listitem>
|
---|
5067 |
|
---|
5068 | </itemizedlist>
|
---|
5069 |
|
---|
5070 | </sect1>
|
---|
5071 |
|
---|
5072 |
|
---|
5073 | <sect1>
|
---|
5074 | <title>Incompatible API changes with version 5.0</title>
|
---|
5075 |
|
---|
5076 | <itemizedlist>
|
---|
5077 | <listitem>
|
---|
5078 | <para>The methods for saving state, adopting a saved state file,
|
---|
5079 | discarding a saved state, taking a snapshot, restoring
|
---|
5080 | a snapshot and deleting a snapshot have been moved from
|
---|
5081 | <computeroutput>IConsole</computeroutput> to
|
---|
5082 | <computeroutput>IMachine</computeroutput>. This straightens out the
|
---|
5083 | logical placement of methods and was necessary to resolve a
|
---|
5084 | long-standing issue, preventing 32-bit API clients from invoking
|
---|
5085 | those operations in the case where no VM is running.
|
---|
5086 | <itemizedlist>
|
---|
5087 | <listitem><para><link linkend="IMachine__saveState">IMachine::saveState()</link>
|
---|
5088 | replaces
|
---|
5089 | <computeroutput>IConsole::saveState()</computeroutput></para>
|
---|
5090 | </listitem>
|
---|
5091 | <listitem>
|
---|
5092 | <para><link linkend="IMachine__adoptSavedState">IMachine::adoptSavedState()</link>
|
---|
5093 | replaces
|
---|
5094 | <computeroutput>IConsole::adoptSavedState()</computeroutput></para>
|
---|
5095 | </listitem>
|
---|
5096 | <listitem>
|
---|
5097 | <para><link linkend="IMachine__discardSavedState">IMachine::discardSavedState()</link>
|
---|
5098 | replaces
|
---|
5099 | <computeroutput>IConsole::discardSavedState()</computeroutput></para>
|
---|
5100 | </listitem>
|
---|
5101 | <listitem>
|
---|
5102 | <para><link linkend="IMachine__takeSnapshot">IMachine::takeSnapshot()</link>
|
---|
5103 | replaces
|
---|
5104 | <computeroutput>IConsole::takeSnapshot()</computeroutput></para>
|
---|
5105 | </listitem>
|
---|
5106 | <listitem>
|
---|
5107 | <para><link linkend="IMachine__deleteSnapshot">IMachine::deleteSnapshot()</link>
|
---|
5108 | replaces
|
---|
5109 | <computeroutput>IConsole::deleteSnapshot()</computeroutput></para>
|
---|
5110 | </listitem>
|
---|
5111 | <listitem>
|
---|
5112 | <para><link linkend="IMachine__deleteSnapshotAndAllChildren">IMachine::deleteSnapshotAndAllChildren()</link>
|
---|
5113 | replaces
|
---|
5114 | <computeroutput>IConsole::deleteSnapshotAndAllChildren()</computeroutput></para>
|
---|
5115 | </listitem>
|
---|
5116 | <listitem>
|
---|
5117 | <para><link linkend="IMachine__deleteSnapshotRange">IMachine::deleteSnapshotRange()</link>
|
---|
5118 | replaces
|
---|
5119 | <computeroutput>IConsole::deleteSnapshotRange()</computeroutput></para>
|
---|
5120 | </listitem>
|
---|
5121 | <listitem>
|
---|
5122 | <para><link linkend="IMachine__restoreSnapshot">IMachine::restoreSnapshot()</link>
|
---|
5123 | replaces
|
---|
5124 | <computeroutput>IConsole::restoreSnapshot()</computeroutput></para>
|
---|
5125 | </listitem>
|
---|
5126 | </itemizedlist>
|
---|
5127 | Small adjustments to the parameter lists have been made to reduce
|
---|
5128 | the number of API calls when taking online snapshots (no longer
|
---|
5129 | needs explicit pausing), and taking a snapshot also returns now
|
---|
5130 | the snapshot id (useful for finding the right snapshot if there
|
---|
5131 | are non-unique snapshot names).</para>
|
---|
5132 | </listitem>
|
---|
5133 |
|
---|
5134 | <listitem>
|
---|
5135 | <para>Two new machine states have been introduced to allow proper
|
---|
5136 | distinction between saving state and taking a snapshot.
|
---|
5137 | <link linkend="MachineState__Saving">MachineState::Saving</link>
|
---|
5138 | now is used exclusively while the VM's state is being saved, without
|
---|
5139 | any overlaps with snapshot functionality. The new state
|
---|
5140 | <link linkend="MachineState__Snapshotting">MachineState::Snapshotting</link>
|
---|
5141 | is used when an offline snapshot is taken and likewise the new state
|
---|
5142 | <link linkend="MachineState__OnlineSnapshotting">MachineState::OnlineSnapshotting</link>
|
---|
5143 | is used when an online snapshot is taken.</para>
|
---|
5144 | </listitem>
|
---|
5145 |
|
---|
5146 | <listitem>
|
---|
5147 | <para>A new event has been introduced, which signals when a snapshot
|
---|
5148 | has been restored:
|
---|
5149 | <link linkend="ISnapshotRestoredEvent">ISnapshotRestoredEvent</link>.
|
---|
5150 | Previously the event
|
---|
5151 | <link linkend="ISnapshotDeletedEvent">ISnapshotDeletedEvent</link>
|
---|
5152 | was signalled, which isn't logical (but could be distinguished from
|
---|
5153 | actual deletion by the fact that the snapshot was still
|
---|
5154 | there).</para>
|
---|
5155 | </listitem>
|
---|
5156 |
|
---|
5157 | <listitem>
|
---|
5158 | <para>The method
|
---|
5159 | <link linkend="IVirtualBox__createMedium">IVirtualBox::createMedium()</link>
|
---|
5160 | replaces
|
---|
5161 | <computeroutput>VirtualBox::createHardDisk()</computeroutput>.
|
---|
5162 | Adjusting existing code needs adding two parameters with
|
---|
5163 | value <computeroutput>AccessMode_ReadWrite</computeroutput>
|
---|
5164 | and <computeroutput>DeviceType_HardDisk</computeroutput>
|
---|
5165 | respectively. The new method supports creating floppy and
|
---|
5166 | DVD images, and (less obviously) further API functionality
|
---|
5167 | such as cloning floppy images.</para>
|
---|
5168 | </listitem>
|
---|
5169 |
|
---|
5170 | <listitem>
|
---|
5171 | <para>The method
|
---|
5172 | <link linkend="IMachine__getStorageControllerByInstance">IMachine::getStorageControllerByInstance()</link>
|
---|
5173 | now has an additional parameter (first parameter), for specifying the
|
---|
5174 | storage bus which the storage controller must be using. The method
|
---|
5175 | was not useful before, as the instance numbers are only unique for a
|
---|
5176 | specfic storage bus.</para>
|
---|
5177 | </listitem>
|
---|
5178 |
|
---|
5179 | <listitem>
|
---|
5180 | <para>The attribute
|
---|
5181 | <computeroutput>IMachine::sessionType</computeroutput> has been
|
---|
5182 | renamed to
|
---|
5183 | <link linkend="IMachine__sessionName">IMachine::sessionName()</link>.
|
---|
5184 | This cleans up the confusing terminology (as the session type is
|
---|
5185 | something different).</para>
|
---|
5186 | </listitem>
|
---|
5187 |
|
---|
5188 | <listitem>
|
---|
5189 | <para>The attribute
|
---|
5190 | <computeroutput>IMachine::guestPropertyNotificationPatterns</computeroutput>
|
---|
5191 | has been removed. In practice it was not usable because it is too
|
---|
5192 | global and didn't distinguish between API clients.</para>
|
---|
5193 | </listitem>
|
---|
5194 |
|
---|
5195 | <listitem><para>Drag and drop APIs were changed as follows:<itemizedlist>
|
---|
5196 |
|
---|
5197 | <listitem>
|
---|
5198 | <para>Methods for providing host to guest drag and drop
|
---|
5199 | functionality, such as
|
---|
5200 | <computeroutput>IGuest::dragHGEnter</computeroutput>,
|
---|
5201 | <computeroutput>IGuest::dragHGMove()</computeroutput>,
|
---|
5202 | <computeroutput>IGuest::dragHGLeave()</computeroutput>,
|
---|
5203 | <computeroutput>IGuest::dragHGDrop()</computeroutput> and
|
---|
5204 | <computeroutput>IGuest::dragHGPutData()</computeroutput>,
|
---|
5205 | have been moved to an abstract base class called
|
---|
5206 | <link linkend="IDnDTarget">IDnDTarget</link>.
|
---|
5207 | VirtualBox implements this base class in the
|
---|
5208 | <link linkend="IGuestDnDTarget">IGuestDnDTarget</link>
|
---|
5209 | interface. The implementation can be used by using the
|
---|
5210 | <link linkend="IGuest__dnDTarget">IGuest::dnDTarget()</link>
|
---|
5211 | method.</para>
|
---|
5212 | <para>Methods for providing guest to host drag and drop
|
---|
5213 | functionality, such as
|
---|
5214 | <computeroutput>IGuest::dragGHPending()</computeroutput>,
|
---|
5215 | <computeroutput>IGuest::dragGHDropped()</computeroutput> and
|
---|
5216 | <computeroutput>IGuest::dragGHGetData()</computeroutput>,
|
---|
5217 | have been moved to an abstract base class called
|
---|
5218 | <link linkend="IDnDSource">IDnDSource</link>.
|
---|
5219 | VirtualBox implements this base class in the
|
---|
5220 | <link linkend="IGuestDnDSource">IGuestDnDSource</link>
|
---|
5221 | interface. The implementation can be used by using the
|
---|
5222 | <link linkend="IGuest__dnDSource">IGuest::dnDSource()</link>
|
---|
5223 | method.</para>
|
---|
5224 | </listitem>
|
---|
5225 |
|
---|
5226 | <listitem>
|
---|
5227 | <para>The <computeroutput>DragAndDropAction</computeroutput>
|
---|
5228 | enumeration has been renamed to
|
---|
5229 | <link linkend="DnDAction">DnDAction</link>.</para>
|
---|
5230 | </listitem>
|
---|
5231 |
|
---|
5232 | <listitem>
|
---|
5233 | <para>The <computeroutput>DragAndDropMode</computeroutput>
|
---|
5234 | enumeration has been renamed to
|
---|
5235 | <link linkend="DnDMode">DnDMode</link>.</para>
|
---|
5236 | </listitem>
|
---|
5237 |
|
---|
5238 | <listitem>
|
---|
5239 | <para>The attribute
|
---|
5240 | <computeroutput>IMachine::dragAndDropMode</computeroutput>
|
---|
5241 | has been renamed to
|
---|
5242 | <link linkend="IMachine__dnDMode">IMachine::dnDMode()</link>.</para>
|
---|
5243 | </listitem>
|
---|
5244 |
|
---|
5245 | <listitem>
|
---|
5246 | <para>The event
|
---|
5247 | <computeroutput>IDragAndDropModeChangedEvent</computeroutput>
|
---|
5248 | has been renamed to
|
---|
5249 | <link linkend="IDnDModeChangedEvent">IDnDModeChangedEvent</link>.</para>
|
---|
5250 | </listitem>
|
---|
5251 |
|
---|
5252 | </itemizedlist></para>
|
---|
5253 | </listitem>
|
---|
5254 |
|
---|
5255 | <listitem><para>IDisplay and IFramebuffer interfaces were changed to
|
---|
5256 | allow IFramebuffer object to reside in a separate front-end
|
---|
5257 | process:<itemizedlist>
|
---|
5258 |
|
---|
5259 | <listitem><para>
|
---|
5260 | IDisplay::ResizeCompleted() has been removed, because the
|
---|
5261 | IFramebuffer object does not provide the screen memory anymore.
|
---|
5262 | </para></listitem>
|
---|
5263 |
|
---|
5264 | <listitem><para>
|
---|
5265 | IDisplay::SetFramebuffer() has been replaced with
|
---|
5266 | IDisplay::AttachFramebuffer() and IDisplay::DetachFramebuffer().
|
---|
5267 | </para></listitem>
|
---|
5268 |
|
---|
5269 | <listitem><para>
|
---|
5270 | IDisplay::GetFramebuffer() has been replaced with
|
---|
5271 | IDisplay::QueryFramebuffer().
|
---|
5272 | </para></listitem>
|
---|
5273 |
|
---|
5274 | <listitem><para>
|
---|
5275 | IDisplay::GetScreenResolution() has a new output parameter
|
---|
5276 | <computeroutput>guestMonitorStatus</computeroutput>
|
---|
5277 | which tells whether the monitor is enabled in the guest.
|
---|
5278 | </para></listitem>
|
---|
5279 |
|
---|
5280 | <listitem><para>
|
---|
5281 | IDisplay::TakeScreenShot() and IDisplay::TakeScreenShotToArray()
|
---|
5282 | have a new parameter
|
---|
5283 | <computeroutput>bitmapFormat</computeroutput>. As a consequence of
|
---|
5284 | this, IDisplay::TakeScreenShotPNGToArray() has been removed.
|
---|
5285 | </para></listitem>
|
---|
5286 |
|
---|
5287 | <listitem><para>
|
---|
5288 | IFramebuffer::RequestResize() has been replaced with
|
---|
5289 | IFramebuffer::NotifyChange().
|
---|
5290 | </para></listitem>
|
---|
5291 |
|
---|
5292 | <listitem><para>
|
---|
5293 | IFramebuffer::NotifyUpdateImage() added to support IFramebuffer
|
---|
5294 | objects in a different process.
|
---|
5295 | </para></listitem>
|
---|
5296 |
|
---|
5297 | <listitem><para>
|
---|
5298 | IFramebuffer::Lock(), IFramebuffer::Unlock(),
|
---|
5299 | IFramebuffer::Address(), IFramebuffer::UsesGuestVRAM() have been
|
---|
5300 | removed because the IFramebuffer object does not provide the screen
|
---|
5301 | memory anymore.
|
---|
5302 | </para></listitem>
|
---|
5303 |
|
---|
5304 | </itemizedlist></para>
|
---|
5305 | </listitem>
|
---|
5306 |
|
---|
5307 | <listitem><para>IGuestSession, IGuestFile and IGuestProcess interfaces
|
---|
5308 | were changed as follows:
|
---|
5309 | <itemizedlist>
|
---|
5310 | <listitem>
|
---|
5311 | <para>Replaced IGuestSession::directoryQueryInfo and
|
---|
5312 | IGuestSession::fileQueryInfo with a new
|
---|
5313 | <link linkend="IGuestSession__fsObjQueryInfo">IGuestSession::fsObjQueryInfo</link>
|
---|
5314 | method that works on any type of file system object.</para>
|
---|
5315 | </listitem>
|
---|
5316 | <listitem>
|
---|
5317 | <para>Replaced IGuestSession::fileRemove,
|
---|
5318 | IGuestSession::symlinkRemoveDirectory and
|
---|
5319 | IGuestSession::symlinkRemoveFile with a new
|
---|
5320 | <link linkend="IGuestSession__fsObjRemove">IGuestSession::fsObjRemove</link>
|
---|
5321 | method that works on any type of file system object except
|
---|
5322 | directories. (fileRemove also worked on any type of object
|
---|
5323 | too, though that was not the intent of the method.)</para>
|
---|
5324 | </listitem>
|
---|
5325 | <listitem>
|
---|
5326 | <para>Replaced IGuestSession::directoryRename and
|
---|
5327 | IGuestSession::directoryRename with a new
|
---|
5328 | <link linkend="IGuestSession__fsObjRename">IGuestSession::fsObjRename</link>
|
---|
5329 | method that works on any type of file system object.
|
---|
5330 | (directoryRename and fileRename may already have worked for
|
---|
5331 | any kind of object, but that was never the intent of the
|
---|
5332 | methods.)</para>
|
---|
5333 | </listitem>
|
---|
5334 | <listitem>
|
---|
5335 | <para>Replaced the unimplemented IGuestSession::directorySetACL
|
---|
5336 | and IGuestSession::fileSetACL with a new
|
---|
5337 | <link linkend="IGuestSession__fsObjSetACL">IGuestSession::fsObjSetACL</link>
|
---|
5338 | method that works on all type of file system object. Also
|
---|
5339 | added a UNIX-style mode parameter as an alternative to the
|
---|
5340 | ACL.</para>
|
---|
5341 | </listitem>
|
---|
5342 | <listitem>
|
---|
5343 | <para>Replaced IGuestSession::fileRemove,
|
---|
5344 | IGuestSession::symlinkRemoveDirectory and
|
---|
5345 | IGuestSession::symlinkRemoveFile with a new
|
---|
5346 | <link linkend="IGuestSession__fsObjRemove">IGuestSession::fsObjRemove</link>
|
---|
5347 | method that works on any type of file system object except
|
---|
5348 | directories (fileRemove also worked on any type of object,
|
---|
5349 | though that was not the intent of the method.)</para>
|
---|
5350 | </listitem>
|
---|
5351 | <listitem>
|
---|
5352 | <para>Renamed IGuestSession::copyTo to
|
---|
5353 | <link linkend="IGuestSession__fileCopyToGuest">IGuestSession::fileCopyToGuest</link>.</para>
|
---|
5354 | </listitem>
|
---|
5355 | <listitem>
|
---|
5356 | <para>Renamed IGuestSession::copyFrom to
|
---|
5357 | <link linkend="IGuestSession__fileCopyFromGuest">IGuestSession::fileCopyFromGuest</link>.</para>
|
---|
5358 | </listitem>
|
---|
5359 | <listitem>
|
---|
5360 | <para>Renamed the CopyFileFlag enum to
|
---|
5361 | <link linkend="FileCopyFlag">FileCopyFlag</link>.</para>
|
---|
5362 | </listitem>
|
---|
5363 | <listitem>
|
---|
5364 | <para>Renamed the IGuestSession::environment attribute to
|
---|
5365 | <link linkend="IGuestSession__environmentChanges">IGuestSession::environmentChanges</link>
|
---|
5366 | to better reflect what it does.</para>
|
---|
5367 | </listitem>
|
---|
5368 | <listitem>
|
---|
5369 | <para>Changed the
|
---|
5370 | <link linkend="IProcess__environment">IGuestProcess::environment</link>
|
---|
5371 | to a stub returning E_NOTIMPL since it wasn't doing what was
|
---|
5372 | advertised (returned changes, not the actual environment).</para>
|
---|
5373 | </listitem>
|
---|
5374 | <listitem>
|
---|
5375 | <para>Renamed IGuestSession::environmentSet to
|
---|
5376 | <link linkend="IGuestSession__environmentScheduleSet">IGuestSession::environmentScheduleSet</link>
|
---|
5377 | to better reflect what it does.</para>
|
---|
5378 | </listitem>
|
---|
5379 | <listitem>
|
---|
5380 | <para>Renamed IGuestSession::environmentUnset to
|
---|
5381 | <link linkend="IGuestSession__environmentScheduleUnset">IGuestSession::environmentScheduleUnset</link>
|
---|
5382 | to better reflect what it does.</para>
|
---|
5383 | </listitem>
|
---|
5384 | <listitem>
|
---|
5385 | <para>Removed IGuestSession::environmentGet it was only getting
|
---|
5386 | changes while giving the impression it was actual environment
|
---|
5387 | variables, and it did not represent scheduled unset
|
---|
5388 | operations.</para>
|
---|
5389 | </listitem>
|
---|
5390 | <listitem>
|
---|
5391 | <para>Removed IGuestSession::environmentClear as it duplicates
|
---|
5392 | assigning an empty array to the
|
---|
5393 | <link linkend="IGuestSession__environmentChanges">IGuestSession::environmentChanges</link>
|
---|
5394 | (formerly known as IGuestSession::environment).</para>
|
---|
5395 | </listitem>
|
---|
5396 | <listitem>
|
---|
5397 | <para>Changed the
|
---|
5398 | <link linkend="IGuestSession__processCreate">IGuestSession::processCreate</link>
|
---|
5399 | and
|
---|
5400 | <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx</link>
|
---|
5401 | methods to accept arguments starting with argument zero (argv[0])
|
---|
5402 | instead of argument one (argv[1]). (Not yet implemented on the
|
---|
5403 | guest additions side, so argv[0] will probably be ignored for a
|
---|
5404 | short while.)</para>
|
---|
5405 | </listitem>
|
---|
5406 |
|
---|
5407 | <listitem>
|
---|
5408 | <para>Added a followSymlink parameter to the following methods:
|
---|
5409 | <itemizedlist>
|
---|
5410 | <listitem><para><link linkend="IGuestSession__directoryExists">IGuestSession::directoryExists</link></para></listitem>
|
---|
5411 | <listitem><para><link linkend="IGuestSession__fileExists">IGuestSession::fileExists</link></para></listitem>
|
---|
5412 | <listitem><para><link linkend="IGuestSession__fileQuerySize">IGuestSession::fileQuerySize</link></para></listitem>
|
---|
5413 | </itemizedlist></para>
|
---|
5414 | </listitem>
|
---|
5415 | <listitem>
|
---|
5416 | <para>The parameters to the
|
---|
5417 | <link linkend="IGuestSession__fileOpen">IGuestSession::fileOpen</link>
|
---|
5418 | and
|
---|
5419 | <link linkend="IGuestSession__fileOpenEx">IGuestSession::fileOpenEx</link>
|
---|
5420 | methods were altered:<itemizedlist>
|
---|
5421 | <listitem><para>The openMode string parameter was replaced by
|
---|
5422 | the enum
|
---|
5423 | <link linkend="FileAccessMode">FileAccessMode</link>
|
---|
5424 | and renamed to accessMode.</para></listitem>
|
---|
5425 | <listitem><para>The disposition string parameter was replaced
|
---|
5426 | by the enum
|
---|
5427 | <link linkend="FileOpenAction">FileOpenAction</link>
|
---|
5428 | and renamed to openAction.</para></listitem>
|
---|
5429 | <listitem><para>The unimplemented sharingMode string parameter
|
---|
5430 | was replaced by the enum
|
---|
5431 | <link linkend="FileSharingMode">FileSharingMode</link>
|
---|
5432 | (fileOpenEx only).</para></listitem>
|
---|
5433 | <listitem><para>Added a flags parameter taking a list of
|
---|
5434 | <link linkend="FileOpenExFlag">FileOpenExFlag</link> values
|
---|
5435 | (fileOpenEx only).</para></listitem>
|
---|
5436 | <listitem><para>Removed the offset parameter (fileOpenEx
|
---|
5437 | only).</para></listitem>
|
---|
5438 | </itemizedlist></para>
|
---|
5439 | </listitem>
|
---|
5440 |
|
---|
5441 | <listitem>
|
---|
5442 | <para><link linkend="IFile__seek">IGuestFile::seek</link> now
|
---|
5443 | returns the new offset.</para>
|
---|
5444 | </listitem>
|
---|
5445 | <listitem>
|
---|
5446 | <para>Renamed the FileSeekType enum used by
|
---|
5447 | <link linkend="IFile__seek">IGuestFile::seek</link>
|
---|
5448 | to <link linkend="FileSeekOrigin">FileSeekOrigin</link> and
|
---|
5449 | added the missing End value and renaming the Set to
|
---|
5450 | Begin.</para>
|
---|
5451 | </listitem>
|
---|
5452 | <listitem>
|
---|
5453 | <para>Extended the unimplemented
|
---|
5454 | <link linkend="IFile__setACL">IGuestFile::setACL</link>
|
---|
5455 | method with a UNIX-style mode parameter as an alternative to
|
---|
5456 | the ACL.</para>
|
---|
5457 | </listitem>
|
---|
5458 | <listitem>
|
---|
5459 | <para>Renamed the IFile::openMode attribute to
|
---|
5460 | <link linkend="IFile__accessMode">IFile::accessMode</link>
|
---|
5461 | and change the type from string to
|
---|
5462 | <link linkend="FileAccessMode">FileAccessMode</link> to reflect
|
---|
5463 | the changes to the fileOpen methods.</para>
|
---|
5464 | </listitem>
|
---|
5465 | <listitem>
|
---|
5466 | <para>Renamed the IGuestFile::disposition attribute to
|
---|
5467 | <link linkend="IFile__openAction">IFile::openAction</link> and
|
---|
5468 | change the type from string to
|
---|
5469 | <link linkend="FileOpenAction">FileOpenAction</link> to reflect
|
---|
5470 | the changes to the fileOpen methods.</para>
|
---|
5471 | </listitem>
|
---|
5472 |
|
---|
5473 | <!-- Non-incompatible things worth mentioning (stubbed methods/attrs aren't worth it). -->
|
---|
5474 | <listitem>
|
---|
5475 | <para>Added
|
---|
5476 | <link linkend="IGuestSession__pathStyle">IGuestSession::pathStyle</link>
|
---|
5477 | attribute.</para>
|
---|
5478 | </listitem>
|
---|
5479 | <listitem>
|
---|
5480 | <para>Added
|
---|
5481 | <link linkend="IGuestSession__fsObjExists">IGuestSession::fsObjExists</link>
|
---|
5482 | attribute.</para>
|
---|
5483 | </listitem>
|
---|
5484 |
|
---|
5485 | </itemizedlist>
|
---|
5486 | </para>
|
---|
5487 | </listitem>
|
---|
5488 |
|
---|
5489 | <listitem><para>
|
---|
5490 | IConsole::GetDeviceActivity() returns information about multiple
|
---|
5491 | devices.
|
---|
5492 | </para></listitem>
|
---|
5493 |
|
---|
5494 | <listitem><para>
|
---|
5495 | IMachine::ReadSavedThumbnailToArray() has a new parameter
|
---|
5496 | <computeroutput>bitmapFormat</computeroutput>. As a consequence of
|
---|
5497 | this, IMachine::ReadSavedThumbnailPNGToArray() has been removed.
|
---|
5498 | </para></listitem>
|
---|
5499 |
|
---|
5500 | <listitem><para>
|
---|
5501 | IMachine::QuerySavedScreenshotPNGSize() has been renamed to
|
---|
5502 | IMachine::QuerySavedScreenshotInfo() which also returns
|
---|
5503 | an array of available screenshot formats.
|
---|
5504 | </para></listitem>
|
---|
5505 |
|
---|
5506 | <listitem><para>
|
---|
5507 | IMachine::ReadSavedScreenshotPNGToArray() has been renamed to
|
---|
5508 | IMachine::ReadSavedScreenshotToArray() which has a new parameter
|
---|
5509 | <computeroutput>bitmapFormat</computeroutput>.
|
---|
5510 | </para></listitem>
|
---|
5511 |
|
---|
5512 | <listitem><para>
|
---|
5513 | IMachine::QuerySavedThumbnailSize() has been removed.
|
---|
5514 | </para></listitem>
|
---|
5515 |
|
---|
5516 | <listitem>
|
---|
5517 | <para>The method
|
---|
5518 | <link linkend="IWebsessionManager__getSessionObject">IWebsessionManager::getSessionObject()</link>
|
---|
5519 | now returns a new <link linkend="ISession">ISession</link> instance
|
---|
5520 | for every invocation. This puts the behavior in line with other
|
---|
5521 | binding styles, which never forced the equivalent of establishing
|
---|
5522 | another connection and logging in again to get another
|
---|
5523 | instance.</para>
|
---|
5524 | </listitem>
|
---|
5525 | </itemizedlist>
|
---|
5526 | </sect1>
|
---|
5527 |
|
---|
5528 | <sect1>
|
---|
5529 | <title>Incompatible API changes with version 4.3</title>
|
---|
5530 |
|
---|
5531 | <itemizedlist>
|
---|
5532 | <listitem>
|
---|
5533 | <para>The explicit medium locking methods
|
---|
5534 | <link linkend="IMedium__lockRead">IMedium::lockRead()</link>
|
---|
5535 | and <link linkend="IMedium__lockWrite">IMedium::lockWrite()</link>
|
---|
5536 | have been redesigned. They return a lock token object reference
|
---|
5537 | now, and calling the
|
---|
5538 | <link linkend="IToken__abandon">IToken::abandon()</link> method (or
|
---|
5539 | letting the reference count to this object drop to 0) will unlock
|
---|
5540 | it. This eliminates the rather common problem that an API client
|
---|
5541 | crash left behind locks, and also improves the safety (API clients
|
---|
5542 | can't release locks they didn't obtain).</para>
|
---|
5543 | </listitem>
|
---|
5544 |
|
---|
5545 | <listitem>
|
---|
5546 | <para>The parameter list of
|
---|
5547 | <link linkend="IAppliance__write">IAppliance::write()</link>
|
---|
5548 | has been changed slightly, to allow multiple flags to be
|
---|
5549 | passed.</para>
|
---|
5550 | </listitem>
|
---|
5551 |
|
---|
5552 | <listitem>
|
---|
5553 | <para><computeroutput>IMachine::delete</computeroutput>
|
---|
5554 | has been renamed to
|
---|
5555 | <link linkend="IMachine__deleteConfig">IMachine::deleteConfig()</link>,
|
---|
5556 | to improve API client binding compatibility.</para>
|
---|
5557 | </listitem>
|
---|
5558 |
|
---|
5559 | <listitem>
|
---|
5560 | <para><computeroutput>IMachine::export</computeroutput>
|
---|
5561 | has been renamed to
|
---|
5562 | <link linkend="IMachine__exportTo">IMachine::exportTo()</link>,
|
---|
5563 | to improve API client binding compatibility.</para>
|
---|
5564 | </listitem>
|
---|
5565 |
|
---|
5566 | <listitem>
|
---|
5567 | <para>For
|
---|
5568 | <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>
|
---|
5569 | the meaning of the <computeroutput>type</computeroutput> parameter
|
---|
5570 | has changed slightly. Empty string now means that the per-VM or
|
---|
5571 | global default front-end is launched. Most callers of this method
|
---|
5572 | should use the empty string now, unless they really want to override
|
---|
5573 | the default and launch a particular front-end.</para>
|
---|
5574 | </listitem>
|
---|
5575 |
|
---|
5576 | <listitem>
|
---|
5577 | <para>Medium management APIs were changed as follows:<itemizedlist>
|
---|
5578 |
|
---|
5579 | <listitem>
|
---|
5580 | <para>The type of attribute
|
---|
5581 | <link linkend="IMedium__variant">IMedium::variant()</link>
|
---|
5582 | changed from <computeroutput>unsigned long</computeroutput>
|
---|
5583 | to <computeroutput>safe-array MediumVariant</computeroutput>.
|
---|
5584 | It is an array of flags instead of a set of flags which were
|
---|
5585 | stored inside one variable.
|
---|
5586 | </para>
|
---|
5587 | </listitem>
|
---|
5588 |
|
---|
5589 | <listitem>
|
---|
5590 | <para>The parameter list for
|
---|
5591 | <link linkend="IMedium__cloneTo">IMedium::cloneTo()</link>
|
---|
5592 | was modified. The type of parameter variant was changed from
|
---|
5593 | unsigned long to safe-array MediumVariant.
|
---|
5594 | </para>
|
---|
5595 | </listitem>
|
---|
5596 |
|
---|
5597 | <listitem>
|
---|
5598 | <para>The parameter list for
|
---|
5599 | <link linkend="IMedium__createBaseStorage">IMedium::createBaseStorage()</link>
|
---|
5600 | was modified. The type of parameter variant was changed from
|
---|
5601 | unsigned long to safe-array MediumVariant.
|
---|
5602 | </para>
|
---|
5603 | </listitem>
|
---|
5604 |
|
---|
5605 | <listitem>
|
---|
5606 | <para>The parameter list for
|
---|
5607 | <link linkend="IMedium__createDiffStorage">IMedium::createDiffStorage()</link>
|
---|
5608 | was modified. The type of parameter variant was changed from
|
---|
5609 | unsigned long to safe-array MediumVariant.
|
---|
5610 | </para>
|
---|
5611 | </listitem>
|
---|
5612 |
|
---|
5613 | <listitem>
|
---|
5614 | <para>The parameter list for
|
---|
5615 | <link linkend="IMedium__cloneToBase">IMedium::cloneToBase()</link>
|
---|
5616 | was modified. The type of parameter variant was changed from
|
---|
5617 | unsigned long to safe-array MediumVariant.
|
---|
5618 | </para>
|
---|
5619 | </listitem>
|
---|
5620 | </itemizedlist></para>
|
---|
5621 | </listitem>
|
---|
5622 |
|
---|
5623 | <listitem>
|
---|
5624 | <para>The type of attribute
|
---|
5625 | <link linkend="IMediumFormat__capabilities">IMediumFormat::capabilities()</link>
|
---|
5626 | changed from <computeroutput>unsigned long</computeroutput> to
|
---|
5627 | <computeroutput>safe-array MediumFormatCapabilities</computeroutput>.
|
---|
5628 | It is an array of flags instead of a set of flags which were stored
|
---|
5629 | inside one variable.
|
---|
5630 | </para>
|
---|
5631 | </listitem>
|
---|
5632 |
|
---|
5633 | <listitem>
|
---|
5634 | <para>The attribute
|
---|
5635 | <link linkend="IMedium__logicalSize">IMedium::logicalSize()</link>
|
---|
5636 | now returns the logical size of exactly this medium object (whether
|
---|
5637 | it is a base or diff image). The old behavior was no longer
|
---|
5638 | acceptable, as each image can have a different capacity.</para>
|
---|
5639 | </listitem>
|
---|
5640 |
|
---|
5641 | <listitem>
|
---|
5642 | <para>Guest control APIs - such as
|
---|
5643 | <link linkend="IGuest">IGuest</link>,
|
---|
5644 | <link linkend="IGuestSession">IGuestSession</link>,
|
---|
5645 | <link linkend="IGuestProcess">IGuestProcess</link> and so on - now
|
---|
5646 | emit own events to provide clients much finer control and the ability
|
---|
5647 | to write own front-ends for guest operations. The event
|
---|
5648 | <link linkend="IGuestSessionEvent">IGuestSessionEvent</link> acts as
|
---|
5649 | an abstract base class for all guest control events. Certain guest
|
---|
5650 | events contain a
|
---|
5651 | <link linkend="IVirtualBoxErrorInfo">IVirtualBoxErrorInfo</link>
|
---|
5652 | member to provide more information in case of an error happened on
|
---|
5653 | the guest side.</para>
|
---|
5654 | </listitem>
|
---|
5655 |
|
---|
5656 | <listitem>
|
---|
5657 | <para>Guest control sessions on the guest started by
|
---|
5658 | <link linkend="IGuest__createSession">IGuest::createSession()</link>
|
---|
5659 | now are dedicated guest processes to provide more safety and
|
---|
5660 | performance for certain operations. Also, the
|
---|
5661 | <link linkend="IGuest__createSession">IGuest::createSession()</link>
|
---|
5662 | call does not wait for the guest session being created anymore due
|
---|
5663 | to the dedicated guest session processes just mentioned. This also
|
---|
5664 | will enable webservice clients to handle guest session creation
|
---|
5665 | more gracefully. To wait for a guest session being started, use the
|
---|
5666 | newly added attribute
|
---|
5667 | <link linkend="IGuestSession__status">IGuestSession::status()</link>
|
---|
5668 | to query the current guest session status.</para>
|
---|
5669 | </listitem>
|
---|
5670 |
|
---|
5671 | <listitem>
|
---|
5672 | <para>The <link linkend="IGuestFile">IGuestFile</link>
|
---|
5673 | APIs are now implemented to provide native guest file access from
|
---|
5674 | the host.</para>
|
---|
5675 | </listitem>
|
---|
5676 |
|
---|
5677 | <listitem>
|
---|
5678 | <para>The parameter list for
|
---|
5679 | <link linkend="IGuest__updateGuestAdditions">IMedium::updateGuestAdditions()</link>
|
---|
5680 | was modified. It now supports specifying optional command line
|
---|
5681 | arguments for the Guest Additions installer performing the actual
|
---|
5682 | update on the guest.
|
---|
5683 | </para>
|
---|
5684 | </listitem>
|
---|
5685 |
|
---|
5686 | <listitem>
|
---|
5687 | <para>A new event
|
---|
5688 | <link linkend="IGuestUserStateChangedEvent">IGuestUserStateChangedEvent</link>
|
---|
5689 | was introduced to provide guest user status updates to the host via
|
---|
5690 | event listeners. To use this event there needs to be at least the 4.3
|
---|
5691 | Guest Additions installed on the guest. At the moment only the states
|
---|
5692 | "Idle" and "InUse" of the
|
---|
5693 | <link linkend="GuestUserState">GuestUserState</link> enumeration arei
|
---|
5694 | supported on Windows guests, starting at Windows 2000 SP2.</para>
|
---|
5695 | </listitem>
|
---|
5696 |
|
---|
5697 | <listitem>
|
---|
5698 | <para>
|
---|
5699 | The attribute
|
---|
5700 | <link linkend="IGuestSession__protocolVersion">IGuestSession::protocolVersion</link>
|
---|
5701 | was added to provide a convenient way to lookup the guest session's
|
---|
5702 | protocol version it uses to communicate with the installed Guest
|
---|
5703 | Additions on the guest. Older Guest Additions will set the protocol
|
---|
5704 | version to 1, whereas Guest Additions 4.3 will set the protocol
|
---|
5705 | version to 2. This might change in the future as new features
|
---|
5706 | arise.</para>
|
---|
5707 | </listitem>
|
---|
5708 |
|
---|
5709 | <listitem>
|
---|
5710 | <para><computeroutput>IDisplay::getScreenResolution</computeroutput>
|
---|
5711 | has been extended to return the display position in the guest.</para>
|
---|
5712 | </listitem>
|
---|
5713 |
|
---|
5714 | <listitem>
|
---|
5715 | <para>
|
---|
5716 | The <link linkend="IUSBController">IUSBController</link>
|
---|
5717 | class is not a singleton of
|
---|
5718 | <link linkend="IMachine">IMachine</link> anymore but
|
---|
5719 | <link linkend="IMachine">IMachine</link> contains a list of USB
|
---|
5720 | controllers present in the VM. The USB device filter handling was
|
---|
5721 | moved to
|
---|
5722 | <link linkend="IUSBDeviceFilters">IUSBDeviceFilters</link>.
|
---|
5723 | </para>
|
---|
5724 | </listitem>
|
---|
5725 | </itemizedlist>
|
---|
5726 | </sect1>
|
---|
5727 |
|
---|
5728 | <sect1>
|
---|
5729 | <title>Incompatible API changes with version 4.2</title>
|
---|
5730 |
|
---|
5731 | <itemizedlist>
|
---|
5732 | <listitem>
|
---|
5733 | <para>Guest control APIs for executing guest processes, working with
|
---|
5734 | guest files or directories have been moved to the newly introduced
|
---|
5735 | <link linkend="IGuestSession">IGuestSession</link> interface which
|
---|
5736 | can be created by calling
|
---|
5737 | <link linkend="IGuest__createSession">IGuest::createSession()</link>.</para>
|
---|
5738 |
|
---|
5739 | <para>A guest session will act as a
|
---|
5740 | guest user's impersonation so that the guest credentials only have to
|
---|
5741 | be provided when creating a new guest session. There can be up to 32
|
---|
5742 | guest sessions at once per VM, each session serving up to 2048 guest
|
---|
5743 | processes running or files opened.</para>
|
---|
5744 |
|
---|
5745 | <para>Instead of working with process or directory handles before
|
---|
5746 | version 4.2, there now are the dedicated interfaces
|
---|
5747 | <link linkend="IGuestProcess">IGuestProcess</link>,
|
---|
5748 | <link linkend="IGuestDirectory">IGuestDirectory</link> and
|
---|
5749 | <link linkend="IGuestFile">IGuestFile</link>. To retrieve more
|
---|
5750 | information of a file system object the new interface
|
---|
5751 | <link linkend="IGuestFsObjInfo">IGuestFsObjInfo</link> has been
|
---|
5752 | introduced.</para>
|
---|
5753 |
|
---|
5754 | <para>Even though the guest control API was changed it is backwards
|
---|
5755 | compatible so that it can be used with older installed Guest
|
---|
5756 | Additions. However, to use upcoming features like process termination
|
---|
5757 | or waiting for input / output new Guest Additions must be installed
|
---|
5758 | when these features got implemented.</para>
|
---|
5759 |
|
---|
5760 | <para>The following limitations apply:
|
---|
5761 | <itemizedlist>
|
---|
5762 | <listitem><para>The <link linkend="IGuestFile">IGuestFile</link>
|
---|
5763 | interface is not fully implemented yet.</para>
|
---|
5764 | </listitem>
|
---|
5765 | <listitem><para>The symbolic link APIs
|
---|
5766 | <link linkend="IGuestSession__symlinkCreate">IGuestSession::symlinkCreate()</link>,
|
---|
5767 | <link linkend="IGuestSession__symlinkExists">IGuestSession::symlinkExists()</link>,
|
---|
5768 | <link linkend="IGuestSession__symlinkRead">IGuestSession::symlinkRead()</link>,
|
---|
5769 | IGuestSession::symlinkRemoveDirectory() and
|
---|
5770 | IGuestSession::symlinkRemoveFile() are not
|
---|
5771 | implemented yet.</para>
|
---|
5772 | </listitem>
|
---|
5773 | <listitem><para>The directory APIs
|
---|
5774 | <link linkend="IGuestSession__directoryRemove">IGuestSession::directoryRemove()</link>,
|
---|
5775 | <link linkend="IGuestSession__directoryRemoveRecursive">IGuestSession::directoryRemoveRecursive()</link>,
|
---|
5776 | IGuestSession::directoryRename() and
|
---|
5777 | IGuestSession::directorySetACL() are not
|
---|
5778 | implemented yet.</para>
|
---|
5779 | </listitem>
|
---|
5780 | <listitem><para>The temporary file creation API
|
---|
5781 | <link linkend="IGuestSession__fileCreateTemp">IGuestSession::fileCreateTemp()</link>
|
---|
5782 | is not implemented yet.</para>
|
---|
5783 | </listitem>
|
---|
5784 | <listitem><para>Guest process termination via
|
---|
5785 | <link linkend="IProcess__terminate">IProcess::terminate()</link>
|
---|
5786 | is not implemented yet.</para>
|
---|
5787 | </listitem>
|
---|
5788 | <listitem><para>Waiting for guest process output via
|
---|
5789 | <link linkend="ProcessWaitForFlag__StdOut">ProcessWaitForFlag::StdOut</link>
|
---|
5790 | and
|
---|
5791 | <link linkend="ProcessWaitForFlag__StdErr">ProcessWaitForFlag::StdErr</link>
|
---|
5792 | is not implemented yet.</para>
|
---|
5793 | <para>To wait for process output,
|
---|
5794 | <link linkend="IProcess__read">IProcess::read()</link> with
|
---|
5795 | appropriate flags still can be used to periodically check for
|
---|
5796 | new output data to arrive. Note that
|
---|
5797 | <link linkend="ProcessCreateFlag__WaitForStdOut">ProcessCreateFlag::WaitForStdOut</link>
|
---|
5798 | and / or
|
---|
5799 | <link linkend="ProcessCreateFlag__WaitForStdErr">ProcessCreateFlag::WaitForStdErr</link>
|
---|
5800 | need to be specified when creating a guest process via
|
---|
5801 | <link linkend="IGuestSession__processCreate">IGuestSession::processCreate()</link>
|
---|
5802 | or
|
---|
5803 | <link linkend="IGuestSession__processCreateEx">IGuestSession::processCreateEx()</link>.</para>
|
---|
5804 | </listitem>
|
---|
5805 | <listitem>
|
---|
5806 | <para>ACL (Access Control List) handling in general is not
|
---|
5807 | implemented yet.</para>
|
---|
5808 | </listitem>
|
---|
5809 | </itemizedlist>
|
---|
5810 | </para>
|
---|
5811 | </listitem>
|
---|
5812 |
|
---|
5813 | <listitem>
|
---|
5814 | <para>The <link linkend="LockType">LockType</link>
|
---|
5815 | enumeration now has an additional value
|
---|
5816 | <computeroutput>VM</computeroutput> which tells
|
---|
5817 | <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
|
---|
5818 | to create a full-blown object structure for running a VM. This was
|
---|
5819 | the previous behavior with <computeroutput>Write</computeroutput>,
|
---|
5820 | which now only creates the minimal object structure to save time and
|
---|
5821 | resources (at the moment the Console object is still created, but all
|
---|
5822 | sub-objects such as Display, Keyboard, Mouse, Guest are not.</para>
|
---|
5823 | </listitem>
|
---|
5824 |
|
---|
5825 | <listitem>
|
---|
5826 | <para>Machines can be put in groups (actually an array of groups).
|
---|
5827 | The primary group affects the default placement of files belonging
|
---|
5828 | to a VM.
|
---|
5829 | <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
|
---|
5830 | and
|
---|
5831 | <link linkend="IVirtualBox__composeMachineFilename">IVirtualBox::composeMachineFilename()</link>
|
---|
5832 | have been adjusted accordingly, the former taking an array of groups
|
---|
5833 | as an additional parameter and the latter taking a group as an
|
---|
5834 | additional parameter. The create option handling has been changed for
|
---|
5835 | those two methods, too.</para>
|
---|
5836 | </listitem>
|
---|
5837 |
|
---|
5838 | <listitem>
|
---|
5839 | <para>The method IVirtualBox::findMedium() has been removed, since
|
---|
5840 | it provides a subset of the functionality of
|
---|
5841 | <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>.</para>
|
---|
5842 | </listitem>
|
---|
5843 |
|
---|
5844 | <listitem>
|
---|
5845 | <para>The use of acronyms in API enumeration, interface, attribute
|
---|
5846 | and method names has been made much more consistent, previously they
|
---|
5847 | sometimes were lowercase and sometimes mixed case. They are now
|
---|
5848 | consistently all caps:<table>
|
---|
5849 | <title>Renamed identifiers in VirtualBox 4.2</title>
|
---|
5850 |
|
---|
5851 | <tgroup cols="2" style="verywide">
|
---|
5852 | <tbody>
|
---|
5853 | <row>
|
---|
5854 | <entry><emphasis role="bold">Old name</emphasis></entry>
|
---|
5855 |
|
---|
5856 | <entry><emphasis role="bold">New name</emphasis></entry>
|
---|
5857 | </row>
|
---|
5858 | <row>
|
---|
5859 | <entry>PointingHidType</entry>
|
---|
5860 | <entry><link linkend="PointingHIDType">PointingHIDType</link></entry>
|
---|
5861 | </row>
|
---|
5862 | <row>
|
---|
5863 | <entry>KeyboardHidType</entry>
|
---|
5864 | <entry><link linkend="KeyboardHIDType">KeyboardHIDType</link></entry>
|
---|
5865 | </row>
|
---|
5866 | <row>
|
---|
5867 | <entry>IPciAddress</entry>
|
---|
5868 | <entry><link linkend="IPCIAddress">IPCIAddress</link></entry>
|
---|
5869 | </row>
|
---|
5870 | <row>
|
---|
5871 | <entry>IPciDeviceAttachment</entry>
|
---|
5872 | <entry><link linkend="IPCIDeviceAttachment">IPCIDeviceAttachment</link></entry>
|
---|
5873 | </row>
|
---|
5874 | <row>
|
---|
5875 | <entry>IMachine::pointingHidType</entry>
|
---|
5876 | <entry><link linkend="IMachine__pointingHIDType">IMachine::pointingHIDType</link></entry>
|
---|
5877 | </row>
|
---|
5878 | <row>
|
---|
5879 | <entry>IMachine::keyboardHidType</entry>
|
---|
5880 | <entry><link linkend="IMachine__keyboardHIDType">IMachine::keyboardHIDType</link></entry>
|
---|
5881 | </row>
|
---|
5882 | <row>
|
---|
5883 | <entry>IMachine::hpetEnabled</entry>
|
---|
5884 | <entry>IMachine::HPETEnabled</entry>
|
---|
5885 | </row>
|
---|
5886 | <row>
|
---|
5887 | <entry>IMachine::sessionPid</entry>
|
---|
5888 | <entry><link linkend="IMachine__sessionPID">IMachine::sessionPID</link></entry>
|
---|
5889 | </row>
|
---|
5890 | <row>
|
---|
5891 | <entry>IMachine::ioCacheEnabled</entry>
|
---|
5892 | <entry><link linkend="IMachine__IOCacheEnabled">IMachine::IOCacheEnabled</link></entry>
|
---|
5893 | </row>
|
---|
5894 | <row>
|
---|
5895 | <entry>IMachine::ioCacheSize</entry>
|
---|
5896 | <entry><link linkend="IMachine__IOCacheSize">IMachine::IOCacheSize</link></entry>
|
---|
5897 | </row>
|
---|
5898 | <row>
|
---|
5899 | <entry>IMachine::pciDeviceAssignments</entry>
|
---|
5900 | <entry><link linkend="IMachine__PCIDeviceAssignments">IMachine::PCIDeviceAssignments</link></entry>
|
---|
5901 | </row>
|
---|
5902 | <row>
|
---|
5903 | <entry>IMachine::attachHostPciDevice()</entry>
|
---|
5904 | <entry><link linkend="IMachine__attachHostPCIDevice">IMachine::attachHostPCIDevice</link></entry>
|
---|
5905 | </row>
|
---|
5906 | <row>
|
---|
5907 | <entry>IMachine::detachHostPciDevice()</entry>
|
---|
5908 | <entry><link linkend="IMachine__detachHostPCIDevice">IMachine::detachHostPCIDevice()</link></entry>
|
---|
5909 | </row>
|
---|
5910 | <row>
|
---|
5911 | <entry>IConsole::attachedPciDevices</entry>
|
---|
5912 | <entry><link linkend="IConsole__attachedPCIDevices">IConsole::attachedPCIDevices</link></entry>
|
---|
5913 | </row>
|
---|
5914 | <row>
|
---|
5915 | <entry>IHostNetworkInterface::dhcpEnabled</entry>
|
---|
5916 | <entry><link linkend="IHostNetworkInterface__DHCPEnabled">IHostNetworkInterface::DHCPEnabled</link></entry>
|
---|
5917 | </row>
|
---|
5918 | <row>
|
---|
5919 | <entry>IHostNetworkInterface::enableStaticIpConfig()</entry>
|
---|
5920 | <entry><link linkend="IHostNetworkInterface__enableStaticIPConfig">IHostNetworkInterface::enableStaticIPConfig()</link></entry>
|
---|
5921 | </row>
|
---|
5922 | <row>
|
---|
5923 | <entry>IHostNetworkInterface::enableStaticIpConfigV6()</entry>
|
---|
5924 | <entry><link linkend="IHostNetworkInterface__enableStaticIPConfigV6">IHostNetworkInterface::enableStaticIPConfigV6()</link></entry>
|
---|
5925 | </row>
|
---|
5926 | <row>
|
---|
5927 | <entry>IHostNetworkInterface::enableDynamicIpConfig()</entry>
|
---|
5928 | <entry><link linkend="IHostNetworkInterface__enableDynamicIPConfig">IHostNetworkInterface::enableDynamicIPConfig()</link></entry>
|
---|
5929 | </row>
|
---|
5930 | <row>
|
---|
5931 | <entry>IHostNetworkInterface::dhcpRediscover()</entry>
|
---|
5932 | <entry><link linkend="IHostNetworkInterface__DHCPRediscover">IHostNetworkInterface::DHCPRediscover()</link></entry>
|
---|
5933 | </row>
|
---|
5934 | <row>
|
---|
5935 | <entry>IHost::acceleration3DAvailable</entry>
|
---|
5936 | </row>
|
---|
5937 | <row>
|
---|
5938 | <entry>IGuestOSType::recommendedPae</entry>
|
---|
5939 | <entry><link linkend="IGuestOSType__recommendedPAE">IGuestOSType::recommendedPAE</link></entry>
|
---|
5940 | </row>
|
---|
5941 | <row>
|
---|
5942 | <entry>IGuestOSType::recommendedDvdStorageController</entry>
|
---|
5943 | <entry><link linkend="IGuestOSType__recommendedDVDStorageController">IGuestOSType::recommendedDVDStorageController</link></entry>
|
---|
5944 | </row>
|
---|
5945 | <row>
|
---|
5946 | <entry>IGuestOSType::recommendedDvdStorageBus</entry>
|
---|
5947 | <entry><link linkend="IGuestOSType__recommendedDVDStorageBus">IGuestOSType::recommendedDVDStorageBus</link></entry>
|
---|
5948 | </row>
|
---|
5949 | <row>
|
---|
5950 | <entry>IGuestOSType::recommendedHdStorageController</entry>
|
---|
5951 | <entry><link linkend="IGuestOSType__recommendedHDStorageController">IGuestOSType::recommendedHDStorageController</link></entry>
|
---|
5952 | </row>
|
---|
5953 | <row>
|
---|
5954 | <entry>IGuestOSType::recommendedHdStorageBus</entry>
|
---|
5955 | <entry><link linkend="IGuestOSType__recommendedHDStorageBus">IGuestOSType::recommendedHDStorageBus</link></entry>
|
---|
5956 | </row>
|
---|
5957 | <row>
|
---|
5958 | <entry>IGuestOSType::recommendedUsbHid</entry>
|
---|
5959 | <entry><link linkend="IGuestOSType__recommendedUSBHID">IGuestOSType::recommendedUSBHID</link></entry>
|
---|
5960 | </row>
|
---|
5961 | <row>
|
---|
5962 | <entry>IGuestOSType::recommendedHpet</entry>
|
---|
5963 | <entry><link linkend="IGuestOSType__recommendedHPET">IGuestOSType::recommendedHPET</link></entry>
|
---|
5964 | </row>
|
---|
5965 | <row>
|
---|
5966 | <entry>IGuestOSType::recommendedUsbTablet</entry>
|
---|
5967 | <entry><link linkend="IGuestOSType__recommendedUSBTablet">IGuestOSType::recommendedUSBTablet</link></entry>
|
---|
5968 | </row>
|
---|
5969 | <row>
|
---|
5970 | <entry>IGuestOSType::recommendedRtcUseUtc</entry>
|
---|
5971 | <entry><link linkend="IGuestOSType__recommendedRTCUseUTC">IGuestOSType::recommendedRTCUseUTC</link></entry>
|
---|
5972 | </row>
|
---|
5973 | <row>
|
---|
5974 | <entry>IGuestOSType::recommendedUsb</entry>
|
---|
5975 | <entry><link linkend="IGuestOSType__recommendedUSB">IGuestOSType::recommendedUSB</link></entry>
|
---|
5976 | </row>
|
---|
5977 | <row>
|
---|
5978 | <entry>INetworkAdapter::natDriver</entry>
|
---|
5979 | <entry><link linkend="INetworkAdapter__NATEngine">INetworkAdapter::NATEngine</link></entry>
|
---|
5980 | </row>
|
---|
5981 | <row>
|
---|
5982 | <entry>IUSBController::enabledEhci</entry>
|
---|
5983 | <entry>IUSBController::enabledEHCI"</entry>
|
---|
5984 | </row>
|
---|
5985 | <row>
|
---|
5986 | <entry>INATEngine::tftpPrefix</entry>
|
---|
5987 | <entry><link linkend="INATEngine__TFTPPrefix">INATEngine::TFTPPrefix</link></entry>
|
---|
5988 | </row>
|
---|
5989 | <row>
|
---|
5990 | <entry>INATEngine::tftpBootFile</entry>
|
---|
5991 | <entry><link linkend="INATEngine__TFTPBootFile">INATEngine::TFTPBootFile</link></entry>
|
---|
5992 | </row>
|
---|
5993 | <row>
|
---|
5994 | <entry>INATEngine::tftpNextServer</entry>
|
---|
5995 | <entry><link linkend="INATEngine__TFTPNextServer">INATEngine::TFTPNextServer</link></entry>
|
---|
5996 | </row>
|
---|
5997 | <row>
|
---|
5998 | <entry>INATEngine::dnsPassDomain</entry>
|
---|
5999 | <entry><link linkend="INATEngine__DNSPassDomain">INATEngine::DNSPassDomain</link></entry>
|
---|
6000 | </row>
|
---|
6001 | <row>
|
---|
6002 | <entry>INATEngine::dnsProxy</entry>
|
---|
6003 | <entry><link linkend="INATEngine__DNSProxy">INATEngine::DNSProxy</link></entry>
|
---|
6004 | </row>
|
---|
6005 | <row>
|
---|
6006 | <entry>INATEngine::dnsUseHostResolver</entry>
|
---|
6007 | <entry><link linkend="INATEngine__DNSUseHostResolver">INATEngine::DNSUseHostResolver</link></entry>
|
---|
6008 | </row>
|
---|
6009 | <row>
|
---|
6010 | <entry>VBoxEventType::OnHostPciDevicePlug</entry>
|
---|
6011 | <entry><link linkend="VBoxEventType__OnHostPCIDevicePlug">VBoxEventType::OnHostPCIDevicePlug</link></entry>
|
---|
6012 | </row>
|
---|
6013 | <row>
|
---|
6014 | <entry>ICPUChangedEvent::cpu</entry>
|
---|
6015 | <entry><link linkend="ICPUChangedEvent__CPU">ICPUChangedEvent::CPU</link></entry>
|
---|
6016 | </row>
|
---|
6017 | <row>
|
---|
6018 | <entry>INATRedirectEvent::hostIp</entry>
|
---|
6019 | <entry><link linkend="INATRedirectEvent__hostIP">INATRedirectEvent::hostIP</link></entry>
|
---|
6020 | </row>
|
---|
6021 | <row>
|
---|
6022 | <entry>INATRedirectEvent::guestIp</entry>
|
---|
6023 | <entry><link linkend="INATRedirectEvent__guestIP">INATRedirectEvent::guestIP</link></entry>
|
---|
6024 | </row>
|
---|
6025 | <row>
|
---|
6026 | <entry>IHostPciDevicePlugEvent</entry>
|
---|
6027 | <entry><link linkend="IHostPCIDevicePlugEvent">IHostPCIDevicePlugEvent</link></entry>
|
---|
6028 | </row>
|
---|
6029 | </tbody>
|
---|
6030 | </tgroup></table></para>
|
---|
6031 | </listitem>
|
---|
6032 | </itemizedlist>
|
---|
6033 | </sect1>
|
---|
6034 |
|
---|
6035 | <sect1>
|
---|
6036 | <title>Incompatible API changes with version 4.1</title>
|
---|
6037 |
|
---|
6038 | <itemizedlist>
|
---|
6039 | <listitem>
|
---|
6040 | <para>The method
|
---|
6041 | <link linkend="IAppliance__importMachines">IAppliance::importMachines()</link>
|
---|
6042 | has one more parameter now, which allows to configure the import
|
---|
6043 | process in more detail.
|
---|
6044 | </para>
|
---|
6045 | </listitem>
|
---|
6046 |
|
---|
6047 | <listitem>
|
---|
6048 | <para>The method
|
---|
6049 | <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>
|
---|
6050 | has one more parameter now, which allows resolving duplicate medium
|
---|
6051 | UUIDs without the need for external tools.</para>
|
---|
6052 | </listitem>
|
---|
6053 |
|
---|
6054 | <listitem>
|
---|
6055 | <para>The <link linkend="INetworkAdapter">INetworkAdapter</link>
|
---|
6056 | interface has been cleaned up. The various methods to activate an
|
---|
6057 | attachment type have been replaced by the
|
---|
6058 | <link linkend="INetworkAdapter__attachmentType">INetworkAdapter::attachmentType</link>
|
---|
6059 | setter.</para>
|
---|
6060 | <para>Additionally each attachment mode now has its own attribute,
|
---|
6061 | which means that host only networks no longer share the settings with
|
---|
6062 | bridged interfaces.</para>
|
---|
6063 | <para>To allow introducing new network attachment implementations
|
---|
6064 | without making API changes, the concept of a generic network
|
---|
6065 | attachment driver has been introduced, which is configurable through
|
---|
6066 | key/value properties.</para>
|
---|
6067 | </listitem>
|
---|
6068 |
|
---|
6069 | <listitem>
|
---|
6070 | <para>This version introduces the guest facilities concept. A guest
|
---|
6071 | facility either represents a module or feature the guest is running
|
---|
6072 | or offering, which is defined by
|
---|
6073 | <link linkend="AdditionsFacilityType">AdditionsFacilityType</link>.
|
---|
6074 | Each facility is member of a
|
---|
6075 | <link linkend="AdditionsFacilityClass">AdditionsFacilityClass</link>
|
---|
6076 | and has a current status indicated by
|
---|
6077 | <link linkend="AdditionsFacilityStatus">AdditionsFacilityStatus</link>,
|
---|
6078 | together with a timestamp (in ms) of the last status update.</para>
|
---|
6079 | <para>To address the above concept, the following changes were made:
|
---|
6080 | <itemizedlist>
|
---|
6081 | <listitem>
|
---|
6082 | <para>
|
---|
6083 | In the <link linkend="IGuest">IGuest</link> interface, the
|
---|
6084 | following were removed:
|
---|
6085 | <itemizedlist>
|
---|
6086 | <listitem>
|
---|
6087 | <para>the
|
---|
6088 | <computeroutput>supportsSeamless</computeroutput>
|
---|
6089 | attribute;</para>
|
---|
6090 | </listitem>
|
---|
6091 | <listitem>
|
---|
6092 | <para>the
|
---|
6093 | <computeroutput>supportsGraphics</computeroutput>
|
---|
6094 | attribute;</para>
|
---|
6095 | </listitem>
|
---|
6096 | </itemizedlist>
|
---|
6097 | </para>
|
---|
6098 | </listitem>
|
---|
6099 | <listitem>
|
---|
6100 | <para>
|
---|
6101 | The function
|
---|
6102 | <link linkend="IGuest__getFacilityStatus">IGuest::getFacilityStatus()</link>
|
---|
6103 | was added. It quickly provides a facility's status without
|
---|
6104 | the need to get the facility collection with
|
---|
6105 | <link linkend="IGuest__facilities">IGuest::facilities</link>.
|
---|
6106 | </para>
|
---|
6107 | </listitem>
|
---|
6108 | <listitem>
|
---|
6109 | <para>
|
---|
6110 | The attribute
|
---|
6111 | <link linkend="IGuest__facilities">IGuest::facilities</link>
|
---|
6112 | was added to provide an easy to access collection of all
|
---|
6113 | currently known guest facilities, that is, it contains all
|
---|
6114 | facilies where at least one status update was made since the
|
---|
6115 | guest was started.
|
---|
6116 | </para>
|
---|
6117 | </listitem>
|
---|
6118 | <listitem>
|
---|
6119 | <para>
|
---|
6120 | The interface
|
---|
6121 | <link linkend="IAdditionsFacility">IAdditionsFacility</link>
|
---|
6122 | was added to represent a single facility returned by
|
---|
6123 | <link linkend="IGuest__facilities">IGuest::facilities</link>.
|
---|
6124 | </para>
|
---|
6125 | </listitem>
|
---|
6126 | <listitem>
|
---|
6127 | <para>
|
---|
6128 | <link linkend="AdditionsFacilityStatus">AdditionsFacilityStatus</link>
|
---|
6129 | was added to represent a facility's overall status.
|
---|
6130 | </para>
|
---|
6131 | </listitem>
|
---|
6132 | <listitem>
|
---|
6133 | <para>
|
---|
6134 | <link linkend="AdditionsFacilityType">AdditionsFacilityType</link> and
|
---|
6135 | <link linkend="AdditionsFacilityClass">AdditionsFacilityClass</link> were
|
---|
6136 | added to represent the facility's type and class.
|
---|
6137 | </para>
|
---|
6138 | </listitem>
|
---|
6139 | </itemizedlist>
|
---|
6140 | </para>
|
---|
6141 | </listitem>
|
---|
6142 | </itemizedlist>
|
---|
6143 | </sect1>
|
---|
6144 |
|
---|
6145 | <sect1>
|
---|
6146 | <title>Incompatible API changes with version 4.0</title>
|
---|
6147 |
|
---|
6148 | <itemizedlist>
|
---|
6149 | <listitem>
|
---|
6150 | <para>A new Java glue layer replacing the previous OOWS JAX-WS
|
---|
6151 | bindings was introduced. The new library allows for uniform code
|
---|
6152 | targeting both local (COM/XPCOM) and remote (SOAP) transports. Now,
|
---|
6153 | instead of <computeroutput>IWebsessionManager</computeroutput>, the
|
---|
6154 | new class <computeroutput>VirtualBoxManager</computeroutput> must be
|
---|
6155 | used. See <xref linkend="javaapi"/> for details.</para>
|
---|
6156 | </listitem>
|
---|
6157 |
|
---|
6158 | <listitem>
|
---|
6159 | <para>The confusingly named and impractical session APIs were
|
---|
6160 | changed. In existing client code, the following changes need to be
|
---|
6161 | made:<itemizedlist>
|
---|
6162 | <listitem>
|
---|
6163 | <para>Replace any
|
---|
6164 | <computeroutput>IVirtualBox::openSession(uuidMachine,
|
---|
6165 | ...)</computeroutput> API call with the machine's
|
---|
6166 | <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
|
---|
6167 | call and a
|
---|
6168 | <computeroutput>LockType.Write</computeroutput> argument. The
|
---|
6169 | functionality is unchanged, but instead of "opening a direct
|
---|
6170 | session on a machine" all documentation now refers to
|
---|
6171 | "obtaining a write lock on a machine for the client
|
---|
6172 | session".</para>
|
---|
6173 | </listitem>
|
---|
6174 |
|
---|
6175 | <listitem>
|
---|
6176 | <para>Similarly, replace any
|
---|
6177 | <computeroutput>IVirtualBox::openExistingSession(uuidMachine,
|
---|
6178 | ...)</computeroutput> call with the machine's
|
---|
6179 | <link linkend="IMachine__lockMachine">IMachine::lockMachine()</link>
|
---|
6180 | call and a <computeroutput>LockType.Shared</computeroutput>
|
---|
6181 | argument. Whereas it was previously impossible to connect a
|
---|
6182 | client session to a running VM process in a race-free manner,
|
---|
6183 | the new API will atomically either write-lock the machine for
|
---|
6184 | the current session or establish a remote link to an existing
|
---|
6185 | session. Existing client code which tried calling both
|
---|
6186 | <computeroutput>openSession()</computeroutput> and
|
---|
6187 | <computeroutput>openExistingSession()</computeroutput> can now
|
---|
6188 | use this one call instead.</para>
|
---|
6189 | </listitem>
|
---|
6190 |
|
---|
6191 | <listitem>
|
---|
6192 | <para>Third, replace any
|
---|
6193 | <computeroutput>IVirtualBox::openRemoteSession(uuidMachine,
|
---|
6194 | ...)</computeroutput> call with the machine's
|
---|
6195 | <link linkend="IMachine__launchVMProcess">IMachine::launchVMProcess()</link>
|
---|
6196 | call. The functionality is unchanged.</para>
|
---|
6197 | </listitem>
|
---|
6198 |
|
---|
6199 | <listitem>
|
---|
6200 | <para>The <link linkend="SessionState">SessionState</link> enum
|
---|
6201 | was adjusted accordingly: "Open" is now "Locked", "Closed" is
|
---|
6202 | now "Unlocked", "Closing" is now "Unlocking".</para>
|
---|
6203 | </listitem>
|
---|
6204 | </itemizedlist></para>
|
---|
6205 | </listitem>
|
---|
6206 |
|
---|
6207 | <listitem>
|
---|
6208 | <para>Virtual machines created with VirtualBox 4.0 or later no
|
---|
6209 | longer register their media in the global media registry in the
|
---|
6210 | <computeroutput>VirtualBox.xml</computeroutput> file. Instead, such
|
---|
6211 | machines list all their media in their own machine XML files. As a
|
---|
6212 | result, a number of media-related APIs had to be modified again.
|
---|
6213 | <itemizedlist>
|
---|
6214 | <listitem>
|
---|
6215 | <para>Neither
|
---|
6216 | <computeroutput>IVirtualBox::createHardDisk()</computeroutput>
|
---|
6217 | nor
|
---|
6218 | <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>
|
---|
6219 | register media automatically any more.</para>
|
---|
6220 | </listitem>
|
---|
6221 |
|
---|
6222 | <listitem>
|
---|
6223 | <para><link linkend="IMachine__attachDevice">IMachine::attachDevice()</link>
|
---|
6224 | and
|
---|
6225 | <link linkend="IMachine__mountMedium">IMachine::mountMedium()</link>
|
---|
6226 | now take an IMedium object instead of a UUID as an argument. It
|
---|
6227 | is these two calls which add media to a registry now (either a
|
---|
6228 | machine registry for machines created with VirtualBox 4.0 or
|
---|
6229 | later or the global registry otherwise). As a consequence, if a
|
---|
6230 | medium is opened but never attached to a machine, it is no
|
---|
6231 | longer added to any registry any more.</para>
|
---|
6232 | </listitem>
|
---|
6233 |
|
---|
6234 | <listitem>
|
---|
6235 | <para>To reduce code duplication, the APIs
|
---|
6236 | IVirtualBox::findHardDisk(), getHardDisk(), findDVDImage(),
|
---|
6237 | getDVDImage(), findFloppyImage() and getFloppyImage() have all
|
---|
6238 | been merged into IVirtualBox::findMedium(), and
|
---|
6239 | IVirtualBox::openHardDisk(), openDVDImage() and
|
---|
6240 | openFloppyImage() have all been merged into
|
---|
6241 | <link linkend="IVirtualBox__openMedium">IVirtualBox::openMedium()</link>.</para>
|
---|
6242 | </listitem>
|
---|
6243 |
|
---|
6244 | <listitem>
|
---|
6245 | <para>The rare use case of changing the UUID and parent UUID
|
---|
6246 | of a medium previously handled by
|
---|
6247 | <computeroutput>openHardDisk()</computeroutput> is now in a
|
---|
6248 | separate IMedium::setIDs method.</para>
|
---|
6249 | </listitem>
|
---|
6250 |
|
---|
6251 | <listitem>
|
---|
6252 | <para><computeroutput>ISystemProperties::get/setDefaultHardDiskFolder()</computeroutput>
|
---|
6253 | have been removed since disk images are now by default placed
|
---|
6254 | in each machine's folder.</para>
|
---|
6255 | </listitem>
|
---|
6256 |
|
---|
6257 | <listitem>
|
---|
6258 | <para>The
|
---|
6259 | <link linkend="ISystemProperties__infoVDSize">ISystemProperties::infoVDSize</link>
|
---|
6260 | attribute replaces the
|
---|
6261 | <computeroutput>getMaxVDISize()</computeroutput>
|
---|
6262 | API call; this now uses bytes instead of megabytes.</para>
|
---|
6263 | </listitem>
|
---|
6264 | </itemizedlist></para>
|
---|
6265 | </listitem>
|
---|
6266 |
|
---|
6267 | <listitem>
|
---|
6268 | <para>Machine management APIs were enhanced as follows:<itemizedlist>
|
---|
6269 | <listitem>
|
---|
6270 | <para><link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
|
---|
6271 | is no longer restricted to creating machines in the default
|
---|
6272 | "Machines" folder, but can now create machines at arbitrary
|
---|
6273 | locations. For this to work, the parameter list had to be
|
---|
6274 | changed.</para>
|
---|
6275 | </listitem>
|
---|
6276 |
|
---|
6277 | <listitem>
|
---|
6278 | <para>The long-deprecated
|
---|
6279 | <computeroutput>IVirtualBox::createLegacyMachine()</computeroutput>
|
---|
6280 | API has been removed.</para>
|
---|
6281 | </listitem>
|
---|
6282 |
|
---|
6283 | <listitem>
|
---|
6284 | <para>To reduce code duplication and for consistency with the
|
---|
6285 | aforementioned media APIs,
|
---|
6286 | <computeroutput>IVirtualBox::getMachine()</computeroutput> has
|
---|
6287 | been merged with
|
---|
6288 | <link linkend="IVirtualBox__findMachine">IVirtualBox::findMachine()</link>,
|
---|
6289 | and
|
---|
6290 | <computeroutput>IMachine::getSnapshot()</computeroutput> has
|
---|
6291 | been merged with
|
---|
6292 | <link linkend="IMachine__findSnapshot">IMachine::findSnapshot()</link>.</para>
|
---|
6293 | </listitem>
|
---|
6294 |
|
---|
6295 | <listitem>
|
---|
6296 | <para><computeroutput>IVirtualBox::unregisterMachine()</computeroutput>
|
---|
6297 | was replaced with
|
---|
6298 | <link linkend="IMachine__unregister">IMachine::unregister()</link>
|
---|
6299 | with additional functionality for cleaning up machine
|
---|
6300 | files.</para>
|
---|
6301 | </listitem>
|
---|
6302 |
|
---|
6303 | <listitem>
|
---|
6304 | <para><computeroutput>IMachine::deleteSettings</computeroutput>
|
---|
6305 | has been replaced by IMachine::delete, which allows specifying
|
---|
6306 | which disk images are to be deleted as part of the deletion,
|
---|
6307 | and because it can take a while it also returns a
|
---|
6308 | <computeroutput>IProgress</computeroutput> object reference,
|
---|
6309 | so that the completion of the asynchronous activities can be
|
---|
6310 | monitored.</para>
|
---|
6311 | </listitem>
|
---|
6312 |
|
---|
6313 | <listitem>
|
---|
6314 | <para><computeroutput>IConsole::forgetSavedState</computeroutput>
|
---|
6315 | has been renamed to
|
---|
6316 | <computeroutput>IConsole::discardSavedState()</computeroutput>.</para>
|
---|
6317 | </listitem>
|
---|
6318 | </itemizedlist></para>
|
---|
6319 | </listitem>
|
---|
6320 |
|
---|
6321 | <listitem>
|
---|
6322 | <para>All event callbacks APIs were replaced with a new, generic
|
---|
6323 | event mechanism that can be used both locally (COM, XPCOM) and
|
---|
6324 | remotely (web services). Also, the new mechanism is usable from
|
---|
6325 | scripting languages and a local Java. See
|
---|
6326 | <link linkend="IEvent">events</link> for details. The new concept
|
---|
6327 | will require changes to all clients that used event callbacks.</para>
|
---|
6328 | </listitem>
|
---|
6329 |
|
---|
6330 | <listitem>
|
---|
6331 | <para><computeroutput>additionsActive()</computeroutput> was replaced
|
---|
6332 | with
|
---|
6333 | <link linkend="IGuest__additionsRunLevel">additionsRunLevel()</link>
|
---|
6334 | and
|
---|
6335 | <link linkend="IGuest__getAdditionsStatus">getAdditionsStatus()</link>
|
---|
6336 | in order to support a more detailed status of the current Guest
|
---|
6337 | Additions loading/readiness state.
|
---|
6338 | <link linkend="IGuest__additionsVersion">IGuest::additionsVersion()</link>
|
---|
6339 | no longer returns the Guest Additions interface version but the
|
---|
6340 | installed Guest Additions version and revision in form of
|
---|
6341 | <computeroutput>3.3.0r12345</computeroutput>.</para>
|
---|
6342 | </listitem>
|
---|
6343 |
|
---|
6344 | <listitem>
|
---|
6345 | <para>To address shared folders auto-mounting support, the following
|
---|
6346 | APIs were extended to require an additional
|
---|
6347 | <computeroutput>automount</computeroutput> parameter: <itemizedlist>
|
---|
6348 | <listitem>
|
---|
6349 | <para><link linkend="IVirtualBox__createSharedFolder">IVirtualBox::createSharedFolder()</link></para>
|
---|
6350 | </listitem>
|
---|
6351 |
|
---|
6352 | <listitem>
|
---|
6353 | <para><link linkend="IMachine__createSharedFolder">IMachine::createSharedFolder()</link></para>
|
---|
6354 | </listitem>
|
---|
6355 |
|
---|
6356 | <listitem>
|
---|
6357 | <para><link linkend="IConsole__createSharedFolder">IConsole::createSharedFolder()</link></para>
|
---|
6358 | </listitem>
|
---|
6359 | </itemizedlist> Also, a new property named
|
---|
6360 | <computeroutput>autoMount</computeroutput> was added to the
|
---|
6361 | <link linkend="ISharedFolder">ISharedFolder</link>
|
---|
6362 | interface.</para>
|
---|
6363 | </listitem>
|
---|
6364 |
|
---|
6365 | <listitem>
|
---|
6366 | <para>The appliance (OVF) APIs were enhanced as
|
---|
6367 | follows:<itemizedlist>
|
---|
6368 | <listitem>
|
---|
6369 | <para><computeroutput>IMachine::export</computeroutput>
|
---|
6370 | received an extra parameter
|
---|
6371 | <computeroutput>location</computeroutput>, which is used to
|
---|
6372 | decide for the disk naming.</para>
|
---|
6373 | </listitem>
|
---|
6374 |
|
---|
6375 | <listitem>
|
---|
6376 | <para><link linkend="IAppliance__write">IAppliance::write()</link>
|
---|
6377 | received an extra parameter
|
---|
6378 | <computeroutput>manifest</computeroutput>, which can suppress
|
---|
6379 | creating the manifest file on export.</para>
|
---|
6380 | </listitem>
|
---|
6381 |
|
---|
6382 | <listitem>
|
---|
6383 | <para><link linkend="IVFSExplorer__entryList">IVFSExplorer::entryList()</link>
|
---|
6384 | received two extra parameters
|
---|
6385 | <computeroutput>sizes</computeroutput> and
|
---|
6386 | <computeroutput>modes</computeroutput>, which contains the
|
---|
6387 | sizes (in bytes) and the file access modes (in octal form) of
|
---|
6388 | the returned files.</para>
|
---|
6389 | </listitem>
|
---|
6390 | </itemizedlist></para>
|
---|
6391 | </listitem>
|
---|
6392 |
|
---|
6393 | <listitem>
|
---|
6394 | <para>Support for remote desktop access to virtual machines has been
|
---|
6395 | cleaned up to allow third party implementations of the remote
|
---|
6396 | desktop server. This is called the VirtualBox Remote Desktop
|
---|
6397 | Extension (VRDE) and can be added to VirtualBox by installing the
|
---|
6398 | corresponding extension package; see the VirtualBox User Guide for
|
---|
6399 | details.</para>
|
---|
6400 |
|
---|
6401 | <para>The following API changes were made to support the VRDE
|
---|
6402 | interface: <itemizedlist>
|
---|
6403 | <listitem>
|
---|
6404 | <para><computeroutput>IVRDPServer</computeroutput> has been
|
---|
6405 | renamed to
|
---|
6406 | <link linkend="IVRDEServer">IVRDEServer</link>.</para>
|
---|
6407 | </listitem>
|
---|
6408 |
|
---|
6409 | <listitem>
|
---|
6410 | <para><computeroutput>IRemoteDisplayInfo</computeroutput> has
|
---|
6411 | been renamed to
|
---|
6412 | <link linkend="IVRDEServerInfo">IVRDEServerInfo</link>.</para>
|
---|
6413 | </listitem>
|
---|
6414 |
|
---|
6415 | <listitem>
|
---|
6416 | <para><link linkend="IMachine__VRDEServer">IMachine::VRDEServer</link>
|
---|
6417 | replaces
|
---|
6418 | <computeroutput>VRDPServer.</computeroutput></para>
|
---|
6419 | </listitem>
|
---|
6420 |
|
---|
6421 | <listitem>
|
---|
6422 | <para><link linkend="IConsole__VRDEServerInfo">IConsole::VRDEServerInfo</link>
|
---|
6423 | replaces
|
---|
6424 | <computeroutput>RemoteDisplayInfo</computeroutput>.</para>
|
---|
6425 | </listitem>
|
---|
6426 |
|
---|
6427 | <listitem>
|
---|
6428 | <para><link linkend="ISystemProperties__VRDEAuthLibrary">ISystemProperties::VRDEAuthLibrary</link>
|
---|
6429 | replaces
|
---|
6430 | <computeroutput>RemoteDisplayAuthLibrary</computeroutput>.</para>
|
---|
6431 | </listitem>
|
---|
6432 |
|
---|
6433 | <listitem>
|
---|
6434 | <para>The following methods have been implemented in
|
---|
6435 | <computeroutput>IVRDEServer</computeroutput> to support
|
---|
6436 | generic VRDE properties: <itemizedlist>
|
---|
6437 | <listitem>
|
---|
6438 | <para><link linkend="IVRDEServer__setVRDEProperty">IVRDEServer::setVRDEProperty</link></para>
|
---|
6439 | </listitem>
|
---|
6440 |
|
---|
6441 | <listitem>
|
---|
6442 | <para><link linkend="IVRDEServer__getVRDEProperty">IVRDEServer::getVRDEProperty</link></para>
|
---|
6443 | </listitem>
|
---|
6444 |
|
---|
6445 | <listitem>
|
---|
6446 | <para><link linkend="IVRDEServer__VRDEProperties">IVRDEServer::VRDEProperties</link></para>
|
---|
6447 | </listitem>
|
---|
6448 | </itemizedlist></para>
|
---|
6449 |
|
---|
6450 | <para>A few implementation-specific attributes of the old
|
---|
6451 | <computeroutput>IVRDPServer</computeroutput> interface have
|
---|
6452 | been removed and replaced with properties: <itemizedlist>
|
---|
6453 | <listitem>
|
---|
6454 | <para><computeroutput>IVRDPServer::Ports</computeroutput>
|
---|
6455 | has been replaced with the
|
---|
6456 | <computeroutput>"TCP/Ports"</computeroutput> property.
|
---|
6457 | The property value is a string, which contains a
|
---|
6458 | comma-separated list of ports or ranges of ports. Use a
|
---|
6459 | dash between two port numbers to specify a range.
|
---|
6460 | Example:
|
---|
6461 | <computeroutput>"5000,5010-5012"</computeroutput></para>
|
---|
6462 | </listitem>
|
---|
6463 |
|
---|
6464 | <listitem>
|
---|
6465 | <para><computeroutput>IVRDPServer::NetAddress</computeroutput>
|
---|
6466 | has been replaced with the
|
---|
6467 | <computeroutput>"TCP/Address"</computeroutput> property.
|
---|
6468 | The property value is an IP address string. Example:
|
---|
6469 | <computeroutput>"127.0.0.1"</computeroutput></para>
|
---|
6470 | </listitem>
|
---|
6471 |
|
---|
6472 | <listitem>
|
---|
6473 | <para><computeroutput>IVRDPServer::VideoChannel</computeroutput>
|
---|
6474 | has been replaced with the
|
---|
6475 | <computeroutput>"VideoChannel/Enabled"</computeroutput>
|
---|
6476 | property. The property value is either
|
---|
6477 | <computeroutput>"true"</computeroutput> or
|
---|
6478 | <computeroutput>"false"</computeroutput></para>
|
---|
6479 | </listitem>
|
---|
6480 |
|
---|
6481 | <listitem>
|
---|
6482 | <para><computeroutput>IVRDPServer::VideoChannelQuality</computeroutput>
|
---|
6483 | has been replaced with the
|
---|
6484 | <computeroutput>"VideoChannel/Quality"</computeroutput>
|
---|
6485 | property. The property value is a string which contain a
|
---|
6486 | decimal number in range 10..100. Invalid values are
|
---|
6487 | ignored and the quality is set to the default value 75.
|
---|
6488 | Example: <computeroutput>"50"</computeroutput></para>
|
---|
6489 | </listitem>
|
---|
6490 | </itemizedlist></para>
|
---|
6491 | </listitem>
|
---|
6492 | </itemizedlist></para>
|
---|
6493 | </listitem>
|
---|
6494 |
|
---|
6495 | <listitem>
|
---|
6496 | <para>The VirtualBox external authentication module interface has
|
---|
6497 | been updated and made more generic. Because of that,
|
---|
6498 | <computeroutput>VRDPAuthType</computeroutput> enumeration has been
|
---|
6499 | renamed to <link linkend="AuthType">AuthType</link>.</para>
|
---|
6500 | </listitem>
|
---|
6501 | </itemizedlist>
|
---|
6502 | </sect1>
|
---|
6503 |
|
---|
6504 | <sect1>
|
---|
6505 | <title>Incompatible API changes with version 3.2</title>
|
---|
6506 |
|
---|
6507 | <itemizedlist>
|
---|
6508 | <listitem>
|
---|
6509 | <para>The following interfaces were renamed for consistency:
|
---|
6510 | <itemizedlist>
|
---|
6511 | <listitem>
|
---|
6512 | <para>IMachine::getCpuProperty() is now IMachine::getCPUProperty();</para>
|
---|
6513 | </listitem>
|
---|
6514 |
|
---|
6515 | <listitem>
|
---|
6516 | <para>IMachine::setCpuProperty() is now IMachine::setCPUProperty();</para>
|
---|
6517 | </listitem>
|
---|
6518 |
|
---|
6519 | <listitem>
|
---|
6520 | <para>IMachine::getCpuIdLeaf() is now IMachine::getCPUIDLeaf();</para>
|
---|
6521 | </listitem>
|
---|
6522 |
|
---|
6523 | <listitem>
|
---|
6524 | <para>IMachine::setCpuIdLeaf() is now IMachine::setCPUIDLeaf();</para>
|
---|
6525 | </listitem>
|
---|
6526 |
|
---|
6527 | <listitem>
|
---|
6528 | <para>IMachine::removeCpuIdLeaf() is now IMachine::removeCPUIDLeaf();</para>
|
---|
6529 | </listitem>
|
---|
6530 |
|
---|
6531 | <listitem>
|
---|
6532 | <para>IMachine::removeAllCpuIdLeafs() is now IMachine::removeAllCPUIDLeaves();</para>
|
---|
6533 | </listitem>
|
---|
6534 |
|
---|
6535 | <listitem>
|
---|
6536 | <para>the CpuPropertyType enum is now CPUPropertyType.</para>
|
---|
6537 | </listitem>
|
---|
6538 |
|
---|
6539 | <listitem>
|
---|
6540 | <para>IVirtualBoxCallback::onSnapshotDiscarded() is now
|
---|
6541 | IVirtualBoxCallback::onSnapshotDeleted.</para>
|
---|
6542 | </listitem>
|
---|
6543 | </itemizedlist></para>
|
---|
6544 | </listitem>
|
---|
6545 |
|
---|
6546 | <listitem>
|
---|
6547 | <para>When creating a VM configuration with
|
---|
6548 | <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
|
---|
6549 | it is now possible to ignore existing configuration files which would
|
---|
6550 | previously have caused a failure. For this the
|
---|
6551 | <computeroutput>override</computeroutput> parameter was added.</para>
|
---|
6552 | </listitem>
|
---|
6553 |
|
---|
6554 | <listitem>
|
---|
6555 | <para>Deleting snapshots via
|
---|
6556 | <computeroutput>IConsole::deleteSnapshot()</computeroutput> is now
|
---|
6557 | possible while the associated VM is running in almost all cases.
|
---|
6558 | The API is unchanged, but client code that verifies machine states
|
---|
6559 | to determine whether snapshots can be deleted may need to be
|
---|
6560 | adjusted.</para>
|
---|
6561 | </listitem>
|
---|
6562 |
|
---|
6563 | <listitem>
|
---|
6564 | <para>The IoBackendType enumeration was replaced with a boolean flag
|
---|
6565 | (see
|
---|
6566 | <link linkend="IStorageController__useHostIOCache">IStorageController::useHostIOCache</link>).</para>
|
---|
6567 | </listitem>
|
---|
6568 |
|
---|
6569 | <listitem>
|
---|
6570 | <para>To address multi-monitor support, the following APIs were
|
---|
6571 | extended to require an additional
|
---|
6572 | <computeroutput>screenId</computeroutput> parameter: <itemizedlist>
|
---|
6573 | <listitem>
|
---|
6574 | <para>IMachine::querySavedThumbnailSize()</para>
|
---|
6575 | </listitem>
|
---|
6576 |
|
---|
6577 | <listitem>
|
---|
6578 | <para><link linkend="IMachine__readSavedThumbnailToArray">IMachine::readSavedThumbnailToArray()</link></para>
|
---|
6579 | </listitem>
|
---|
6580 |
|
---|
6581 | <listitem>
|
---|
6582 | <para><link linkend="IMachine__querySavedScreenshotInfo">IMachine::querySavedScreenshotPNGSize()</link></para>
|
---|
6583 | </listitem>
|
---|
6584 |
|
---|
6585 | <listitem>
|
---|
6586 | <para><link linkend="IMachine__readSavedScreenshotToArray">IMachine::readSavedScreenshotPNGToArray()</link></para>
|
---|
6587 | </listitem>
|
---|
6588 | </itemizedlist></para>
|
---|
6589 | </listitem>
|
---|
6590 |
|
---|
6591 | <listitem>
|
---|
6592 | <para>The <computeroutput>shape</computeroutput> parameter of
|
---|
6593 | IConsoleCallback::onMousePointerShapeChange was changed from a
|
---|
6594 | implementation-specific pointer to a safearray, enabling scripting
|
---|
6595 | languages to process pointer shapes.</para>
|
---|
6596 | </listitem>
|
---|
6597 | </itemizedlist>
|
---|
6598 | </sect1>
|
---|
6599 |
|
---|
6600 | <sect1>
|
---|
6601 | <title>Incompatible API changes with version 3.1</title>
|
---|
6602 |
|
---|
6603 | <itemizedlist>
|
---|
6604 | <listitem>
|
---|
6605 | <para>Due to the new flexibility in medium attachments that was
|
---|
6606 | introduced with version 3.1 (in particular, full flexibility with
|
---|
6607 | attaching CD/DVD drives to arbitrary controllers), we seized the
|
---|
6608 | opportunity to rework all interfaces dealing with storage media to
|
---|
6609 | make the API more flexible as well as logical. The
|
---|
6610 | <link linkend="IStorageController">IStorageController</link>,
|
---|
6611 | <link linkend="IMedium">IMedium</link>,
|
---|
6612 | <link linkend="IMediumAttachment">IMediumAttachment</link> and
|
---|
6613 | <link linkend="IMachine">IMachine</link> interfaces were
|
---|
6614 | affected the most. Existing code using them to configure storage and
|
---|
6615 | media needs to be carefully checked.</para>
|
---|
6616 |
|
---|
6617 | <para>All media (hard disks, floppies and CDs/DVDs) are now
|
---|
6618 | uniformly handled through the <link linkend="IMedium">IMedium</link>
|
---|
6619 | interface. The device-specific interfaces
|
---|
6620 | (<code>IHardDisk</code>, <code>IDVDImage</code>,
|
---|
6621 | <code>IHostDVDDrive</code>, <code>IFloppyImage</code> and
|
---|
6622 | <code>IHostFloppyDrive</code>) have been merged into IMedium; CD/DVD
|
---|
6623 | and floppy media no longer need special treatment. The device type
|
---|
6624 | of a medium determines in which context it can be used. Some
|
---|
6625 | functionality was moved to the other storage-related
|
---|
6626 | interfaces.</para>
|
---|
6627 |
|
---|
6628 | <para><code>IMachine::attachHardDisk</code> and similar methods have
|
---|
6629 | been renamed and generalized to deal with any type of drive and
|
---|
6630 | medium.
|
---|
6631 | <link linkend="IMachine__attachDevice">IMachine::attachDevice()</link>
|
---|
6632 | is the API method for adding any drive to a storage controller. The
|
---|
6633 | floppy and DVD/CD drives are no longer handled specially, and that
|
---|
6634 | means you can have more than one of them. As before, drives can only
|
---|
6635 | be changed while the VM is powered off. Mounting (or unmounting)
|
---|
6636 | removable media at runtime is possible with
|
---|
6637 | <link linkend="IMachine__mountMedium">IMachine::mountMedium()</link>.</para>
|
---|
6638 |
|
---|
6639 | <para>Newly created virtual machines have no storage controllers
|
---|
6640 | associated with them. Even the IDE Controller needs to be created
|
---|
6641 | explicitly. The floppy controller is now visible as a separate
|
---|
6642 | controller, with a new storage bus type. For each storage bus type
|
---|
6643 | you can query the device types which can be attached, so that it is
|
---|
6644 | not necessary to hardcode any attachment rules.</para>
|
---|
6645 |
|
---|
6646 | <para>This required matching changes e.g. in the callback interfaces
|
---|
6647 | (the medium specific change notification was replaced by a generic
|
---|
6648 | medium change notification) and removing associated enums (e.g.
|
---|
6649 | <code>DriveState</code>). In many places the incorrect use of the
|
---|
6650 | plural form "media" was replaced by "medium", to improve
|
---|
6651 | consistency.</para>
|
---|
6652 | </listitem>
|
---|
6653 |
|
---|
6654 | <listitem>
|
---|
6655 | <para>Reading the
|
---|
6656 | <link linkend="IMedium__state">IMedium::state</link> attribute no
|
---|
6657 | longer automatically performs an accessibility check; a new method
|
---|
6658 | <link linkend="IMedium__refreshState">IMedium::refreshState()</link>
|
---|
6659 | does this. The attribute only returns the state now.</para>
|
---|
6660 | </listitem>
|
---|
6661 |
|
---|
6662 | <listitem>
|
---|
6663 | <para>There were substantial changes related to snapshots, triggered
|
---|
6664 | by the "branched snapshots" functionality introduced with version
|
---|
6665 | 3.1. IConsole::discardSnapshot was renamed to
|
---|
6666 | <computeroutput>IConsole::deleteSnapshot()</computeroutput>.
|
---|
6667 | IConsole::discardCurrentState and
|
---|
6668 | IConsole::discardCurrentSnapshotAndState were removed; corresponding
|
---|
6669 | new functionality is in
|
---|
6670 | <computeroutput>IConsole::restoreSnapshot()</computeroutput>.
|
---|
6671 | Also, when <computeroutput>IConsole::takeSnapshot()</computeroutput>
|
---|
6672 | is called on a running virtual machine, a live snapshot will be
|
---|
6673 | created. The old behavior was to temporarily pause the virtual
|
---|
6674 | machine while creating an online snapshot.</para>
|
---|
6675 | </listitem>
|
---|
6676 |
|
---|
6677 | <listitem>
|
---|
6678 | <para>The <computeroutput>IVRDPServer</computeroutput>,
|
---|
6679 | <computeroutput>IRemoteDisplayInfo"</computeroutput> and
|
---|
6680 | <computeroutput>IConsoleCallback</computeroutput> interfaces were
|
---|
6681 | changed to reflect VRDP server ability to bind to one of available
|
---|
6682 | ports from a list of ports.</para>
|
---|
6683 |
|
---|
6684 | <para>The <computeroutput>IVRDPServer::port</computeroutput>
|
---|
6685 | attribute has been replaced with
|
---|
6686 | <computeroutput>IVRDPServer::ports</computeroutput>, which is a
|
---|
6687 | comma-separated list of ports or ranges of ports.</para>
|
---|
6688 |
|
---|
6689 | <para>An <computeroutput>IRemoteDisplayInfo::port"</computeroutput>
|
---|
6690 | attribute has been added for querying the actual port VRDP server
|
---|
6691 | listens on.</para>
|
---|
6692 |
|
---|
6693 | <para>An IConsoleCallback::onRemoteDisplayInfoChange() notification
|
---|
6694 | callback has been added.</para>
|
---|
6695 | </listitem>
|
---|
6696 |
|
---|
6697 | <listitem>
|
---|
6698 | <para>The parameter lists for the following functions were
|
---|
6699 | modified:<itemizedlist>
|
---|
6700 | <listitem>
|
---|
6701 | <para><link linkend="IHost__removeHostOnlyNetworkInterface">IHost::removeHostOnlyNetworkInterface()</link></para>
|
---|
6702 | </listitem>
|
---|
6703 |
|
---|
6704 | <listitem>
|
---|
6705 | <para><link linkend="IHost__removeUSBDeviceFilter">IHost::removeUSBDeviceFilter()</link></para>
|
---|
6706 | </listitem>
|
---|
6707 | </itemizedlist></para>
|
---|
6708 | </listitem>
|
---|
6709 |
|
---|
6710 | <listitem>
|
---|
6711 | <para>In the OOWS bindings for JAX-WS, the behavior of structures
|
---|
6712 | changed: for one, we implemented natural structures field access so
|
---|
6713 | you can just call a "get" method to obtain a field. Secondly,
|
---|
6714 | setters in structures were disabled as they have no expected effect
|
---|
6715 | and were at best misleading.</para>
|
---|
6716 | </listitem>
|
---|
6717 | </itemizedlist>
|
---|
6718 | </sect1>
|
---|
6719 |
|
---|
6720 | <sect1>
|
---|
6721 | <title>Incompatible API changes with version 3.0</title>
|
---|
6722 |
|
---|
6723 | <itemizedlist>
|
---|
6724 | <listitem>
|
---|
6725 | <para>In the object-oriented web service bindings for JAX-WS, proper
|
---|
6726 | inheritance has been introduced for some classes, so explicit
|
---|
6727 | casting is no longer needed to call methods from a parent class. In
|
---|
6728 | particular, IHardDisk and other classes now properly derive from
|
---|
6729 | <link linkend="IMedium">IMedium</link>.</para>
|
---|
6730 | </listitem>
|
---|
6731 |
|
---|
6732 | <listitem>
|
---|
6733 | <para>All object identifiers (machines, snapshots, disks, etc)
|
---|
6734 | switched from GUIDs to strings (now still having string
|
---|
6735 | representation of GUIDs inside). As a result, no particular internal
|
---|
6736 | structure can be assumed for object identifiers; instead, they
|
---|
6737 | should be treated as opaque unique handles. This change mostly
|
---|
6738 | affects Java and C++ programs; for other languages, GUIDs are
|
---|
6739 | transparently converted to strings.</para>
|
---|
6740 | </listitem>
|
---|
6741 |
|
---|
6742 | <listitem>
|
---|
6743 | <para>The uses of NULL strings have been changed greatly. All out
|
---|
6744 | parameters now use empty strings to signal a null value. For in
|
---|
6745 | parameters both the old NULL and empty string is allowed. This
|
---|
6746 | change was necessary to support more client bindings, especially
|
---|
6747 | using the web service API. Many of them either have no special NULL
|
---|
6748 | value or have trouble dealing with it correctly in the respective
|
---|
6749 | library code.</para>
|
---|
6750 | </listitem>
|
---|
6751 |
|
---|
6752 | <listitem>
|
---|
6753 | <para>Accidentally, the <code>TSBool</code> interface still appeared
|
---|
6754 | in 3.0.0, and was removed in 3.0.2. This is an SDK bug, do not use
|
---|
6755 | the SDK for VirtualBox 3.0.0 for developing clients.</para>
|
---|
6756 | </listitem>
|
---|
6757 |
|
---|
6758 | <listitem>
|
---|
6759 | <para>The type of
|
---|
6760 | <link linkend="IVirtualBoxErrorInfo__resultCode">IVirtualBoxErrorInfo::resultCode</link>
|
---|
6761 | changed from
|
---|
6762 | <computeroutput>result</computeroutput> to
|
---|
6763 | <computeroutput>long</computeroutput>.</para>
|
---|
6764 | </listitem>
|
---|
6765 |
|
---|
6766 | <listitem>
|
---|
6767 | <para>The parameter list of IVirtualBox::openHardDisk was
|
---|
6768 | changed.</para>
|
---|
6769 | </listitem>
|
---|
6770 |
|
---|
6771 | <listitem>
|
---|
6772 | <para>The method IConsole::discardSavedState was renamed to
|
---|
6773 | IConsole::forgetSavedState, and a parameter was added.</para>
|
---|
6774 | </listitem>
|
---|
6775 |
|
---|
6776 | <listitem>
|
---|
6777 | <para>The method IConsole::powerDownAsync was renamed to
|
---|
6778 | <link linkend="IConsole__powerDown">IConsole::powerDown</link>,
|
---|
6779 | and the previous method with that name was deleted. So effectively a
|
---|
6780 | parameter was added.</para>
|
---|
6781 | </listitem>
|
---|
6782 |
|
---|
6783 | <listitem>
|
---|
6784 | <para>In the
|
---|
6785 | <link linkend="IFramebuffer">IFramebuffer</link> interface, the
|
---|
6786 | following were removed:<itemizedlist>
|
---|
6787 | <listitem>
|
---|
6788 | <para>the <computeroutput>operationSupported</computeroutput>
|
---|
6789 | attribute;</para>
|
---|
6790 |
|
---|
6791 | <para>(as a result, the
|
---|
6792 | <computeroutput>FramebufferAccelerationOperation</computeroutput>
|
---|
6793 | enum was no longer needed and removed as well);</para>
|
---|
6794 | </listitem>
|
---|
6795 |
|
---|
6796 | <listitem>
|
---|
6797 | <para>the <computeroutput>solidFill()</computeroutput>
|
---|
6798 | method;</para>
|
---|
6799 | </listitem>
|
---|
6800 |
|
---|
6801 | <listitem>
|
---|
6802 | <para>the <computeroutput>copyScreenBits()</computeroutput>
|
---|
6803 | method.</para>
|
---|
6804 | </listitem>
|
---|
6805 | </itemizedlist></para>
|
---|
6806 | </listitem>
|
---|
6807 |
|
---|
6808 | <listitem>
|
---|
6809 | <para>In the <link linkend="IDisplay">IDisplay</link>
|
---|
6810 | interface, the following were removed:<itemizedlist>
|
---|
6811 | <listitem>
|
---|
6812 | <para>the
|
---|
6813 | <computeroutput>setupInternalFramebuffer()</computeroutput>
|
---|
6814 | method;</para>
|
---|
6815 | </listitem>
|
---|
6816 |
|
---|
6817 | <listitem>
|
---|
6818 | <para>the <computeroutput>lockFramebuffer()</computeroutput>
|
---|
6819 | method;</para>
|
---|
6820 | </listitem>
|
---|
6821 |
|
---|
6822 | <listitem>
|
---|
6823 | <para>the <computeroutput>unlockFramebuffer()</computeroutput>
|
---|
6824 | method;</para>
|
---|
6825 | </listitem>
|
---|
6826 |
|
---|
6827 | <listitem>
|
---|
6828 | <para>the
|
---|
6829 | <computeroutput>registerExternalFramebuffer()</computeroutput>
|
---|
6830 | method.</para>
|
---|
6831 | </listitem>
|
---|
6832 | </itemizedlist></para>
|
---|
6833 | </listitem>
|
---|
6834 | </itemizedlist>
|
---|
6835 | </sect1>
|
---|
6836 |
|
---|
6837 | <sect1>
|
---|
6838 | <title>Incompatible API changes with version 2.2</title>
|
---|
6839 |
|
---|
6840 | <itemizedlist>
|
---|
6841 | <listitem>
|
---|
6842 | <para>Added explicit version number into JAX-WS Java package names,
|
---|
6843 | such as <computeroutput>org.virtualbox_2_2</computeroutput>,
|
---|
6844 | allowing connect to multiple VirtualBox clients from single Java
|
---|
6845 | application.</para>
|
---|
6846 | </listitem>
|
---|
6847 |
|
---|
6848 | <listitem>
|
---|
6849 | <para>The interfaces having a "2" suffix attached to them with
|
---|
6850 | version 2.1 were renamed again to have that suffix removed. This
|
---|
6851 | time around, this change involves only the name, there are no
|
---|
6852 | functional differences.</para>
|
---|
6853 |
|
---|
6854 | <para>As a result, IDVDImage2 is now IDVDImage; IHardDisk2 is now
|
---|
6855 | IHardDisk; IHardDisk2Attachment is now IHardDiskAttachment.</para>
|
---|
6856 |
|
---|
6857 | <para>Consequentially, all related methods and attributes that had a
|
---|
6858 | "2" suffix have been renamed; for example, IMachine::attachHardDisk2
|
---|
6859 | now becomes IMachine::attachHardDisk().</para>
|
---|
6860 | </listitem>
|
---|
6861 |
|
---|
6862 | <listitem>
|
---|
6863 | <para>IVirtualBox::openHardDisk has an extra parameter for opening a
|
---|
6864 | disk read/write or read-only.</para>
|
---|
6865 | </listitem>
|
---|
6866 |
|
---|
6867 | <listitem>
|
---|
6868 | <para>The remaining collections were replaced by more performant
|
---|
6869 | safe-arrays. This affects the following collections:</para>
|
---|
6870 |
|
---|
6871 | <itemizedlist>
|
---|
6872 | <listitem>
|
---|
6873 | <para>IGuestOSTypeCollection</para>
|
---|
6874 | </listitem>
|
---|
6875 |
|
---|
6876 | <listitem>
|
---|
6877 | <para>IHostDVDDriveCollection</para>
|
---|
6878 | </listitem>
|
---|
6879 |
|
---|
6880 | <listitem>
|
---|
6881 | <para>IHostFloppyDriveCollection</para>
|
---|
6882 | </listitem>
|
---|
6883 |
|
---|
6884 | <listitem>
|
---|
6885 | <para>IHostUSBDeviceCollection</para>
|
---|
6886 | </listitem>
|
---|
6887 |
|
---|
6888 | <listitem>
|
---|
6889 | <para>IHostUSBDeviceFilterCollection</para>
|
---|
6890 | </listitem>
|
---|
6891 |
|
---|
6892 | <listitem>
|
---|
6893 | <para>IProgressCollection</para>
|
---|
6894 | </listitem>
|
---|
6895 |
|
---|
6896 | <listitem>
|
---|
6897 | <para>ISharedFolderCollection</para>
|
---|
6898 | </listitem>
|
---|
6899 |
|
---|
6900 | <listitem>
|
---|
6901 | <para>ISnapshotCollection</para>
|
---|
6902 | </listitem>
|
---|
6903 |
|
---|
6904 | <listitem>
|
---|
6905 | <para>IUSBDeviceCollection</para>
|
---|
6906 | </listitem>
|
---|
6907 |
|
---|
6908 | <listitem>
|
---|
6909 | <para>IUSBDeviceFilterCollection</para>
|
---|
6910 | </listitem>
|
---|
6911 | </itemizedlist>
|
---|
6912 | </listitem>
|
---|
6913 |
|
---|
6914 | <listitem>
|
---|
6915 | <para>Since "Host Interface Networking" was renamed to "bridged
|
---|
6916 | networking" and host-only networking was introduced, all associated
|
---|
6917 | interfaces needed renaming as well. In detail:</para>
|
---|
6918 |
|
---|
6919 | <itemizedlist>
|
---|
6920 | <listitem>
|
---|
6921 | <para>The HostNetworkInterfaceType enum has been renamed to
|
---|
6922 | <link linkend="HostNetworkInterfaceMediumType">HostNetworkInterfaceMediumType</link></para>
|
---|
6923 | </listitem>
|
---|
6924 |
|
---|
6925 | <listitem>
|
---|
6926 | <para>The IHostNetworkInterface::type attribute has been renamed
|
---|
6927 | to
|
---|
6928 | <link linkend="IHostNetworkInterface__mediumType">IHostNetworkInterface::mediumType</link></para>
|
---|
6929 | </listitem>
|
---|
6930 |
|
---|
6931 | <listitem>
|
---|
6932 | <para>INetworkAdapter::attachToHostInterface() has been renamed
|
---|
6933 | to INetworkAdapter::attachToBridgedInterface</para>
|
---|
6934 | </listitem>
|
---|
6935 |
|
---|
6936 | <listitem>
|
---|
6937 | <para>In the IHost interface, createHostNetworkInterface() has
|
---|
6938 | been renamed to
|
---|
6939 | <link linkend="IHost__createHostOnlyNetworkInterface">createHostOnlyNetworkInterface()</link></para>
|
---|
6940 | </listitem>
|
---|
6941 |
|
---|
6942 | <listitem>
|
---|
6943 | <para>Similarly, removeHostNetworkInterface() has been renamed
|
---|
6944 | to
|
---|
6945 | <link linkend="IHost__removeHostOnlyNetworkInterface">removeHostOnlyNetworkInterface()</link></para>
|
---|
6946 | </listitem>
|
---|
6947 | </itemizedlist>
|
---|
6948 | </listitem>
|
---|
6949 | </itemizedlist>
|
---|
6950 | </sect1>
|
---|
6951 |
|
---|
6952 | <sect1>
|
---|
6953 | <title>Incompatible API changes with version 2.1</title>
|
---|
6954 |
|
---|
6955 | <itemizedlist>
|
---|
6956 | <listitem>
|
---|
6957 | <para>With VirtualBox 2.1, error codes were added to many error
|
---|
6958 | infos that give the caller a machine-readable (numeric) feedback in
|
---|
6959 | addition to the error string that has always been available. This is
|
---|
6960 | an ongoing process, and future versions of this SDK reference will
|
---|
6961 | document the error codes for each method call.</para>
|
---|
6962 | </listitem>
|
---|
6963 |
|
---|
6964 | <listitem>
|
---|
6965 | <para>The hard disk and other media interfaces were completely
|
---|
6966 | redesigned. This was necessary to account for the support of VMDK,
|
---|
6967 | VHD and other image types; since backwards compatibility had to be
|
---|
6968 | broken anyway, we seized the moment to redesign the interfaces in a
|
---|
6969 | more logical way.</para>
|
---|
6970 |
|
---|
6971 | <itemizedlist>
|
---|
6972 | <listitem>
|
---|
6973 | <para>Previously, the old IHardDisk interface had several
|
---|
6974 | derivatives called IVirtualDiskImage, IVMDKImage, IVHDImage,
|
---|
6975 | IISCSIHardDisk and ICustomHardDisk for the various disk formats
|
---|
6976 | supported by VirtualBox. The new IHardDisk2 interface that comes
|
---|
6977 | with version 2.1 now supports all hard disk image formats
|
---|
6978 | itself.</para>
|
---|
6979 | </listitem>
|
---|
6980 |
|
---|
6981 | <listitem>
|
---|
6982 | <para>IHardDiskFormat is a new interface to describe the
|
---|
6983 | available back-ends for hard disk images (e.g. VDI, VMDK, VHD or
|
---|
6984 | iSCSI). The IHardDisk2::format attribute can be used to find out
|
---|
6985 | the back-end that is in use for a particular hard disk image.
|
---|
6986 | ISystemProperties::hardDiskFormats[] contains a list of all
|
---|
6987 | back-ends supported by the system.
|
---|
6988 | <link linkend="ISystemProperties__defaultHardDiskFormat">ISystemProperties::defaultHardDiskFormat</link>
|
---|
6989 | contains the default system format.</para>
|
---|
6990 | </listitem>
|
---|
6991 |
|
---|
6992 | <listitem>
|
---|
6993 | <para>In addition, the new
|
---|
6994 | <link linkend="IMedium">IMedium</link> interface is a generic
|
---|
6995 | interface for hard disk, DVD and floppy images that contains the
|
---|
6996 | attributes and methods shared between them. It can be considered
|
---|
6997 | a parent class of the more specific interfaces for those images,
|
---|
6998 | which are now IHardDisk2, IDVDImage2 and IFloppyImage2.</para>
|
---|
6999 |
|
---|
7000 | <para>In each case, the "2" versions of these interfaces replace
|
---|
7001 | the earlier versions that did not have the "2" suffix.
|
---|
7002 | Previously, the IDVDImage and IFloppyImage interfaces were
|
---|
7003 | entirely unrelated to IHardDisk.</para>
|
---|
7004 | </listitem>
|
---|
7005 |
|
---|
7006 | <listitem>
|
---|
7007 | <para>As a result, all parts of the API that previously
|
---|
7008 | referenced IHardDisk, IDVDImage or IFloppyImage or any of the
|
---|
7009 | old subclasses are gone and will have replacements that use
|
---|
7010 | IHardDisk2, IDVDImage2 and IFloppyImage2; see, for example,
|
---|
7011 | IMachine::attachHardDisk2.</para>
|
---|
7012 | </listitem>
|
---|
7013 |
|
---|
7014 | <listitem>
|
---|
7015 | <para>In particular, the IVirtualBox::hardDisks2 array replaces
|
---|
7016 | the earlier IVirtualBox::hardDisks collection.</para>
|
---|
7017 | </listitem>
|
---|
7018 | </itemizedlist>
|
---|
7019 | </listitem>
|
---|
7020 |
|
---|
7021 | <listitem>
|
---|
7022 | <para><link linkend="IGuestOSType">IGuestOSType</link> was
|
---|
7023 | extended to group operating systems into families and for 64-bit
|
---|
7024 | support.</para>
|
---|
7025 | </listitem>
|
---|
7026 |
|
---|
7027 | <listitem>
|
---|
7028 | <para>The
|
---|
7029 | <link linkend="IHostNetworkInterface">IHostNetworkInterface</link>
|
---|
7030 | interface was completely rewritten to account for the changes in how
|
---|
7031 | Host Interface Networking is now implemented in VirtualBox
|
---|
7032 | 2.1.</para>
|
---|
7033 | </listitem>
|
---|
7034 |
|
---|
7035 | <listitem>
|
---|
7036 | <para>The IVirtualBox::machines2[] array replaces the former
|
---|
7037 | IVirtualBox::machines collection.</para>
|
---|
7038 | </listitem>
|
---|
7039 |
|
---|
7040 | <listitem>
|
---|
7041 | <para>Added
|
---|
7042 | <link linkend="IHost__getProcessorFeature">IHost::getProcessorFeature()</link>
|
---|
7043 | and <link linkend="ProcessorFeature">ProcessorFeature</link>
|
---|
7044 | enumeration.</para>
|
---|
7045 | </listitem>
|
---|
7046 |
|
---|
7047 | <listitem>
|
---|
7048 | <para>The parameter list for
|
---|
7049 | <link linkend="IVirtualBox__createMachine">IVirtualBox::createMachine()</link>
|
---|
7050 | was modified.</para>
|
---|
7051 | </listitem>
|
---|
7052 |
|
---|
7053 | <listitem>
|
---|
7054 | <para>Added IMachine::pushGuestProperty.</para>
|
---|
7055 | </listitem>
|
---|
7056 |
|
---|
7057 | <listitem>
|
---|
7058 | <para>New attributes in IMachine: accelerate3DEnabled,
|
---|
7059 | HWVirtExVPIDEnabled,
|
---|
7060 | <computeroutput>IMachine::guestPropertyNotificationPatterns</computeroutput>,
|
---|
7061 | <link linkend="IMachine__CPUCount">CPUCount</link>.</para>
|
---|
7062 | </listitem>
|
---|
7063 |
|
---|
7064 | <listitem>
|
---|
7065 | <para>Added
|
---|
7066 | <link linkend="IConsole__powerUpPaused">IConsole::powerUpPaused()</link>
|
---|
7067 | and
|
---|
7068 | <link linkend="IConsole__getGuestEnteredACPIMode">IConsole::getGuestEnteredACPIMode()</link>.</para>
|
---|
7069 | </listitem>
|
---|
7070 |
|
---|
7071 | <listitem>
|
---|
7072 | <para>Removed ResourceUsage enumeration.</para>
|
---|
7073 | </listitem>
|
---|
7074 | </itemizedlist>
|
---|
7075 | </sect1>
|
---|
7076 | </chapter>
|
---|
7077 | </book>
|
---|
7078 | <!-- vim: set shiftwidth=2 tabstop=2 expandtab: -->
|
---|