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