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 | com::Utf8Str strLoggingLevel;
|
---|
270 | uint32_t ulLogHistoryCount;
|
---|
271 | };
|
---|
272 |
|
---|
273 | struct MachineRegistryEntry
|
---|
274 | {
|
---|
275 | com::Guid uuid;
|
---|
276 | com::Utf8Str strSettingsFile;
|
---|
277 | };
|
---|
278 | typedef std::list<MachineRegistryEntry> MachinesRegistry;
|
---|
279 |
|
---|
280 | struct DHCPServer
|
---|
281 | {
|
---|
282 | DHCPServer()
|
---|
283 | : fEnabled(false)
|
---|
284 | {}
|
---|
285 |
|
---|
286 | com::Utf8Str strNetworkName,
|
---|
287 | strIPAddress,
|
---|
288 | strIPNetworkMask,
|
---|
289 | strIPLower,
|
---|
290 | strIPUpper;
|
---|
291 | bool fEnabled;
|
---|
292 | };
|
---|
293 | typedef std::list<DHCPServer> DHCPServersList;
|
---|
294 |
|
---|
295 |
|
---|
296 | /**
|
---|
297 | * Nat Networking settings (NAT service).
|
---|
298 | */
|
---|
299 | struct NATNetwork
|
---|
300 | {
|
---|
301 | com::Utf8Str strNetworkName;
|
---|
302 | bool fEnabled;
|
---|
303 | com::Utf8Str strNetwork;
|
---|
304 | bool fIPv6;
|
---|
305 | com::Utf8Str strIPv6Prefix;
|
---|
306 | bool fAdvertiseDefaultIPv6Route;
|
---|
307 | bool fNeedDhcpServer;
|
---|
308 | NATRuleList llPortForwardRules4;
|
---|
309 | NATRuleList llPortForwardRules6;
|
---|
310 | NATNetwork():fEnabled(false),
|
---|
311 | fAdvertiseDefaultIPv6Route(false),
|
---|
312 | fNeedDhcpServer(false)
|
---|
313 | {}
|
---|
314 | bool operator==(const NATNetwork &n) const
|
---|
315 | {
|
---|
316 | return strNetworkName == n.strNetworkName
|
---|
317 | && strNetwork == n.strNetwork;
|
---|
318 | }
|
---|
319 |
|
---|
320 | };
|
---|
321 | typedef std::list<NATNetwork> NATNetworksList;
|
---|
322 |
|
---|
323 |
|
---|
324 | class MainConfigFile : public ConfigFileBase
|
---|
325 | {
|
---|
326 | public:
|
---|
327 | MainConfigFile(const com::Utf8Str *pstrFilename);
|
---|
328 |
|
---|
329 | void readMachineRegistry(const xml::ElementNode &elmMachineRegistry);
|
---|
330 | void readDHCPServers(const xml::ElementNode &elmDHCPServers);
|
---|
331 | void readNATNetworks(const xml::ElementNode &elmNATNetworks);
|
---|
332 |
|
---|
333 | void write(const com::Utf8Str strFilename);
|
---|
334 |
|
---|
335 | Host host;
|
---|
336 | SystemProperties systemProperties;
|
---|
337 | MediaRegistry mediaRegistry;
|
---|
338 | MachinesRegistry llMachines;
|
---|
339 | DHCPServersList llDhcpServers;
|
---|
340 | NATNetworksList llNATNetworks;
|
---|
341 | StringsMap mapExtraDataItems;
|
---|
342 | };
|
---|
343 |
|
---|
344 | ////////////////////////////////////////////////////////////////////////////////
|
---|
345 | //
|
---|
346 | // Machine XML structures
|
---|
347 | //
|
---|
348 | ////////////////////////////////////////////////////////////////////////////////
|
---|
349 |
|
---|
350 | /**
|
---|
351 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
352 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
353 | * your settings might never get saved.
|
---|
354 | */
|
---|
355 | struct VRDESettings
|
---|
356 | {
|
---|
357 | VRDESettings()
|
---|
358 | : fEnabled(true),
|
---|
359 | authType(AuthType_Null),
|
---|
360 | ulAuthTimeout(5000),
|
---|
361 | fAllowMultiConnection(false),
|
---|
362 | fReuseSingleConnection(false)
|
---|
363 | {}
|
---|
364 |
|
---|
365 | bool operator==(const VRDESettings& v) const;
|
---|
366 |
|
---|
367 | bool fEnabled;
|
---|
368 | AuthType_T authType;
|
---|
369 | uint32_t ulAuthTimeout;
|
---|
370 | com::Utf8Str strAuthLibrary;
|
---|
371 | bool fAllowMultiConnection,
|
---|
372 | fReuseSingleConnection;
|
---|
373 | com::Utf8Str strVrdeExtPack;
|
---|
374 | StringsMap mapProperties;
|
---|
375 | };
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
379 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
380 | * your settings might never get saved.
|
---|
381 | */
|
---|
382 | struct BIOSSettings
|
---|
383 | {
|
---|
384 | BIOSSettings()
|
---|
385 | : fACPIEnabled(true),
|
---|
386 | fIOAPICEnabled(false),
|
---|
387 | fLogoFadeIn(true),
|
---|
388 | fLogoFadeOut(true),
|
---|
389 | ulLogoDisplayTime(0),
|
---|
390 | biosBootMenuMode(BIOSBootMenuMode_MessageAndMenu),
|
---|
391 | fPXEDebugEnabled(false),
|
---|
392 | llTimeOffset(0)
|
---|
393 | {}
|
---|
394 |
|
---|
395 | bool operator==(const BIOSSettings &d) const;
|
---|
396 |
|
---|
397 | bool fACPIEnabled,
|
---|
398 | fIOAPICEnabled,
|
---|
399 | fLogoFadeIn,
|
---|
400 | fLogoFadeOut;
|
---|
401 | uint32_t ulLogoDisplayTime;
|
---|
402 | com::Utf8Str strLogoImagePath;
|
---|
403 | BIOSBootMenuMode_T biosBootMenuMode;
|
---|
404 | bool fPXEDebugEnabled;
|
---|
405 | int64_t llTimeOffset;
|
---|
406 | };
|
---|
407 |
|
---|
408 | /**
|
---|
409 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
410 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
411 | * your settings might never get saved.
|
---|
412 | */
|
---|
413 | struct USBController
|
---|
414 | {
|
---|
415 | USBController()
|
---|
416 | : fEnabled(false),
|
---|
417 | fEnabledEHCI(false)
|
---|
418 | {}
|
---|
419 |
|
---|
420 | bool operator==(const USBController &u) const;
|
---|
421 |
|
---|
422 | bool fEnabled;
|
---|
423 | bool fEnabledEHCI;
|
---|
424 | USBDeviceFiltersList llDeviceFilters;
|
---|
425 | };
|
---|
426 |
|
---|
427 | struct NAT
|
---|
428 | {
|
---|
429 | NAT()
|
---|
430 | : u32Mtu(0),
|
---|
431 | u32SockRcv(0),
|
---|
432 | u32SockSnd(0),
|
---|
433 | u32TcpRcv(0),
|
---|
434 | u32TcpSnd(0),
|
---|
435 | fDNSPassDomain(true), /* historically this value is true */
|
---|
436 | fDNSProxy(false),
|
---|
437 | fDNSUseHostResolver(false),
|
---|
438 | fAliasLog(false),
|
---|
439 | fAliasProxyOnly(false),
|
---|
440 | fAliasUseSamePorts(false)
|
---|
441 | {}
|
---|
442 |
|
---|
443 | bool operator==(const NAT &n) const
|
---|
444 | {
|
---|
445 | return strNetwork == n.strNetwork
|
---|
446 | && strBindIP == n.strBindIP
|
---|
447 | && u32Mtu == n.u32Mtu
|
---|
448 | && u32SockRcv == n.u32SockRcv
|
---|
449 | && u32SockSnd == n.u32SockSnd
|
---|
450 | && u32TcpSnd == n.u32TcpSnd
|
---|
451 | && u32TcpRcv == n.u32TcpRcv
|
---|
452 | && strTFTPPrefix == n.strTFTPPrefix
|
---|
453 | && strTFTPBootFile == n.strTFTPBootFile
|
---|
454 | && strTFTPNextServer == n.strTFTPNextServer
|
---|
455 | && fDNSPassDomain == n.fDNSPassDomain
|
---|
456 | && fDNSProxy == n.fDNSProxy
|
---|
457 | && fDNSUseHostResolver == n.fDNSUseHostResolver
|
---|
458 | && fAliasLog == n.fAliasLog
|
---|
459 | && fAliasProxyOnly == n.fAliasProxyOnly
|
---|
460 | && fAliasUseSamePorts == n.fAliasUseSamePorts
|
---|
461 | && llRules == n.llRules;
|
---|
462 | }
|
---|
463 |
|
---|
464 | com::Utf8Str strNetwork;
|
---|
465 | com::Utf8Str strBindIP;
|
---|
466 | uint32_t u32Mtu;
|
---|
467 | uint32_t u32SockRcv;
|
---|
468 | uint32_t u32SockSnd;
|
---|
469 | uint32_t u32TcpRcv;
|
---|
470 | uint32_t u32TcpSnd;
|
---|
471 | com::Utf8Str strTFTPPrefix;
|
---|
472 | com::Utf8Str strTFTPBootFile;
|
---|
473 | com::Utf8Str strTFTPNextServer;
|
---|
474 | bool fDNSPassDomain;
|
---|
475 | bool fDNSProxy;
|
---|
476 | bool fDNSUseHostResolver;
|
---|
477 | bool fAliasLog;
|
---|
478 | bool fAliasProxyOnly;
|
---|
479 | bool fAliasUseSamePorts;
|
---|
480 | NATRuleList llRules;
|
---|
481 | };
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
485 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
486 | * your settings might never get saved.
|
---|
487 | */
|
---|
488 | struct NetworkAdapter
|
---|
489 | {
|
---|
490 | NetworkAdapter()
|
---|
491 | : ulSlot(0),
|
---|
492 | type(NetworkAdapterType_Am79C970A),
|
---|
493 | fEnabled(false),
|
---|
494 | fCableConnected(false),
|
---|
495 | ulLineSpeed(0),
|
---|
496 | enmPromiscModePolicy(NetworkAdapterPromiscModePolicy_Deny),
|
---|
497 | fTraceEnabled(false),
|
---|
498 | mode(NetworkAttachmentType_Null),
|
---|
499 | ulBootPriority(0)
|
---|
500 | {}
|
---|
501 |
|
---|
502 | bool operator==(const NetworkAdapter &n) const;
|
---|
503 |
|
---|
504 | uint32_t ulSlot;
|
---|
505 |
|
---|
506 | NetworkAdapterType_T type;
|
---|
507 | bool fEnabled;
|
---|
508 | com::Utf8Str strMACAddress;
|
---|
509 | bool fCableConnected;
|
---|
510 | uint32_t ulLineSpeed;
|
---|
511 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
512 | bool fTraceEnabled;
|
---|
513 | com::Utf8Str strTraceFile;
|
---|
514 |
|
---|
515 | NetworkAttachmentType_T mode;
|
---|
516 | NAT nat;
|
---|
517 | com::Utf8Str strBridgedName;
|
---|
518 | com::Utf8Str strHostOnlyName;
|
---|
519 | com::Utf8Str strInternalNetworkName;
|
---|
520 | com::Utf8Str strGenericDriver;
|
---|
521 | StringsMap genericProperties;
|
---|
522 | uint32_t ulBootPriority;
|
---|
523 | com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2)
|
---|
524 | };
|
---|
525 | typedef std::list<NetworkAdapter> NetworkAdaptersList;
|
---|
526 |
|
---|
527 | /**
|
---|
528 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
529 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
530 | * your settings might never get saved.
|
---|
531 | */
|
---|
532 | struct SerialPort
|
---|
533 | {
|
---|
534 | SerialPort()
|
---|
535 | : ulSlot(0),
|
---|
536 | fEnabled(false),
|
---|
537 | ulIOBase(0x3f8),
|
---|
538 | ulIRQ(4),
|
---|
539 | portMode(PortMode_Disconnected),
|
---|
540 | fServer(false)
|
---|
541 | {}
|
---|
542 |
|
---|
543 | bool operator==(const SerialPort &n) const;
|
---|
544 |
|
---|
545 | uint32_t ulSlot;
|
---|
546 |
|
---|
547 | bool fEnabled;
|
---|
548 | uint32_t ulIOBase;
|
---|
549 | uint32_t ulIRQ;
|
---|
550 | PortMode_T portMode;
|
---|
551 | com::Utf8Str strPath;
|
---|
552 | bool fServer;
|
---|
553 | };
|
---|
554 | typedef std::list<SerialPort> SerialPortsList;
|
---|
555 |
|
---|
556 | /**
|
---|
557 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
558 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
559 | * your settings might never get saved.
|
---|
560 | */
|
---|
561 | struct ParallelPort
|
---|
562 | {
|
---|
563 | ParallelPort()
|
---|
564 | : ulSlot(0),
|
---|
565 | fEnabled(false),
|
---|
566 | ulIOBase(0x378),
|
---|
567 | ulIRQ(7)
|
---|
568 | {}
|
---|
569 |
|
---|
570 | bool operator==(const ParallelPort &d) const;
|
---|
571 |
|
---|
572 | uint32_t ulSlot;
|
---|
573 |
|
---|
574 | bool fEnabled;
|
---|
575 | uint32_t ulIOBase;
|
---|
576 | uint32_t ulIRQ;
|
---|
577 | com::Utf8Str strPath;
|
---|
578 | };
|
---|
579 | typedef std::list<ParallelPort> ParallelPortsList;
|
---|
580 |
|
---|
581 | /**
|
---|
582 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
583 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
584 | * your settings might never get saved.
|
---|
585 | */
|
---|
586 | struct AudioAdapter
|
---|
587 | {
|
---|
588 | AudioAdapter()
|
---|
589 | : fEnabled(true),
|
---|
590 | controllerType(AudioControllerType_AC97),
|
---|
591 | driverType(AudioDriverType_Null)
|
---|
592 | {}
|
---|
593 |
|
---|
594 | bool operator==(const AudioAdapter &a) const
|
---|
595 | {
|
---|
596 | return (this == &a)
|
---|
597 | || ( (fEnabled == a.fEnabled)
|
---|
598 | && (controllerType == a.controllerType)
|
---|
599 | && (driverType == a.driverType)
|
---|
600 | );
|
---|
601 | }
|
---|
602 |
|
---|
603 | bool fEnabled;
|
---|
604 | AudioControllerType_T controllerType;
|
---|
605 | AudioDriverType_T driverType;
|
---|
606 | };
|
---|
607 |
|
---|
608 | /**
|
---|
609 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
610 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
611 | * your settings might never get saved.
|
---|
612 | */
|
---|
613 | struct SharedFolder
|
---|
614 | {
|
---|
615 | SharedFolder()
|
---|
616 | : fWritable(false)
|
---|
617 | , fAutoMount(false)
|
---|
618 | {}
|
---|
619 |
|
---|
620 | bool operator==(const SharedFolder &a) const;
|
---|
621 |
|
---|
622 | com::Utf8Str strName,
|
---|
623 | strHostPath;
|
---|
624 | bool fWritable;
|
---|
625 | bool fAutoMount;
|
---|
626 | };
|
---|
627 | typedef std::list<SharedFolder> SharedFoldersList;
|
---|
628 |
|
---|
629 | /**
|
---|
630 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
631 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
632 | * your settings might never get saved.
|
---|
633 | */
|
---|
634 | struct GuestProperty
|
---|
635 | {
|
---|
636 | GuestProperty()
|
---|
637 | : timestamp(0)
|
---|
638 | {};
|
---|
639 |
|
---|
640 | bool operator==(const GuestProperty &g) const;
|
---|
641 |
|
---|
642 | com::Utf8Str strName,
|
---|
643 | strValue;
|
---|
644 | uint64_t timestamp;
|
---|
645 | com::Utf8Str strFlags;
|
---|
646 | };
|
---|
647 | typedef std::list<GuestProperty> GuestPropertiesList;
|
---|
648 |
|
---|
649 | typedef std::map<uint32_t, DeviceType_T> BootOrderMap;
|
---|
650 |
|
---|
651 | /**
|
---|
652 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
653 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
654 | * your settings might never get saved.
|
---|
655 | */
|
---|
656 | struct CpuIdLeaf
|
---|
657 | {
|
---|
658 | CpuIdLeaf()
|
---|
659 | : ulId(UINT32_MAX),
|
---|
660 | ulEax(0),
|
---|
661 | ulEbx(0),
|
---|
662 | ulEcx(0),
|
---|
663 | ulEdx(0)
|
---|
664 | {}
|
---|
665 |
|
---|
666 | bool operator==(const CpuIdLeaf &c) const
|
---|
667 | {
|
---|
668 | return ( (this == &c)
|
---|
669 | || ( (ulId == c.ulId)
|
---|
670 | && (ulEax == c.ulEax)
|
---|
671 | && (ulEbx == c.ulEbx)
|
---|
672 | && (ulEcx == c.ulEcx)
|
---|
673 | && (ulEdx == c.ulEdx)
|
---|
674 | )
|
---|
675 | );
|
---|
676 | }
|
---|
677 |
|
---|
678 | uint32_t ulId;
|
---|
679 | uint32_t ulEax;
|
---|
680 | uint32_t ulEbx;
|
---|
681 | uint32_t ulEcx;
|
---|
682 | uint32_t ulEdx;
|
---|
683 | };
|
---|
684 | typedef std::list<CpuIdLeaf> CpuIdLeafsList;
|
---|
685 |
|
---|
686 | /**
|
---|
687 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
688 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
689 | * your settings might never get saved.
|
---|
690 | */
|
---|
691 | struct Cpu
|
---|
692 | {
|
---|
693 | Cpu()
|
---|
694 | : ulId(UINT32_MAX)
|
---|
695 | {}
|
---|
696 |
|
---|
697 | bool operator==(const Cpu &c) const
|
---|
698 | {
|
---|
699 | return (ulId == c.ulId);
|
---|
700 | }
|
---|
701 |
|
---|
702 | uint32_t ulId;
|
---|
703 | };
|
---|
704 | typedef std::list<Cpu> CpuList;
|
---|
705 |
|
---|
706 | /**
|
---|
707 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
708 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
709 | * your settings might never get saved.
|
---|
710 | */
|
---|
711 | struct BandwidthGroup
|
---|
712 | {
|
---|
713 | BandwidthGroup()
|
---|
714 | : cMaxBytesPerSec(0),
|
---|
715 | enmType(BandwidthGroupType_Null)
|
---|
716 | {}
|
---|
717 |
|
---|
718 | bool operator==(const BandwidthGroup &i) const
|
---|
719 | {
|
---|
720 | return ( (strName == i.strName)
|
---|
721 | && (cMaxBytesPerSec == i.cMaxBytesPerSec)
|
---|
722 | && (enmType == i.enmType));
|
---|
723 | }
|
---|
724 |
|
---|
725 | com::Utf8Str strName;
|
---|
726 | uint64_t cMaxBytesPerSec;
|
---|
727 | BandwidthGroupType_T enmType;
|
---|
728 | };
|
---|
729 | typedef std::list<BandwidthGroup> BandwidthGroupList;
|
---|
730 |
|
---|
731 | /**
|
---|
732 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
733 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
734 | * your settings might never get saved.
|
---|
735 | */
|
---|
736 | struct IOSettings
|
---|
737 | {
|
---|
738 | IOSettings();
|
---|
739 |
|
---|
740 | bool operator==(const IOSettings &i) const
|
---|
741 | {
|
---|
742 | return ( (fIOCacheEnabled == i.fIOCacheEnabled)
|
---|
743 | && (ulIOCacheSize == i.ulIOCacheSize)
|
---|
744 | && (llBandwidthGroups == i.llBandwidthGroups));
|
---|
745 | }
|
---|
746 |
|
---|
747 | bool fIOCacheEnabled;
|
---|
748 | uint32_t ulIOCacheSize;
|
---|
749 | BandwidthGroupList llBandwidthGroups;
|
---|
750 | };
|
---|
751 |
|
---|
752 | /**
|
---|
753 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
754 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
755 | * your settings might never get saved.
|
---|
756 | */
|
---|
757 | struct HostPCIDeviceAttachment
|
---|
758 | {
|
---|
759 | HostPCIDeviceAttachment()
|
---|
760 | : uHostAddress(0),
|
---|
761 | uGuestAddress(0)
|
---|
762 | {}
|
---|
763 |
|
---|
764 | bool operator==(const HostPCIDeviceAttachment &a) const
|
---|
765 | {
|
---|
766 | return ( (uHostAddress == a.uHostAddress)
|
---|
767 | && (uGuestAddress == a.uGuestAddress)
|
---|
768 | && (strDeviceName == a.strDeviceName)
|
---|
769 | );
|
---|
770 | }
|
---|
771 |
|
---|
772 | com::Utf8Str strDeviceName;
|
---|
773 | uint32_t uHostAddress;
|
---|
774 | uint32_t uGuestAddress;
|
---|
775 | };
|
---|
776 | typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList;
|
---|
777 |
|
---|
778 | /**
|
---|
779 | * Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
|
---|
780 | * field.
|
---|
781 | *
|
---|
782 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
783 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
784 | * your settings might never get saved.
|
---|
785 | */
|
---|
786 | struct Hardware
|
---|
787 | {
|
---|
788 | Hardware();
|
---|
789 |
|
---|
790 | bool operator==(const Hardware&) const;
|
---|
791 |
|
---|
792 | com::Utf8Str strVersion; // hardware version, optional
|
---|
793 | com::Guid uuid; // hardware uuid, optional (null).
|
---|
794 |
|
---|
795 | bool fHardwareVirt,
|
---|
796 | fHardwareVirtExclusive,
|
---|
797 | fNestedPaging,
|
---|
798 | fLargePages,
|
---|
799 | fVPID,
|
---|
800 | fUnrestrictedExecution,
|
---|
801 | fHardwareVirtForce,
|
---|
802 | fSyntheticCpu,
|
---|
803 | fPAE;
|
---|
804 | typedef enum LongModeType { LongMode_Enabled, LongMode_Disabled, LongMode_Legacy } LongModeType;
|
---|
805 | LongModeType enmLongMode;
|
---|
806 | uint32_t cCPUs;
|
---|
807 | bool fCpuHotPlug; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
808 | CpuList llCpus; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
809 | bool fHPETEnabled; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
810 | uint32_t ulCpuExecutionCap; // requires settings version 1.11 (VirtualBox 3.3)
|
---|
811 |
|
---|
812 | CpuIdLeafsList llCpuIdLeafs;
|
---|
813 |
|
---|
814 | uint32_t ulMemorySizeMB;
|
---|
815 |
|
---|
816 | BootOrderMap mapBootOrder; // item 0 has highest priority
|
---|
817 |
|
---|
818 | GraphicsControllerType_T graphicsControllerType;
|
---|
819 | uint32_t ulVRAMSizeMB;
|
---|
820 | uint32_t cMonitors;
|
---|
821 | bool fAccelerate3D,
|
---|
822 | fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
|
---|
823 |
|
---|
824 | uint32_t ulVideoCaptureHorzRes; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
825 | uint32_t ulVideoCaptureVertRes; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
826 | uint32_t ulVideoCaptureRate; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
827 | uint32_t ulVideoCaptureFps; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
828 | bool fVideoCaptureEnabled; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
829 | uint64_t u64VideoCaptureScreens; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
830 | com::Utf8Str strVideoCaptureFile; // requires settings version 1.12 (VirtualBox 4.3)
|
---|
831 |
|
---|
832 | FirmwareType_T firmwareType; // requires settings version 1.9 (VirtualBox 3.1)
|
---|
833 |
|
---|
834 | PointingHIDType_T pointingHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
835 | KeyboardHIDType_T keyboardHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
836 |
|
---|
837 | ChipsetType_T chipsetType; // requires settings version 1.11 (VirtualBox 4.0)
|
---|
838 |
|
---|
839 | bool fEmulatedUSBWebcam; // 1.13 (VirtualBox 4.2)
|
---|
840 | bool fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
|
---|
841 |
|
---|
842 | VRDESettings vrdeSettings;
|
---|
843 |
|
---|
844 | BIOSSettings biosSettings;
|
---|
845 | USBController usbController;
|
---|
846 | NetworkAdaptersList llNetworkAdapters;
|
---|
847 | SerialPortsList llSerialPorts;
|
---|
848 | ParallelPortsList llParallelPorts;
|
---|
849 | AudioAdapter audioAdapter;
|
---|
850 |
|
---|
851 | // technically these two have no business in the hardware section, but for some
|
---|
852 | // clever reason <Hardware> is where they are in the XML....
|
---|
853 | SharedFoldersList llSharedFolders;
|
---|
854 | ClipboardMode_T clipboardMode;
|
---|
855 | DragAndDropMode_T dragAndDropMode;
|
---|
856 |
|
---|
857 | uint32_t ulMemoryBalloonSize;
|
---|
858 | bool fPageFusionEnabled;
|
---|
859 |
|
---|
860 | GuestPropertiesList llGuestProperties;
|
---|
861 | com::Utf8Str strNotificationPatterns;
|
---|
862 |
|
---|
863 | IOSettings ioSettings; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
864 | HostPCIDeviceAttachmentList pciAttachments; // requires settings version 1.12 (VirtualBox 4.1)
|
---|
865 |
|
---|
866 | com::Utf8Str strDefaultFrontend; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
867 | };
|
---|
868 |
|
---|
869 | /**
|
---|
870 | * A device attached to a storage controller. This can either be a
|
---|
871 | * hard disk or a DVD drive or a floppy drive and also specifies
|
---|
872 | * which medium is "in" the drive; as a result, this is a combination
|
---|
873 | * of the Main IMedium and IMediumAttachment interfaces.
|
---|
874 | *
|
---|
875 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
876 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
877 | * your settings might never get saved.
|
---|
878 | */
|
---|
879 | struct AttachedDevice
|
---|
880 | {
|
---|
881 | AttachedDevice()
|
---|
882 | : deviceType(DeviceType_Null),
|
---|
883 | fPassThrough(false),
|
---|
884 | fTempEject(false),
|
---|
885 | fNonRotational(false),
|
---|
886 | lPort(0),
|
---|
887 | lDevice(0)
|
---|
888 | {}
|
---|
889 |
|
---|
890 | bool operator==(const AttachedDevice &a) const;
|
---|
891 |
|
---|
892 | DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed
|
---|
893 |
|
---|
894 | // DVDs can be in pass-through mode:
|
---|
895 | bool fPassThrough;
|
---|
896 |
|
---|
897 | // Whether guest-triggered eject of DVDs will keep the medium in the
|
---|
898 | // VM config or not:
|
---|
899 | bool fTempEject;
|
---|
900 |
|
---|
901 | // Whether the medium is non-rotational:
|
---|
902 | bool fNonRotational;
|
---|
903 |
|
---|
904 | // Whether the medium supports discarding unused blocks:
|
---|
905 | bool fDiscard;
|
---|
906 |
|
---|
907 | int32_t lPort;
|
---|
908 | int32_t lDevice;
|
---|
909 |
|
---|
910 | // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
|
---|
911 | // this is its UUID; it depends on deviceType which media registry this then needs to
|
---|
912 | // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
|
---|
913 | com::Guid uuid;
|
---|
914 |
|
---|
915 | // for DVDs and floppies, the attachment can also be a host device:
|
---|
916 | com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src
|
---|
917 |
|
---|
918 | // Bandwidth group the device is attached to.
|
---|
919 | com::Utf8Str strBwGroup;
|
---|
920 | };
|
---|
921 | typedef std::list<AttachedDevice> AttachedDevicesList;
|
---|
922 |
|
---|
923 | /**
|
---|
924 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
925 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
926 | * your settings might never get saved.
|
---|
927 | */
|
---|
928 | struct StorageController
|
---|
929 | {
|
---|
930 | StorageController()
|
---|
931 | : storageBus(StorageBus_IDE),
|
---|
932 | controllerType(StorageControllerType_PIIX3),
|
---|
933 | ulPortCount(2),
|
---|
934 | ulInstance(0),
|
---|
935 | fUseHostIOCache(true),
|
---|
936 | fBootable(true),
|
---|
937 | lIDE0MasterEmulationPort(0),
|
---|
938 | lIDE0SlaveEmulationPort(0),
|
---|
939 | lIDE1MasterEmulationPort(0),
|
---|
940 | lIDE1SlaveEmulationPort(0)
|
---|
941 | {}
|
---|
942 |
|
---|
943 | bool operator==(const StorageController &s) const;
|
---|
944 |
|
---|
945 | com::Utf8Str strName;
|
---|
946 | StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS
|
---|
947 | StorageControllerType_T controllerType;
|
---|
948 | uint32_t ulPortCount;
|
---|
949 | uint32_t ulInstance;
|
---|
950 | bool fUseHostIOCache;
|
---|
951 | bool fBootable;
|
---|
952 |
|
---|
953 | // only for when controllerType == StorageControllerType_IntelAhci:
|
---|
954 | int32_t lIDE0MasterEmulationPort,
|
---|
955 | lIDE0SlaveEmulationPort,
|
---|
956 | lIDE1MasterEmulationPort,
|
---|
957 | lIDE1SlaveEmulationPort;
|
---|
958 |
|
---|
959 | AttachedDevicesList llAttachedDevices;
|
---|
960 | };
|
---|
961 | typedef std::list<StorageController> StorageControllersList;
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * We wrap the storage controllers list into an extra struct so we can
|
---|
965 | * use an undefined struct without needing std::list<> in all the headers.
|
---|
966 | *
|
---|
967 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
968 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
969 | * your settings might never get saved.
|
---|
970 | */
|
---|
971 | struct Storage
|
---|
972 | {
|
---|
973 | bool operator==(const Storage &s) const;
|
---|
974 |
|
---|
975 | StorageControllersList llStorageControllers;
|
---|
976 | };
|
---|
977 |
|
---|
978 | /**
|
---|
979 | * Settings that has to do with debugging.
|
---|
980 | */
|
---|
981 | struct Debugging
|
---|
982 | {
|
---|
983 | Debugging()
|
---|
984 | : fTracingEnabled(false),
|
---|
985 | fAllowTracingToAccessVM(false),
|
---|
986 | strTracingConfig()
|
---|
987 | { }
|
---|
988 |
|
---|
989 | bool operator==(const Debugging &rOther) const
|
---|
990 | {
|
---|
991 | return fTracingEnabled == rOther.fTracingEnabled
|
---|
992 | && fAllowTracingToAccessVM == rOther.fAllowTracingToAccessVM
|
---|
993 | && strTracingConfig == rOther.strTracingConfig;
|
---|
994 | }
|
---|
995 |
|
---|
996 | bool areDefaultSettings() const
|
---|
997 | {
|
---|
998 | return !fTracingEnabled
|
---|
999 | && !fAllowTracingToAccessVM
|
---|
1000 | && strTracingConfig.isEmpty();
|
---|
1001 | }
|
---|
1002 |
|
---|
1003 | bool fTracingEnabled;
|
---|
1004 | bool fAllowTracingToAccessVM;
|
---|
1005 | com::Utf8Str strTracingConfig;
|
---|
1006 | };
|
---|
1007 |
|
---|
1008 | /**
|
---|
1009 | * Settings that has to do with autostart.
|
---|
1010 | */
|
---|
1011 | struct Autostart
|
---|
1012 | {
|
---|
1013 | Autostart()
|
---|
1014 | : fAutostartEnabled(false),
|
---|
1015 | uAutostartDelay(0),
|
---|
1016 | enmAutostopType(AutostopType_Disabled)
|
---|
1017 | { }
|
---|
1018 |
|
---|
1019 | bool operator==(const Autostart &rOther) const
|
---|
1020 | {
|
---|
1021 | return fAutostartEnabled == rOther.fAutostartEnabled
|
---|
1022 | && uAutostartDelay == rOther.uAutostartDelay
|
---|
1023 | && enmAutostopType == rOther.enmAutostopType;
|
---|
1024 | }
|
---|
1025 |
|
---|
1026 | bool areDefaultSettings() const
|
---|
1027 | {
|
---|
1028 | return !fAutostartEnabled
|
---|
1029 | && !uAutostartDelay
|
---|
1030 | && enmAutostopType == AutostopType_Disabled;
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | bool fAutostartEnabled;
|
---|
1034 | uint32_t uAutostartDelay;
|
---|
1035 | AutostopType_T enmAutostopType;
|
---|
1036 | };
|
---|
1037 |
|
---|
1038 | struct Snapshot;
|
---|
1039 | typedef std::list<Snapshot> SnapshotsList;
|
---|
1040 |
|
---|
1041 | /**
|
---|
1042 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1043 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1044 | * your settings might never get saved.
|
---|
1045 | */
|
---|
1046 | struct Snapshot
|
---|
1047 | {
|
---|
1048 | bool operator==(const Snapshot &s) const;
|
---|
1049 |
|
---|
1050 | com::Guid uuid;
|
---|
1051 | com::Utf8Str strName,
|
---|
1052 | strDescription; // optional
|
---|
1053 | RTTIMESPEC timestamp;
|
---|
1054 |
|
---|
1055 | com::Utf8Str strStateFile; // for online snapshots only
|
---|
1056 |
|
---|
1057 | Hardware hardware;
|
---|
1058 | Storage storage;
|
---|
1059 |
|
---|
1060 | Debugging debugging;
|
---|
1061 | Autostart autostart;
|
---|
1062 |
|
---|
1063 | SnapshotsList llChildSnapshots;
|
---|
1064 | };
|
---|
1065 |
|
---|
1066 | struct MachineUserData
|
---|
1067 | {
|
---|
1068 | MachineUserData()
|
---|
1069 | : fDirectoryIncludesUUID(false),
|
---|
1070 | fNameSync(true),
|
---|
1071 | fTeleporterEnabled(false),
|
---|
1072 | uTeleporterPort(0),
|
---|
1073 | enmFaultToleranceState(FaultToleranceState_Inactive),
|
---|
1074 | uFaultTolerancePort(0),
|
---|
1075 | uFaultToleranceInterval(0),
|
---|
1076 | fRTCUseUTC(false)
|
---|
1077 | {
|
---|
1078 | llGroups.push_back("/");
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 | bool operator==(const MachineUserData &c) const
|
---|
1082 | {
|
---|
1083 | return (strName == c.strName)
|
---|
1084 | && (fDirectoryIncludesUUID == c.fDirectoryIncludesUUID)
|
---|
1085 | && (fNameSync == c.fNameSync)
|
---|
1086 | && (strDescription == c.strDescription)
|
---|
1087 | && (llGroups == c.llGroups)
|
---|
1088 | && (strOsType == c.strOsType)
|
---|
1089 | && (strSnapshotFolder == c.strSnapshotFolder)
|
---|
1090 | && (fTeleporterEnabled == c.fTeleporterEnabled)
|
---|
1091 | && (uTeleporterPort == c.uTeleporterPort)
|
---|
1092 | && (strTeleporterAddress == c.strTeleporterAddress)
|
---|
1093 | && (strTeleporterPassword == c.strTeleporterPassword)
|
---|
1094 | && (enmFaultToleranceState == c.enmFaultToleranceState)
|
---|
1095 | && (uFaultTolerancePort == c.uFaultTolerancePort)
|
---|
1096 | && (uFaultToleranceInterval == c.uFaultToleranceInterval)
|
---|
1097 | && (strFaultToleranceAddress == c.strFaultToleranceAddress)
|
---|
1098 | && (strFaultTolerancePassword == c.strFaultTolerancePassword)
|
---|
1099 | && (fRTCUseUTC == c.fRTCUseUTC)
|
---|
1100 | && (ovIcon == c.ovIcon);
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | com::Utf8Str strName;
|
---|
1104 | bool fDirectoryIncludesUUID;
|
---|
1105 | bool fNameSync;
|
---|
1106 | com::Utf8Str strDescription;
|
---|
1107 | StringsList llGroups;
|
---|
1108 | com::Utf8Str strOsType;
|
---|
1109 | com::Utf8Str strSnapshotFolder;
|
---|
1110 | bool fTeleporterEnabled;
|
---|
1111 | uint32_t uTeleporterPort;
|
---|
1112 | com::Utf8Str strTeleporterAddress;
|
---|
1113 | com::Utf8Str strTeleporterPassword;
|
---|
1114 | FaultToleranceState_T enmFaultToleranceState;
|
---|
1115 | uint32_t uFaultTolerancePort;
|
---|
1116 | com::Utf8Str strFaultToleranceAddress;
|
---|
1117 | com::Utf8Str strFaultTolerancePassword;
|
---|
1118 | uint32_t uFaultToleranceInterval;
|
---|
1119 | bool fRTCUseUTC;
|
---|
1120 | com::Utf8Str ovIcon;
|
---|
1121 | };
|
---|
1122 |
|
---|
1123 | /**
|
---|
1124 | * MachineConfigFile represents an XML machine configuration. All the machine settings
|
---|
1125 | * that go out to the XML (or are read from it) are in here.
|
---|
1126 | *
|
---|
1127 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1128 | * the operator== which is used by Machine::saveSettings(), or otherwise your settings
|
---|
1129 | * might never get saved.
|
---|
1130 | */
|
---|
1131 | class MachineConfigFile : public ConfigFileBase
|
---|
1132 | {
|
---|
1133 | public:
|
---|
1134 | com::Guid uuid;
|
---|
1135 |
|
---|
1136 | MachineUserData machineUserData;
|
---|
1137 |
|
---|
1138 | com::Utf8Str strStateFile;
|
---|
1139 | bool fCurrentStateModified; // optional, default is true
|
---|
1140 | RTTIMESPEC timeLastStateChange; // optional, defaults to now
|
---|
1141 | bool fAborted; // optional, default is false
|
---|
1142 |
|
---|
1143 | com::Guid uuidCurrentSnapshot;
|
---|
1144 |
|
---|
1145 | Hardware hardwareMachine;
|
---|
1146 | Storage storageMachine;
|
---|
1147 | MediaRegistry mediaRegistry;
|
---|
1148 | Debugging debugging;
|
---|
1149 | Autostart autostart;
|
---|
1150 |
|
---|
1151 | StringsMap mapExtraDataItems;
|
---|
1152 |
|
---|
1153 | SnapshotsList llFirstSnapshot; // first snapshot or empty list if there's none
|
---|
1154 |
|
---|
1155 | MachineConfigFile(const com::Utf8Str *pstrFilename);
|
---|
1156 |
|
---|
1157 | bool operator==(const MachineConfigFile &m) const;
|
---|
1158 |
|
---|
1159 | bool canHaveOwnMediaRegistry() const;
|
---|
1160 |
|
---|
1161 | void importMachineXML(const xml::ElementNode &elmMachine);
|
---|
1162 |
|
---|
1163 | void write(const com::Utf8Str &strFilename);
|
---|
1164 |
|
---|
1165 | enum
|
---|
1166 | {
|
---|
1167 | BuildMachineXML_IncludeSnapshots = 0x01,
|
---|
1168 | BuildMachineXML_WriteVboxVersionAttribute = 0x02,
|
---|
1169 | BuildMachineXML_SkipRemovableMedia = 0x04,
|
---|
1170 | BuildMachineXML_MediaRegistry = 0x08,
|
---|
1171 | BuildMachineXML_SuppressSavedState = 0x10
|
---|
1172 | };
|
---|
1173 | void buildMachineXML(xml::ElementNode &elmMachine,
|
---|
1174 | uint32_t fl,
|
---|
1175 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1176 |
|
---|
1177 | static bool isAudioDriverAllowedOnThisHost(AudioDriverType_T drv);
|
---|
1178 | static AudioDriverType_T getHostDefaultAudioDriver();
|
---|
1179 |
|
---|
1180 | private:
|
---|
1181 | void readNetworkAdapters(const xml::ElementNode &elmHardware, NetworkAdaptersList &ll);
|
---|
1182 | void readAttachedNetworkMode(const xml::ElementNode &pelmMode, bool fEnabled, NetworkAdapter &nic);
|
---|
1183 | void readCpuIdTree(const xml::ElementNode &elmCpuid, CpuIdLeafsList &ll);
|
---|
1184 | void readCpuTree(const xml::ElementNode &elmCpu, CpuList &ll);
|
---|
1185 | void readSerialPorts(const xml::ElementNode &elmUART, SerialPortsList &ll);
|
---|
1186 | void readParallelPorts(const xml::ElementNode &elmLPT, ParallelPortsList &ll);
|
---|
1187 | void readAudioAdapter(const xml::ElementNode &elmAudioAdapter, AudioAdapter &aa);
|
---|
1188 | void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw);
|
---|
1189 | void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
|
---|
1190 | void readHardware(const xml::ElementNode &elmHardware, Hardware &hw, Storage &strg);
|
---|
1191 | void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg);
|
---|
1192 | void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg);
|
---|
1193 | void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg);
|
---|
1194 | void readTeleporter(const xml::ElementNode *pElmTeleporter, MachineUserData *pUserData);
|
---|
1195 | void readDebugging(const xml::ElementNode *pElmDbg, Debugging *pDbg);
|
---|
1196 | void readAutostart(const xml::ElementNode *pElmAutostart, Autostart *pAutostart);
|
---|
1197 | void readGroups(const xml::ElementNode *elmGroups, StringsList *pllGroups);
|
---|
1198 | void readSnapshot(const xml::ElementNode &elmSnapshot, Snapshot &snap);
|
---|
1199 | void convertOldOSType_pre1_5(com::Utf8Str &str);
|
---|
1200 | void readMachine(const xml::ElementNode &elmMachine);
|
---|
1201 |
|
---|
1202 | void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, const Storage &strg);
|
---|
1203 | void buildNetworkXML(NetworkAttachmentType_T mode, xml::ElementNode &elmParent, bool fEnabled, const NetworkAdapter &nic);
|
---|
1204 | void buildStorageControllersXML(xml::ElementNode &elmParent,
|
---|
1205 | const Storage &st,
|
---|
1206 | bool fSkipRemovableMedia,
|
---|
1207 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1208 | void buildDebuggingXML(xml::ElementNode *pElmParent, const Debugging *pDbg);
|
---|
1209 | void buildAutostartXML(xml::ElementNode *pElmParent, const Autostart *pAutostart);
|
---|
1210 | void buildGroupsXML(xml::ElementNode *pElmParent, const StringsList *pllGroups);
|
---|
1211 | void buildSnapshotXML(xml::ElementNode &elmParent, const Snapshot &snap);
|
---|
1212 |
|
---|
1213 | void bumpSettingsVersionIfNeeded();
|
---|
1214 | };
|
---|
1215 |
|
---|
1216 | } // namespace settings
|
---|
1217 |
|
---|
1218 |
|
---|
1219 | #endif /* ___VBox_settings_h */
|
---|