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