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