1 | /** @file
|
---|
2 | * Settings file data structures.
|
---|
3 | *
|
---|
4 | * These structures are created by the settings file loader and filled with values
|
---|
5 | * copied from the raw XML data. This was all new with VirtualBox 3.1 and allows us
|
---|
6 | * to finally make the XML reader version-independent and read VirtualBox XML files
|
---|
7 | * from earlier and even newer (future) versions without requiring complicated,
|
---|
8 | * tedious and error-prone XSLT conversions.
|
---|
9 | *
|
---|
10 | * It is this file that defines all structures that map VirtualBox global and
|
---|
11 | * machine settings to XML files. These structures are used by the rest of Main,
|
---|
12 | * even though this header file does not require anything else in Main.
|
---|
13 | *
|
---|
14 | * Note: Headers in Main code have been tweaked to only declare the structures
|
---|
15 | * defined here so that this header need only be included from code files that
|
---|
16 | * actually use these structures.
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Copyright (C) 2007-2013 Oracle Corporation
|
---|
21 | *
|
---|
22 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
23 | * available from http://www.virtualbox.org. This file is free software;
|
---|
24 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
25 | * General Public License (GPL) as published by the Free Software
|
---|
26 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
27 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
28 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
29 | *
|
---|
30 | * The contents of this file may alternatively be used under the terms
|
---|
31 | * of the Common Development and Distribution License Version 1.0
|
---|
32 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
33 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
34 | * CDDL are applicable instead of those of the GPL.
|
---|
35 | *
|
---|
36 | * You may elect to license modified versions of this file under the
|
---|
37 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
38 | */
|
---|
39 |
|
---|
40 | #ifndef ___VBox_settings_h
|
---|
41 | #define ___VBox_settings_h
|
---|
42 |
|
---|
43 | #include <iprt/time.h>
|
---|
44 |
|
---|
45 | #include "VBox/com/VirtualBox.h"
|
---|
46 |
|
---|
47 | #include <VBox/com/Guid.h>
|
---|
48 | #include <VBox/com/string.h>
|
---|
49 |
|
---|
50 | #include <list>
|
---|
51 | #include <map>
|
---|
52 |
|
---|
53 | namespace xml
|
---|
54 | {
|
---|
55 | class ElementNode;
|
---|
56 | }
|
---|
57 |
|
---|
58 | namespace settings
|
---|
59 | {
|
---|
60 |
|
---|
61 | class ConfigFileError;
|
---|
62 |
|
---|
63 | ////////////////////////////////////////////////////////////////////////////////
|
---|
64 | //
|
---|
65 | // Structures shared between Machine XML and VirtualBox.xml
|
---|
66 | //
|
---|
67 | ////////////////////////////////////////////////////////////////////////////////
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * USB device filter definition. This struct is used both in MainConfigFile
|
---|
71 | * (for global USB filters) and MachineConfigFile (for machine filters).
|
---|
72 | *
|
---|
73 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
74 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
75 | * your settings might never get saved.
|
---|
76 | */
|
---|
77 | struct USBDeviceFilter
|
---|
78 | {
|
---|
79 | USBDeviceFilter()
|
---|
80 | : fActive(false),
|
---|
81 | action(USBDeviceFilterAction_Null),
|
---|
82 | ulMaskedInterfaces(0)
|
---|
83 | {}
|
---|
84 |
|
---|
85 | bool operator==(const USBDeviceFilter&u) const;
|
---|
86 |
|
---|
87 | com::Utf8Str strName;
|
---|
88 | bool fActive;
|
---|
89 | com::Utf8Str strVendorId,
|
---|
90 | strProductId,
|
---|
91 | strRevision,
|
---|
92 | strManufacturer,
|
---|
93 | strProduct,
|
---|
94 | strSerialNumber,
|
---|
95 | strPort;
|
---|
96 | USBDeviceFilterAction_T action; // only used with host USB filters
|
---|
97 | com::Utf8Str strRemote; // irrelevant for host USB objects
|
---|
98 | uint32_t ulMaskedInterfaces; // irrelevant for host USB objects
|
---|
99 | };
|
---|
100 |
|
---|
101 | typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;
|
---|
102 | typedef std::list<com::Utf8Str> StringsList;
|
---|
103 |
|
---|
104 | // ExtraDataItem (used by both VirtualBox.xml and machines XML)
|
---|
105 | struct USBDeviceFilter;
|
---|
106 | typedef std::list<USBDeviceFilter> USBDeviceFiltersList;
|
---|
107 |
|
---|
108 | struct Medium;
|
---|
109 | typedef std::list<Medium> MediaList;
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
113 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
114 | * your settings might never get saved.
|
---|
115 | */
|
---|
116 | struct Medium
|
---|
117 | {
|
---|
118 | Medium()
|
---|
119 | : fAutoReset(false),
|
---|
120 | hdType(MediumType_Normal)
|
---|
121 | {}
|
---|
122 |
|
---|
123 | com::Guid uuid;
|
---|
124 | com::Utf8Str strLocation;
|
---|
125 | com::Utf8Str strDescription;
|
---|
126 |
|
---|
127 | // the following are for hard disks only:
|
---|
128 | com::Utf8Str strFormat;
|
---|
129 | bool fAutoReset; // optional, only for diffs, default is false
|
---|
130 | StringsMap properties;
|
---|
131 | MediumType_T hdType;
|
---|
132 |
|
---|
133 | MediaList llChildren; // only used with hard disks
|
---|
134 |
|
---|
135 | bool operator==(const Medium &m) const;
|
---|
136 | };
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * A media registry. Starting with VirtualBox 3.3, this can appear in both the
|
---|
140 | * VirtualBox.xml file as well as machine XML files with settings version 1.11
|
---|
141 | * or higher, so these lists are now in ConfigFileBase.
|
---|
142 | *
|
---|
143 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
144 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
145 | * your settings might never get saved.
|
---|
146 | */
|
---|
147 | struct MediaRegistry
|
---|
148 | {
|
---|
149 | MediaList llHardDisks,
|
---|
150 | llDvdImages,
|
---|
151 | llFloppyImages;
|
---|
152 |
|
---|
153 | bool operator==(const MediaRegistry &m) const;
|
---|
154 | };
|
---|
155 |
|
---|
156 | /**
|
---|
157 | *
|
---|
158 | */
|
---|
159 | struct NATRule
|
---|
160 | {
|
---|
161 | NATRule()
|
---|
162 | : proto(NATProtocol_TCP),
|
---|
163 | u16HostPort(0),
|
---|
164 | u16GuestPort(0)
|
---|
165 | {}
|
---|
166 |
|
---|
167 | bool operator==(const NATRule &r) const
|
---|
168 | {
|
---|
169 | return strName == r.strName
|
---|
170 | && proto == r.proto
|
---|
171 | && u16HostPort == r.u16HostPort
|
---|
172 | && strHostIP == r.strHostIP
|
---|
173 | && u16GuestPort == r.u16GuestPort
|
---|
174 | && strGuestIP == r.strGuestIP;
|
---|
175 | }
|
---|
176 |
|
---|
177 | com::Utf8Str strName;
|
---|
178 | NATProtocol_T proto;
|
---|
179 | uint16_t u16HostPort;
|
---|
180 | com::Utf8Str strHostIP;
|
---|
181 | uint16_t u16GuestPort;
|
---|
182 | com::Utf8Str strGuestIP;
|
---|
183 | };
|
---|
184 | typedef std::list<NATRule> NATRuleList;
|
---|
185 |
|
---|
186 | /**
|
---|
187 | * Common base class for both MainConfigFile and MachineConfigFile
|
---|
188 | * which contains some common logic for both.
|
---|
189 | */
|
---|
190 | class ConfigFileBase
|
---|
191 | {
|
---|
192 | public:
|
---|
193 | bool fileExists();
|
---|
194 |
|
---|
195 | void copyBaseFrom(const ConfigFileBase &b);
|
---|
196 |
|
---|
197 | protected:
|
---|
198 | ConfigFileBase(const com::Utf8Str *pstrFilename);
|
---|
199 | /* Note: this copy constructor doesn't create a full copy of other, cause
|
---|
200 | * the file based stuff (xml doc) could not be copied. */
|
---|
201 | ConfigFileBase(const ConfigFileBase &other);
|
---|
202 |
|
---|
203 | ~ConfigFileBase();
|
---|
204 |
|
---|
205 | void parseUUID(com::Guid &guid,
|
---|
206 | const com::Utf8Str &strUUID) const;
|
---|
207 | void parseTimestamp(RTTIMESPEC ×tamp,
|
---|
208 | const com::Utf8Str &str) const;
|
---|
209 |
|
---|
210 | com::Utf8Str makeString(const RTTIMESPEC &tm);
|
---|
211 |
|
---|
212 | void readExtraData(const xml::ElementNode &elmExtraData,
|
---|
213 | StringsMap &map);
|
---|
214 | void readUSBDeviceFilters(const xml::ElementNode &elmDeviceFilters,
|
---|
215 | USBDeviceFiltersList &ll);
|
---|
216 | typedef enum {Error, HardDisk, DVDImage, FloppyImage} MediaType;
|
---|
217 | void readMedium(MediaType t, const xml::ElementNode &elmMedium, MediaList &llMedia);
|
---|
218 | void readMediaRegistry(const xml::ElementNode &elmMediaRegistry, MediaRegistry &mr);
|
---|
219 | void readNATForwardRuleList(const xml::ElementNode &elmParent, NATRuleList &llRules);
|
---|
220 |
|
---|
221 | void setVersionAttribute(xml::ElementNode &elm);
|
---|
222 | void createStubDocument();
|
---|
223 |
|
---|
224 | void buildExtraData(xml::ElementNode &elmParent, const StringsMap &me);
|
---|
225 | void buildUSBDeviceFilters(xml::ElementNode &elmParent,
|
---|
226 | const USBDeviceFiltersList &ll,
|
---|
227 | bool fHostMode);
|
---|
228 | void buildMedium(xml::ElementNode &elmMedium,
|
---|
229 | DeviceType_T devType,
|
---|
230 | const Medium &m,
|
---|
231 | uint32_t level);
|
---|
232 | void buildMediaRegistry(xml::ElementNode &elmParent,
|
---|
233 | const MediaRegistry &mr);
|
---|
234 | void buildNATForwardRuleList(xml::ElementNode &elmParent, const NATRuleList &natRuleList);
|
---|
235 | void clearDocument();
|
---|
236 |
|
---|
237 | struct Data;
|
---|
238 | Data *m;
|
---|
239 |
|
---|
240 | friend class ConfigFileError;
|
---|
241 | };
|
---|
242 |
|
---|
243 | ////////////////////////////////////////////////////////////////////////////////
|
---|
244 | //
|
---|
245 | // VirtualBox.xml structures
|
---|
246 | //
|
---|
247 | ////////////////////////////////////////////////////////////////////////////////
|
---|
248 |
|
---|
249 | struct Host
|
---|
250 | {
|
---|
251 | USBDeviceFiltersList llUSBDeviceFilters;
|
---|
252 | };
|
---|
253 |
|
---|
254 | struct SystemProperties
|
---|
255 | {
|
---|
256 | SystemProperties()
|
---|
257 | : ulLogHistoryCount(3)
|
---|
258 | {}
|
---|
259 |
|
---|
260 | com::Utf8Str strDefaultMachineFolder;
|
---|
261 | com::Utf8Str strDefaultHardDiskFolder;
|
---|
262 | com::Utf8Str strDefaultHardDiskFormat;
|
---|
263 | com::Utf8Str strVRDEAuthLibrary;
|
---|
264 | com::Utf8Str strWebServiceAuthLibrary;
|
---|
265 | com::Utf8Str strDefaultVRDEExtPack;
|
---|
266 | com::Utf8Str strAutostartDatabasePath;
|
---|
267 | com::Utf8Str strDefaultAdditionsISO;
|
---|
268 | com::Utf8Str strDefaultFrontend;
|
---|
269 | uint32_t ulLogHistoryCount;
|
---|
270 | };
|
---|
271 |
|
---|
272 | struct MachineRegistryEntry
|
---|
273 | {
|
---|
274 | com::Guid uuid;
|
---|
275 | com::Utf8Str strSettingsFile;
|
---|
276 | };
|
---|
277 | typedef std::list<MachineRegistryEntry> MachinesRegistry;
|
---|
278 |
|
---|
279 | struct DHCPServer
|
---|
280 | {
|
---|
281 | DHCPServer()
|
---|
282 | : fEnabled(false)
|
---|
283 | {}
|
---|
284 |
|
---|
285 | com::Utf8Str strNetworkName,
|
---|
286 | strIPAddress,
|
---|
287 | strIPNetworkMask,
|
---|
288 | strIPLower,
|
---|
289 | strIPUpper;
|
---|
290 | bool fEnabled;
|
---|
291 | };
|
---|
292 | typedef std::list<DHCPServer> DHCPServersList;
|
---|
293 |
|
---|
294 |
|
---|
295 | /**
|
---|
296 | * Nat Networking settings (NAT service).
|
---|
297 | */
|
---|
298 | struct NATNetwork
|
---|
299 | {
|
---|
300 | com::Utf8Str strNetworkName;
|
---|
301 | bool fEnabled;
|
---|
302 | com::Utf8Str strNetwork;
|
---|
303 | bool fIPv6;
|
---|
304 | com::Utf8Str strIPv6Prefix;
|
---|
305 | bool fAdvertiseDefaultIPv6Route;
|
---|
306 | bool fNeedDhcpServer;
|
---|
307 | NATRuleList llPortForwardRules4;
|
---|
308 | NATRuleList llPortForwardRules6;
|
---|
309 | NATNetwork():fEnabled(false),
|
---|
310 | fAdvertiseDefaultIPv6Route(false),
|
---|
311 | fNeedDhcpServer(false)
|
---|
312 | {}
|
---|
313 | bool operator==(const NATNetwork &n) const
|
---|
314 | {
|
---|
315 | return strNetworkName == n.strNetworkName
|
---|
316 | && strNetwork == n.strNetwork;
|
---|
317 | }
|
---|
318 |
|
---|
319 | };
|
---|
320 | typedef std::list<NATNetwork> NATNetworksList;
|
---|
321 |
|
---|
322 |
|
---|
323 | class MainConfigFile : public ConfigFileBase
|
---|
324 | {
|
---|
325 | public:
|
---|
326 | MainConfigFile(const com::Utf8Str *pstrFilename);
|
---|
327 |
|
---|
328 | void readMachineRegistry(const xml::ElementNode &elmMachineRegistry);
|
---|
329 | void readDHCPServers(const xml::ElementNode &elmDHCPServers);
|
---|
330 | void readNATNetworks(const xml::ElementNode &elmNATNetworks);
|
---|
331 |
|
---|
332 | void write(const com::Utf8Str strFilename);
|
---|
333 |
|
---|
334 | Host host;
|
---|
335 | SystemProperties systemProperties;
|
---|
336 | MediaRegistry mediaRegistry;
|
---|
337 | MachinesRegistry llMachines;
|
---|
338 | DHCPServersList llDhcpServers;
|
---|
339 | NATNetworksList llNATNetworks;
|
---|
340 | StringsMap mapExtraDataItems;
|
---|
341 | };
|
---|
342 |
|
---|
343 | ////////////////////////////////////////////////////////////////////////////////
|
---|
344 | //
|
---|
345 | // Machine XML structures
|
---|
346 | //
|
---|
347 | ////////////////////////////////////////////////////////////////////////////////
|
---|
348 |
|
---|
349 | /**
|
---|
350 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
351 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
352 | * your settings might never get saved.
|
---|
353 | */
|
---|
354 | struct VRDESettings
|
---|
355 | {
|
---|
356 | VRDESettings()
|
---|
357 | : fEnabled(true),
|
---|
358 | authType(AuthType_Null),
|
---|
359 | ulAuthTimeout(5000),
|
---|
360 | fAllowMultiConnection(false),
|
---|
361 | fReuseSingleConnection(false)
|
---|
362 | {}
|
---|
363 |
|
---|
364 | bool operator==(const VRDESettings& v) const;
|
---|
365 |
|
---|
366 | bool fEnabled;
|
---|
367 | AuthType_T authType;
|
---|
368 | uint32_t ulAuthTimeout;
|
---|
369 | com::Utf8Str strAuthLibrary;
|
---|
370 | bool fAllowMultiConnection,
|
---|
371 | fReuseSingleConnection;
|
---|
372 | com::Utf8Str strVrdeExtPack;
|
---|
373 | StringsMap mapProperties;
|
---|
374 | };
|
---|
375 |
|
---|
376 | /**
|
---|
377 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
378 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
379 | * your settings might never get saved.
|
---|
380 | */
|
---|
381 | struct BIOSSettings
|
---|
382 | {
|
---|
383 | BIOSSettings()
|
---|
384 | : fACPIEnabled(true),
|
---|
385 | fIOAPICEnabled(false),
|
---|
386 | fLogoFadeIn(true),
|
---|
387 | fLogoFadeOut(true),
|
---|
388 | ulLogoDisplayTime(0),
|
---|
389 | biosBootMenuMode(BIOSBootMenuMode_MessageAndMenu),
|
---|
390 | fPXEDebugEnabled(false),
|
---|
391 | llTimeOffset(0)
|
---|
392 | {}
|
---|
393 |
|
---|
394 | bool operator==(const BIOSSettings &d) const;
|
---|
395 |
|
---|
396 | bool fACPIEnabled,
|
---|
397 | fIOAPICEnabled,
|
---|
398 | fLogoFadeIn,
|
---|
399 | fLogoFadeOut;
|
---|
400 | uint32_t ulLogoDisplayTime;
|
---|
401 | com::Utf8Str strLogoImagePath;
|
---|
402 | BIOSBootMenuMode_T biosBootMenuMode;
|
---|
403 | bool fPXEDebugEnabled;
|
---|
404 | int64_t llTimeOffset;
|
---|
405 | };
|
---|
406 |
|
---|
407 | /**
|
---|
408 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
409 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
410 | * your settings might never get saved.
|
---|
411 | */
|
---|
412 | struct USBController
|
---|
413 | {
|
---|
414 | USBController()
|
---|
415 | : fEnabled(false),
|
---|
416 | fEnabledEHCI(false)
|
---|
417 | {}
|
---|
418 |
|
---|
419 | bool operator==(const USBController &u) const;
|
---|
420 |
|
---|
421 | bool fEnabled;
|
---|
422 | bool fEnabledEHCI;
|
---|
423 | USBDeviceFiltersList llDeviceFilters;
|
---|
424 | };
|
---|
425 |
|
---|
426 | struct NAT
|
---|
427 | {
|
---|
428 | NAT()
|
---|
429 | : u32Mtu(0),
|
---|
430 | u32SockRcv(0),
|
---|
431 | u32SockSnd(0),
|
---|
432 | u32TcpRcv(0),
|
---|
433 | u32TcpSnd(0),
|
---|
434 | fDNSPassDomain(true), /* historically this value is true */
|
---|
435 | fDNSProxy(false),
|
---|
436 | fDNSUseHostResolver(false),
|
---|
437 | fAliasLog(false),
|
---|
438 | fAliasProxyOnly(false),
|
---|
439 | fAliasUseSamePorts(false)
|
---|
440 | {}
|
---|
441 |
|
---|
442 | bool operator==(const NAT &n) const
|
---|
443 | {
|
---|
444 | return strNetwork == n.strNetwork
|
---|
445 | && strBindIP == n.strBindIP
|
---|
446 | && u32Mtu == n.u32Mtu
|
---|
447 | && u32SockRcv == n.u32SockRcv
|
---|
448 | && u32SockSnd == n.u32SockSnd
|
---|
449 | && u32TcpSnd == n.u32TcpSnd
|
---|
450 | && u32TcpRcv == n.u32TcpRcv
|
---|
451 | && strTFTPPrefix == n.strTFTPPrefix
|
---|
452 | && strTFTPBootFile == n.strTFTPBootFile
|
---|
453 | && strTFTPNextServer == n.strTFTPNextServer
|
---|
454 | && fDNSPassDomain == n.fDNSPassDomain
|
---|
455 | && fDNSProxy == n.fDNSProxy
|
---|
456 | && fDNSUseHostResolver == n.fDNSUseHostResolver
|
---|
457 | && fAliasLog == n.fAliasLog
|
---|
458 | && fAliasProxyOnly == n.fAliasProxyOnly
|
---|
459 | && fAliasUseSamePorts == n.fAliasUseSamePorts
|
---|
460 | && llRules == n.llRules;
|
---|
461 | }
|
---|
462 |
|
---|
463 | com::Utf8Str strNetwork;
|
---|
464 | com::Utf8Str strBindIP;
|
---|
465 | uint32_t u32Mtu;
|
---|
466 | uint32_t u32SockRcv;
|
---|
467 | uint32_t u32SockSnd;
|
---|
468 | uint32_t u32TcpRcv;
|
---|
469 | uint32_t u32TcpSnd;
|
---|
470 | com::Utf8Str strTFTPPrefix;
|
---|
471 | com::Utf8Str strTFTPBootFile;
|
---|
472 | com::Utf8Str strTFTPNextServer;
|
---|
473 | bool fDNSPassDomain;
|
---|
474 | bool fDNSProxy;
|
---|
475 | bool fDNSUseHostResolver;
|
---|
476 | bool fAliasLog;
|
---|
477 | bool fAliasProxyOnly;
|
---|
478 | bool fAliasUseSamePorts;
|
---|
479 | NATRuleList llRules;
|
---|
480 | };
|
---|
481 |
|
---|
482 | /**
|
---|
483 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
484 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
485 | * your settings might never get saved.
|
---|
486 | */
|
---|
487 | struct NetworkAdapter
|
---|
488 | {
|
---|
489 | NetworkAdapter()
|
---|
490 | : ulSlot(0),
|
---|
491 | type(NetworkAdapterType_Am79C970A),
|
---|
492 | fEnabled(false),
|
---|
493 | fCableConnected(false),
|
---|
494 | ulLineSpeed(0),
|
---|
495 | enmPromiscModePolicy(NetworkAdapterPromiscModePolicy_Deny),
|
---|
496 | fTraceEnabled(false),
|
---|
497 | mode(NetworkAttachmentType_Null),
|
---|
498 | ulBootPriority(0)
|
---|
499 | {}
|
---|
500 |
|
---|
501 | bool operator==(const NetworkAdapter &n) const;
|
---|
502 |
|
---|
503 | uint32_t ulSlot;
|
---|
504 |
|
---|
505 | NetworkAdapterType_T type;
|
---|
506 | bool fEnabled;
|
---|
507 | com::Utf8Str strMACAddress;
|
---|
508 | bool fCableConnected;
|
---|
509 | uint32_t ulLineSpeed;
|
---|
510 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
511 | bool fTraceEnabled;
|
---|
512 | com::Utf8Str strTraceFile;
|
---|
513 |
|
---|
514 | NetworkAttachmentType_T mode;
|
---|
515 | NAT nat;
|
---|
516 | com::Utf8Str strBridgedName;
|
---|
517 | com::Utf8Str strHostOnlyName;
|
---|
518 | com::Utf8Str strInternalNetworkName;
|
---|
519 | com::Utf8Str strGenericDriver;
|
---|
520 | StringsMap genericProperties;
|
---|
521 | uint32_t ulBootPriority;
|
---|
522 | com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2)
|
---|
523 | };
|
---|
524 | typedef std::list<NetworkAdapter> NetworkAdaptersList;
|
---|
525 |
|
---|
526 | /**
|
---|
527 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
528 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
529 | * your settings might never get saved.
|
---|
530 | */
|
---|
531 | struct SerialPort
|
---|
532 | {
|
---|
533 | SerialPort()
|
---|
534 | : ulSlot(0),
|
---|
535 | fEnabled(false),
|
---|
536 | ulIOBase(0x3f8),
|
---|
537 | ulIRQ(4),
|
---|
538 | portMode(PortMode_Disconnected),
|
---|
539 | fServer(false)
|
---|
540 | {}
|
---|
541 |
|
---|
542 | bool operator==(const SerialPort &n) const;
|
---|
543 |
|
---|
544 | uint32_t ulSlot;
|
---|
545 |
|
---|
546 | bool fEnabled;
|
---|
547 | uint32_t ulIOBase;
|
---|
548 | uint32_t ulIRQ;
|
---|
549 | PortMode_T portMode;
|
---|
550 | com::Utf8Str strPath;
|
---|
551 | bool fServer;
|
---|
552 | };
|
---|
553 | typedef std::list<SerialPort> SerialPortsList;
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
557 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
558 | * your settings might never get saved.
|
---|
559 | */
|
---|
560 | struct ParallelPort
|
---|
561 | {
|
---|
562 | ParallelPort()
|
---|
563 | : ulSlot(0),
|
---|
564 | fEnabled(false),
|
---|
565 | ulIOBase(0x378),
|
---|
566 | ulIRQ(7)
|
---|
567 | {}
|
---|
568 |
|
---|
569 | bool operator==(const ParallelPort &d) const;
|
---|
570 |
|
---|
571 | uint32_t ulSlot;
|
---|
572 |
|
---|
573 | bool fEnabled;
|
---|
574 | uint32_t ulIOBase;
|
---|
575 | uint32_t ulIRQ;
|
---|
576 | com::Utf8Str strPath;
|
---|
577 | };
|
---|
578 | typedef std::list<ParallelPort> ParallelPortsList;
|
---|
579 |
|
---|
580 | /**
|
---|
581 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
582 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
583 | * your settings might never get saved.
|
---|
584 | */
|
---|
585 | struct AudioAdapter
|
---|
586 | {
|
---|
587 | AudioAdapter()
|
---|
588 | : fEnabled(true),
|
---|
589 | controllerType(AudioControllerType_AC97),
|
---|
590 | driverType(AudioDriverType_Null)
|
---|
591 | {}
|
---|
592 |
|
---|
593 | bool operator==(const AudioAdapter &a) const
|
---|
594 | {
|
---|
595 | return (this == &a)
|
---|
596 | || ( (fEnabled == a.fEnabled)
|
---|
597 | && (controllerType == a.controllerType)
|
---|
598 | && (driverType == a.driverType)
|
---|
599 | );
|
---|
600 | }
|
---|
601 |
|
---|
602 | bool fEnabled;
|
---|
603 | AudioControllerType_T controllerType;
|
---|
604 | AudioDriverType_T driverType;
|
---|
605 | };
|
---|
606 |
|
---|
607 | /**
|
---|
608 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
609 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
610 | * your settings might never get saved.
|
---|
611 | */
|
---|
612 | struct SharedFolder
|
---|
613 | {
|
---|
614 | SharedFolder()
|
---|
615 | : fWritable(false)
|
---|
616 | , fAutoMount(false)
|
---|
617 | {}
|
---|
618 |
|
---|
619 | bool operator==(const SharedFolder &a) const;
|
---|
620 |
|
---|
621 | com::Utf8Str strName,
|
---|
622 | strHostPath;
|
---|
623 | bool fWritable;
|
---|
624 | bool fAutoMount;
|
---|
625 | };
|
---|
626 | typedef std::list<SharedFolder> SharedFoldersList;
|
---|
627 |
|
---|
628 | /**
|
---|
629 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
630 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
631 | * your settings might never get saved.
|
---|
632 | */
|
---|
633 | struct GuestProperty
|
---|
634 | {
|
---|
635 | GuestProperty()
|
---|
636 | : timestamp(0)
|
---|
637 | {};
|
---|
638 |
|
---|
639 | bool operator==(const GuestProperty &g) const;
|
---|
640 |
|
---|
641 | com::Utf8Str strName,
|
---|
642 | strValue;
|
---|
643 | uint64_t timestamp;
|
---|
644 | com::Utf8Str strFlags;
|
---|
645 | };
|
---|
646 | typedef std::list<GuestProperty> GuestPropertiesList;
|
---|
647 |
|
---|
648 | typedef std::map<uint32_t, DeviceType_T> BootOrderMap;
|
---|
649 |
|
---|
650 | /**
|
---|
651 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
652 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
653 | * your settings might never get saved.
|
---|
654 | */
|
---|
655 | struct CpuIdLeaf
|
---|
656 | {
|
---|
657 | CpuIdLeaf()
|
---|
658 | : ulId(UINT32_MAX),
|
---|
659 | ulEax(0),
|
---|
660 | ulEbx(0),
|
---|
661 | ulEcx(0),
|
---|
662 | ulEdx(0)
|
---|
663 | {}
|
---|
664 |
|
---|
665 | bool operator==(const CpuIdLeaf &c) const
|
---|
666 | {
|
---|
667 | return ( (this == &c)
|
---|
668 | || ( (ulId == c.ulId)
|
---|
669 | && (ulEax == c.ulEax)
|
---|
670 | && (ulEbx == c.ulEbx)
|
---|
671 | && (ulEcx == c.ulEcx)
|
---|
672 | && (ulEdx == c.ulEdx)
|
---|
673 | )
|
---|
674 | );
|
---|
675 | }
|
---|
676 |
|
---|
677 | uint32_t ulId;
|
---|
678 | uint32_t ulEax;
|
---|
679 | uint32_t ulEbx;
|
---|
680 | uint32_t ulEcx;
|
---|
681 | uint32_t ulEdx;
|
---|
682 | };
|
---|
683 | typedef std::list<CpuIdLeaf> CpuIdLeafsList;
|
---|
684 |
|
---|
685 | /**
|
---|
686 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
687 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
688 | * your settings might never get saved.
|
---|
689 | */
|
---|
690 | struct Cpu
|
---|
691 | {
|
---|
692 | Cpu()
|
---|
693 | : ulId(UINT32_MAX)
|
---|
694 | {}
|
---|
695 |
|
---|
696 | bool operator==(const Cpu &c) const
|
---|
697 | {
|
---|
698 | return (ulId == c.ulId);
|
---|
699 | }
|
---|
700 |
|
---|
701 | uint32_t ulId;
|
---|
702 | };
|
---|
703 | typedef std::list<Cpu> CpuList;
|
---|
704 |
|
---|
705 | /**
|
---|
706 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
707 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
708 | * your settings might never get saved.
|
---|
709 | */
|
---|
710 | struct BandwidthGroup
|
---|
711 | {
|
---|
712 | BandwidthGroup()
|
---|
713 | : cMaxBytesPerSec(0),
|
---|
714 | enmType(BandwidthGroupType_Null)
|
---|
715 | {}
|
---|
716 |
|
---|
717 | bool operator==(const BandwidthGroup &i) const
|
---|
718 | {
|
---|
719 | return ( (strName == i.strName)
|
---|
720 | && (cMaxBytesPerSec == i.cMaxBytesPerSec)
|
---|
721 | && (enmType == i.enmType));
|
---|
722 | }
|
---|
723 |
|
---|
724 | com::Utf8Str strName;
|
---|
725 | uint64_t cMaxBytesPerSec;
|
---|
726 | BandwidthGroupType_T enmType;
|
---|
727 | };
|
---|
728 | typedef std::list<BandwidthGroup> BandwidthGroupList;
|
---|
729 |
|
---|
730 | /**
|
---|
731 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
732 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
733 | * your settings might never get saved.
|
---|
734 | */
|
---|
735 | struct IOSettings
|
---|
736 | {
|
---|
737 | IOSettings();
|
---|
738 |
|
---|
739 | bool operator==(const IOSettings &i) const
|
---|
740 | {
|
---|
741 | return ( (fIOCacheEnabled == i.fIOCacheEnabled)
|
---|
742 | && (ulIOCacheSize == i.ulIOCacheSize)
|
---|
743 | && (llBandwidthGroups == i.llBandwidthGroups));
|
---|
744 | }
|
---|
745 |
|
---|
746 | bool fIOCacheEnabled;
|
---|
747 | uint32_t ulIOCacheSize;
|
---|
748 | BandwidthGroupList llBandwidthGroups;
|
---|
749 | };
|
---|
750 |
|
---|
751 | /**
|
---|
752 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
753 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
754 | * your settings might never get saved.
|
---|
755 | */
|
---|
756 | struct HostPCIDeviceAttachment
|
---|
757 | {
|
---|
758 | HostPCIDeviceAttachment()
|
---|
759 | : uHostAddress(0),
|
---|
760 | uGuestAddress(0)
|
---|
761 | {}
|
---|
762 |
|
---|
763 | bool operator==(const HostPCIDeviceAttachment &a) const
|
---|
764 | {
|
---|
765 | return ( (uHostAddress == a.uHostAddress)
|
---|
766 | && (uGuestAddress == a.uGuestAddress)
|
---|
767 | && (strDeviceName == a.strDeviceName)
|
---|
768 | );
|
---|
769 | }
|
---|
770 |
|
---|
771 | com::Utf8Str strDeviceName;
|
---|
772 | uint32_t uHostAddress;
|
---|
773 | uint32_t uGuestAddress;
|
---|
774 | };
|
---|
775 | typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList;
|
---|
776 |
|
---|
777 | /**
|
---|
778 | * Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
|
---|
779 | * field.
|
---|
780 | *
|
---|
781 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
782 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
783 | * your settings might never get saved.
|
---|
784 | */
|
---|
785 | struct Hardware
|
---|
786 | {
|
---|
787 | Hardware();
|
---|
788 |
|
---|
789 | bool operator==(const Hardware&) const;
|
---|
790 |
|
---|
791 | com::Utf8Str strVersion; // hardware version, optional
|
---|
792 | com::Guid uuid; // hardware uuid, optional (null).
|
---|
793 |
|
---|
794 | bool fHardwareVirt,
|
---|
795 | fHardwareVirtExclusive,
|
---|
796 | fNestedPaging,
|
---|
797 | fLargePages,
|
---|
798 | fVPID,
|
---|
799 | fHardwareVirtForce,
|
---|
800 | fSyntheticCpu,
|
---|
801 | fPAE;
|
---|
802 | uint32_t cCPUs;
|
---|
803 | bool fCpuHotPlug; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
804 | CpuList llCpus; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
805 | bool fHPETEnabled; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
806 | uint32_t ulCpuExecutionCap; // requires settings version 1.11 (VirtualBox 3.3)
|
---|
807 |
|
---|
808 | CpuIdLeafsList llCpuIdLeafs;
|
---|
809 |
|
---|
810 | uint32_t ulMemorySizeMB;
|
---|
811 |
|
---|
812 | BootOrderMap mapBootOrder; // item 0 has highest priority
|
---|
813 |
|
---|
814 | uint32_t ulVRAMSizeMB;
|
---|
815 | uint32_t cMonitors;
|
---|
816 | bool fAccelerate3D,
|
---|
817 | fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
|
---|
818 | uint32_t ulVideoCaptureHorzRes;
|
---|
819 | uint32_t ulVideoCaptureVertRes;
|
---|
820 | bool fVideoCaptureEnabled;
|
---|
821 | com::Utf8Str strVideoCaptureFile;
|
---|
822 | FirmwareType_T firmwareType; // requires settings version 1.9 (VirtualBox 3.1)
|
---|
823 |
|
---|
824 | PointingHIDType_T pointingHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
825 | KeyboardHIDType_T keyboardHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
826 |
|
---|
827 | ChipsetType_T chipsetType; // requires settings version 1.11 (VirtualBox 4.0)
|
---|
828 |
|
---|
829 | bool fEmulatedUSBWebcam; // 1.13 (VirtualBox 4.2)
|
---|
830 | bool fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
|
---|
831 |
|
---|
832 | VRDESettings vrdeSettings;
|
---|
833 |
|
---|
834 | BIOSSettings biosSettings;
|
---|
835 | USBController usbController;
|
---|
836 | NetworkAdaptersList llNetworkAdapters;
|
---|
837 | SerialPortsList llSerialPorts;
|
---|
838 | ParallelPortsList llParallelPorts;
|
---|
839 | AudioAdapter audioAdapter;
|
---|
840 |
|
---|
841 | // technically these two have no business in the hardware section, but for some
|
---|
842 | // clever reason <Hardware> is where they are in the XML....
|
---|
843 | SharedFoldersList llSharedFolders;
|
---|
844 | ClipboardMode_T clipboardMode;
|
---|
845 | DragAndDropMode_T dragAndDropMode;
|
---|
846 |
|
---|
847 | uint32_t ulMemoryBalloonSize;
|
---|
848 | bool fPageFusionEnabled;
|
---|
849 |
|
---|
850 | GuestPropertiesList llGuestProperties;
|
---|
851 | com::Utf8Str strNotificationPatterns;
|
---|
852 |
|
---|
853 | IOSettings ioSettings; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
854 | HostPCIDeviceAttachmentList pciAttachments; // requires settings version 1.12 (VirtualBox 4.1)
|
---|
855 |
|
---|
856 | com::Utf8Str strDefaultFrontend; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
857 | };
|
---|
858 |
|
---|
859 | /**
|
---|
860 | * A device attached to a storage controller. This can either be a
|
---|
861 | * hard disk or a DVD drive or a floppy drive and also specifies
|
---|
862 | * which medium is "in" the drive; as a result, this is a combination
|
---|
863 | * of the Main IMedium and IMediumAttachment interfaces.
|
---|
864 | *
|
---|
865 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
866 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
867 | * your settings might never get saved.
|
---|
868 | */
|
---|
869 | struct AttachedDevice
|
---|
870 | {
|
---|
871 | AttachedDevice()
|
---|
872 | : deviceType(DeviceType_Null),
|
---|
873 | fPassThrough(false),
|
---|
874 | fTempEject(false),
|
---|
875 | fNonRotational(false),
|
---|
876 | lPort(0),
|
---|
877 | lDevice(0)
|
---|
878 | {}
|
---|
879 |
|
---|
880 | bool operator==(const AttachedDevice &a) const;
|
---|
881 |
|
---|
882 | DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed
|
---|
883 |
|
---|
884 | // DVDs can be in pass-through mode:
|
---|
885 | bool fPassThrough;
|
---|
886 |
|
---|
887 | // Whether guest-triggered eject of DVDs will keep the medium in the
|
---|
888 | // VM config or not:
|
---|
889 | bool fTempEject;
|
---|
890 |
|
---|
891 | // Whether the medium is non-rotational:
|
---|
892 | bool fNonRotational;
|
---|
893 |
|
---|
894 | // Whether the medium supports discarding unused blocks:
|
---|
895 | bool fDiscard;
|
---|
896 |
|
---|
897 | int32_t lPort;
|
---|
898 | int32_t lDevice;
|
---|
899 |
|
---|
900 | // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
|
---|
901 | // this is its UUID; it depends on deviceType which media registry this then needs to
|
---|
902 | // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
|
---|
903 | com::Guid uuid;
|
---|
904 |
|
---|
905 | // for DVDs and floppies, the attachment can also be a host device:
|
---|
906 | com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src
|
---|
907 |
|
---|
908 | // Bandwidth group the device is attached to.
|
---|
909 | com::Utf8Str strBwGroup;
|
---|
910 | };
|
---|
911 | typedef std::list<AttachedDevice> AttachedDevicesList;
|
---|
912 |
|
---|
913 | /**
|
---|
914 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
915 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
916 | * your settings might never get saved.
|
---|
917 | */
|
---|
918 | struct StorageController
|
---|
919 | {
|
---|
920 | StorageController()
|
---|
921 | : storageBus(StorageBus_IDE),
|
---|
922 | controllerType(StorageControllerType_PIIX3),
|
---|
923 | ulPortCount(2),
|
---|
924 | ulInstance(0),
|
---|
925 | fUseHostIOCache(true),
|
---|
926 | fBootable(true),
|
---|
927 | lIDE0MasterEmulationPort(0),
|
---|
928 | lIDE0SlaveEmulationPort(0),
|
---|
929 | lIDE1MasterEmulationPort(0),
|
---|
930 | lIDE1SlaveEmulationPort(0)
|
---|
931 | {}
|
---|
932 |
|
---|
933 | bool operator==(const StorageController &s) const;
|
---|
934 |
|
---|
935 | com::Utf8Str strName;
|
---|
936 | StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS
|
---|
937 | StorageControllerType_T controllerType;
|
---|
938 | uint32_t ulPortCount;
|
---|
939 | uint32_t ulInstance;
|
---|
940 | bool fUseHostIOCache;
|
---|
941 | bool fBootable;
|
---|
942 |
|
---|
943 | // only for when controllerType == StorageControllerType_IntelAhci:
|
---|
944 | int32_t lIDE0MasterEmulationPort,
|
---|
945 | lIDE0SlaveEmulationPort,
|
---|
946 | lIDE1MasterEmulationPort,
|
---|
947 | lIDE1SlaveEmulationPort;
|
---|
948 |
|
---|
949 | AttachedDevicesList llAttachedDevices;
|
---|
950 | };
|
---|
951 | typedef std::list<StorageController> StorageControllersList;
|
---|
952 |
|
---|
953 | /**
|
---|
954 | * We wrap the storage controllers list into an extra struct so we can
|
---|
955 | * use an undefined struct without needing std::list<> in all the headers.
|
---|
956 | *
|
---|
957 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
958 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
959 | * your settings might never get saved.
|
---|
960 | */
|
---|
961 | struct Storage
|
---|
962 | {
|
---|
963 | bool operator==(const Storage &s) const;
|
---|
964 |
|
---|
965 | StorageControllersList llStorageControllers;
|
---|
966 | };
|
---|
967 |
|
---|
968 | /**
|
---|
969 | * Settings that has to do with debugging.
|
---|
970 | */
|
---|
971 | struct Debugging
|
---|
972 | {
|
---|
973 | Debugging()
|
---|
974 | : fTracingEnabled(false),
|
---|
975 | fAllowTracingToAccessVM(false),
|
---|
976 | strTracingConfig()
|
---|
977 | { }
|
---|
978 |
|
---|
979 | bool operator==(const Debugging &rOther) const
|
---|
980 | {
|
---|
981 | return fTracingEnabled == rOther.fTracingEnabled
|
---|
982 | && fAllowTracingToAccessVM == rOther.fAllowTracingToAccessVM
|
---|
983 | && strTracingConfig == rOther.strTracingConfig;
|
---|
984 | }
|
---|
985 |
|
---|
986 | bool areDefaultSettings() const
|
---|
987 | {
|
---|
988 | return !fTracingEnabled
|
---|
989 | && !fAllowTracingToAccessVM
|
---|
990 | && strTracingConfig.isEmpty();
|
---|
991 | }
|
---|
992 |
|
---|
993 | bool fTracingEnabled;
|
---|
994 | bool fAllowTracingToAccessVM;
|
---|
995 | com::Utf8Str strTracingConfig;
|
---|
996 | };
|
---|
997 |
|
---|
998 | /**
|
---|
999 | * Settings that has to do with autostart.
|
---|
1000 | */
|
---|
1001 | struct Autostart
|
---|
1002 | {
|
---|
1003 | Autostart()
|
---|
1004 | : fAutostartEnabled(false),
|
---|
1005 | uAutostartDelay(0),
|
---|
1006 | enmAutostopType(AutostopType_Disabled)
|
---|
1007 | { }
|
---|
1008 |
|
---|
1009 | bool operator==(const Autostart &rOther) const
|
---|
1010 | {
|
---|
1011 | return fAutostartEnabled == rOther.fAutostartEnabled
|
---|
1012 | && uAutostartDelay == rOther.uAutostartDelay
|
---|
1013 | && enmAutostopType == rOther.enmAutostopType;
|
---|
1014 | }
|
---|
1015 |
|
---|
1016 | bool areDefaultSettings() const
|
---|
1017 | {
|
---|
1018 | return !fAutostartEnabled
|
---|
1019 | && !uAutostartDelay
|
---|
1020 | && enmAutostopType == AutostopType_Disabled;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | bool fAutostartEnabled;
|
---|
1024 | uint32_t uAutostartDelay;
|
---|
1025 | AutostopType_T enmAutostopType;
|
---|
1026 | };
|
---|
1027 |
|
---|
1028 | struct Snapshot;
|
---|
1029 | typedef std::list<Snapshot> SnapshotsList;
|
---|
1030 |
|
---|
1031 | /**
|
---|
1032 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1033 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1034 | * your settings might never get saved.
|
---|
1035 | */
|
---|
1036 | struct Snapshot
|
---|
1037 | {
|
---|
1038 | bool operator==(const Snapshot &s) const;
|
---|
1039 |
|
---|
1040 | com::Guid uuid;
|
---|
1041 | com::Utf8Str strName,
|
---|
1042 | strDescription; // optional
|
---|
1043 | RTTIMESPEC timestamp;
|
---|
1044 |
|
---|
1045 | com::Utf8Str strStateFile; // for online snapshots only
|
---|
1046 |
|
---|
1047 | Hardware hardware;
|
---|
1048 | Storage storage;
|
---|
1049 |
|
---|
1050 | Debugging debugging;
|
---|
1051 | Autostart autostart;
|
---|
1052 |
|
---|
1053 | SnapshotsList llChildSnapshots;
|
---|
1054 | };
|
---|
1055 |
|
---|
1056 | struct MachineUserData
|
---|
1057 | {
|
---|
1058 | MachineUserData()
|
---|
1059 | : fDirectoryIncludesUUID(false),
|
---|
1060 | fNameSync(true),
|
---|
1061 | fTeleporterEnabled(false),
|
---|
1062 | uTeleporterPort(0),
|
---|
1063 | enmFaultToleranceState(FaultToleranceState_Inactive),
|
---|
1064 | uFaultTolerancePort(0),
|
---|
1065 | uFaultToleranceInterval(0),
|
---|
1066 | fRTCUseUTC(false)
|
---|
1067 | {
|
---|
1068 | llGroups.push_back("/");
|
---|
1069 | }
|
---|
1070 |
|
---|
1071 | bool operator==(const MachineUserData &c) const
|
---|
1072 | {
|
---|
1073 | return (strName == c.strName)
|
---|
1074 | && (fDirectoryIncludesUUID == c.fDirectoryIncludesUUID)
|
---|
1075 | && (fNameSync == c.fNameSync)
|
---|
1076 | && (strDescription == c.strDescription)
|
---|
1077 | && (llGroups == c.llGroups)
|
---|
1078 | && (strOsType == c.strOsType)
|
---|
1079 | && (strSnapshotFolder == c.strSnapshotFolder)
|
---|
1080 | && (fTeleporterEnabled == c.fTeleporterEnabled)
|
---|
1081 | && (uTeleporterPort == c.uTeleporterPort)
|
---|
1082 | && (strTeleporterAddress == c.strTeleporterAddress)
|
---|
1083 | && (strTeleporterPassword == c.strTeleporterPassword)
|
---|
1084 | && (enmFaultToleranceState == c.enmFaultToleranceState)
|
---|
1085 | && (uFaultTolerancePort == c.uFaultTolerancePort)
|
---|
1086 | && (uFaultToleranceInterval == c.uFaultToleranceInterval)
|
---|
1087 | && (strFaultToleranceAddress == c.strFaultToleranceAddress)
|
---|
1088 | && (strFaultTolerancePassword == c.strFaultTolerancePassword)
|
---|
1089 | && (fRTCUseUTC == c.fRTCUseUTC);
|
---|
1090 | }
|
---|
1091 |
|
---|
1092 | com::Utf8Str strName;
|
---|
1093 | bool fDirectoryIncludesUUID;
|
---|
1094 | bool fNameSync;
|
---|
1095 | com::Utf8Str strDescription;
|
---|
1096 | StringsList llGroups;
|
---|
1097 | com::Utf8Str strOsType;
|
---|
1098 | com::Utf8Str strSnapshotFolder;
|
---|
1099 | bool fTeleporterEnabled;
|
---|
1100 | uint32_t uTeleporterPort;
|
---|
1101 | com::Utf8Str strTeleporterAddress;
|
---|
1102 | com::Utf8Str strTeleporterPassword;
|
---|
1103 | FaultToleranceState_T enmFaultToleranceState;
|
---|
1104 | uint32_t uFaultTolerancePort;
|
---|
1105 | com::Utf8Str strFaultToleranceAddress;
|
---|
1106 | com::Utf8Str strFaultTolerancePassword;
|
---|
1107 | uint32_t uFaultToleranceInterval;
|
---|
1108 | bool fRTCUseUTC;
|
---|
1109 | };
|
---|
1110 |
|
---|
1111 | /**
|
---|
1112 | * MachineConfigFile represents an XML machine configuration. All the machine settings
|
---|
1113 | * that go out to the XML (or are read from it) are in here.
|
---|
1114 | *
|
---|
1115 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1116 | * the operator== which is used by Machine::saveSettings(), or otherwise your settings
|
---|
1117 | * might never get saved.
|
---|
1118 | */
|
---|
1119 | class MachineConfigFile : public ConfigFileBase
|
---|
1120 | {
|
---|
1121 | public:
|
---|
1122 | com::Guid uuid;
|
---|
1123 |
|
---|
1124 | MachineUserData machineUserData;
|
---|
1125 |
|
---|
1126 | com::Utf8Str strStateFile;
|
---|
1127 | bool fCurrentStateModified; // optional, default is true
|
---|
1128 | RTTIMESPEC timeLastStateChange; // optional, defaults to now
|
---|
1129 | bool fAborted; // optional, default is false
|
---|
1130 |
|
---|
1131 | com::Guid uuidCurrentSnapshot;
|
---|
1132 |
|
---|
1133 | Hardware hardwareMachine;
|
---|
1134 | Storage storageMachine;
|
---|
1135 | MediaRegistry mediaRegistry;
|
---|
1136 | Debugging debugging;
|
---|
1137 | Autostart autostart;
|
---|
1138 |
|
---|
1139 | StringsMap mapExtraDataItems;
|
---|
1140 |
|
---|
1141 | SnapshotsList llFirstSnapshot; // first snapshot or empty list if there's none
|
---|
1142 |
|
---|
1143 | MachineConfigFile(const com::Utf8Str *pstrFilename);
|
---|
1144 |
|
---|
1145 | bool operator==(const MachineConfigFile &m) const;
|
---|
1146 |
|
---|
1147 | bool canHaveOwnMediaRegistry() const;
|
---|
1148 |
|
---|
1149 | void importMachineXML(const xml::ElementNode &elmMachine);
|
---|
1150 |
|
---|
1151 | void write(const com::Utf8Str &strFilename);
|
---|
1152 |
|
---|
1153 | enum
|
---|
1154 | {
|
---|
1155 | BuildMachineXML_IncludeSnapshots = 0x01,
|
---|
1156 | BuildMachineXML_WriteVboxVersionAttribute = 0x02,
|
---|
1157 | BuildMachineXML_SkipRemovableMedia = 0x04,
|
---|
1158 | BuildMachineXML_MediaRegistry = 0x08,
|
---|
1159 | BuildMachineXML_SuppressSavedState = 0x10
|
---|
1160 | };
|
---|
1161 | void buildMachineXML(xml::ElementNode &elmMachine,
|
---|
1162 | uint32_t fl,
|
---|
1163 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1164 |
|
---|
1165 | static bool isAudioDriverAllowedOnThisHost(AudioDriverType_T drv);
|
---|
1166 | static AudioDriverType_T getHostDefaultAudioDriver();
|
---|
1167 |
|
---|
1168 | private:
|
---|
1169 | void readNetworkAdapters(const xml::ElementNode &elmHardware, NetworkAdaptersList &ll);
|
---|
1170 | void readAttachedNetworkMode(const xml::ElementNode &pelmMode, bool fEnabled, NetworkAdapter &nic);
|
---|
1171 | void readCpuIdTree(const xml::ElementNode &elmCpuid, CpuIdLeafsList &ll);
|
---|
1172 | void readCpuTree(const xml::ElementNode &elmCpu, CpuList &ll);
|
---|
1173 | void readSerialPorts(const xml::ElementNode &elmUART, SerialPortsList &ll);
|
---|
1174 | void readParallelPorts(const xml::ElementNode &elmLPT, ParallelPortsList &ll);
|
---|
1175 | void readAudioAdapter(const xml::ElementNode &elmAudioAdapter, AudioAdapter &aa);
|
---|
1176 | void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw);
|
---|
1177 | void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
|
---|
1178 | void readHardware(const xml::ElementNode &elmHardware, Hardware &hw, Storage &strg);
|
---|
1179 | void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg);
|
---|
1180 | void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg);
|
---|
1181 | void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg);
|
---|
1182 | void readTeleporter(const xml::ElementNode *pElmTeleporter, MachineUserData *pUserData);
|
---|
1183 | void readDebugging(const xml::ElementNode *pElmDbg, Debugging *pDbg);
|
---|
1184 | void readAutostart(const xml::ElementNode *pElmAutostart, Autostart *pAutostart);
|
---|
1185 | void readGroups(const xml::ElementNode *elmGroups, StringsList *pllGroups);
|
---|
1186 | void readSnapshot(const xml::ElementNode &elmSnapshot, Snapshot &snap);
|
---|
1187 | void convertOldOSType_pre1_5(com::Utf8Str &str);
|
---|
1188 | void readMachine(const xml::ElementNode &elmMachine);
|
---|
1189 |
|
---|
1190 | void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, const Storage &strg);
|
---|
1191 | void buildNetworkXML(NetworkAttachmentType_T mode, xml::ElementNode &elmParent, bool fEnabled, const NetworkAdapter &nic);
|
---|
1192 | void buildStorageControllersXML(xml::ElementNode &elmParent,
|
---|
1193 | const Storage &st,
|
---|
1194 | bool fSkipRemovableMedia,
|
---|
1195 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1196 | void buildDebuggingXML(xml::ElementNode *pElmParent, const Debugging *pDbg);
|
---|
1197 | void buildAutostartXML(xml::ElementNode *pElmParent, const Autostart *pAutostart);
|
---|
1198 | void buildGroupsXML(xml::ElementNode *pElmParent, const StringsList *pllGroups);
|
---|
1199 | void buildSnapshotXML(xml::ElementNode &elmParent, const Snapshot &snap);
|
---|
1200 |
|
---|
1201 | void bumpSettingsVersionIfNeeded();
|
---|
1202 | };
|
---|
1203 |
|
---|
1204 | } // namespace settings
|
---|
1205 |
|
---|
1206 |
|
---|
1207 | #endif /* ___VBox_settings_h */
|
---|