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