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-2023 Oracle and/or its affiliates.
|
---|
21 | *
|
---|
22 | * This file is part of VirtualBox base platform packages, as
|
---|
23 | * available from https://www.virtualbox.org.
|
---|
24 | *
|
---|
25 | * This program is free software; you can redistribute it and/or
|
---|
26 | * modify it under the terms of the GNU General Public License
|
---|
27 | * as published by the Free Software Foundation, in version 3 of the
|
---|
28 | * License.
|
---|
29 | *
|
---|
30 | * This program is distributed in the hope that it will be useful, but
|
---|
31 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
33 | * General Public License for more details.
|
---|
34 | *
|
---|
35 | * You should have received a copy of the GNU General Public License
|
---|
36 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
37 | *
|
---|
38 | * The contents of this file may alternatively be used under the terms
|
---|
39 | * of the Common Development and Distribution License Version 1.0
|
---|
40 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
41 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
42 | * CDDL are applicable instead of those of the GPL.
|
---|
43 | *
|
---|
44 | * You may elect to license modified versions of this file under the
|
---|
45 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
46 | *
|
---|
47 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
48 | */
|
---|
49 |
|
---|
50 | #ifndef VBOX_INCLUDED_settings_h
|
---|
51 | #define VBOX_INCLUDED_settings_h
|
---|
52 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
53 | # pragma once
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | #include <iprt/time.h>
|
---|
57 |
|
---|
58 | #include "VBox/com/VirtualBox.h"
|
---|
59 |
|
---|
60 | #include <VBox/com/Guid.h>
|
---|
61 | #include <VBox/com/string.h>
|
---|
62 | #include <VBox/VBoxCryptoIf.h>
|
---|
63 |
|
---|
64 | #include <list>
|
---|
65 | #include <map>
|
---|
66 | #include <vector>
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Maximum depth of a medium tree, to prevent stack overflows.
|
---|
70 | * XPCOM has a relatively low stack size for its workers, and we have
|
---|
71 | * to avoid crashes due to exceeding the limit both on reading and
|
---|
72 | * writing config files. The bottleneck is in libxml2.
|
---|
73 | * Data point: a release and asan build could both handle 3800 on Debian 10.
|
---|
74 | */
|
---|
75 | #define SETTINGS_MEDIUM_DEPTH_MAX 300
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Maximum depth of the snapshot tree, to prevent stack overflows.
|
---|
79 | * XPCOM has a relatively low stack size for its workers, and we have
|
---|
80 | * to avoid crashes due to exceeding the limit both on reading and
|
---|
81 | * writing config files. The bottleneck is reading config files with
|
---|
82 | * deep snapshot nesting, as libxml2 needs quite some stack space.
|
---|
83 | * Data point: a release and asan build could both handle 1300 on Debian 10.
|
---|
84 | */
|
---|
85 | #define SETTINGS_SNAPSHOT_DEPTH_MAX 250
|
---|
86 |
|
---|
87 | namespace xml
|
---|
88 | {
|
---|
89 | class ElementNode;
|
---|
90 | }
|
---|
91 |
|
---|
92 | namespace settings
|
---|
93 | {
|
---|
94 |
|
---|
95 | class ConfigFileError;
|
---|
96 |
|
---|
97 | ////////////////////////////////////////////////////////////////////////////////
|
---|
98 | //
|
---|
99 | // Structures shared between Machine XML and VirtualBox.xml
|
---|
100 | //
|
---|
101 | ////////////////////////////////////////////////////////////////////////////////
|
---|
102 |
|
---|
103 | typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;
|
---|
104 | typedef std::list<com::Utf8Str> StringsList;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * USB device filter definition. This struct is used both in MainConfigFile
|
---|
108 | * (for global USB filters) and MachineConfigFile (for machine filters).
|
---|
109 | *
|
---|
110 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
111 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
112 | * your settings might never get saved.
|
---|
113 | */
|
---|
114 | struct USBDeviceFilter
|
---|
115 | {
|
---|
116 | USBDeviceFilter();
|
---|
117 |
|
---|
118 | bool operator==(const USBDeviceFilter&u) const;
|
---|
119 |
|
---|
120 | com::Utf8Str strName;
|
---|
121 | bool fActive;
|
---|
122 | com::Utf8Str strVendorId,
|
---|
123 | strProductId,
|
---|
124 | strRevision,
|
---|
125 | strManufacturer,
|
---|
126 | strProduct,
|
---|
127 | strSerialNumber,
|
---|
128 | strPort;
|
---|
129 | USBDeviceFilterAction_T action; // only used with host USB filters
|
---|
130 | com::Utf8Str strRemote; // irrelevant for host USB objects
|
---|
131 | uint32_t ulMaskedInterfaces; // irrelevant for host USB objects
|
---|
132 | };
|
---|
133 |
|
---|
134 | typedef std::list<USBDeviceFilter> USBDeviceFiltersList;
|
---|
135 |
|
---|
136 | struct Medium;
|
---|
137 | typedef std::list<Medium> MediaList;
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
141 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
142 | * your settings might never get saved.
|
---|
143 | */
|
---|
144 | struct Medium
|
---|
145 | {
|
---|
146 | Medium();
|
---|
147 |
|
---|
148 | bool operator==(const Medium &m) const;
|
---|
149 |
|
---|
150 | com::Guid uuid;
|
---|
151 | com::Utf8Str strLocation;
|
---|
152 | com::Utf8Str strDescription;
|
---|
153 |
|
---|
154 | // the following are for hard disks only:
|
---|
155 | com::Utf8Str strFormat;
|
---|
156 | bool fAutoReset; // optional, only for diffs, default is false
|
---|
157 | StringsMap properties;
|
---|
158 | MediumType_T hdType;
|
---|
159 |
|
---|
160 | MediaList llChildren; // only used with hard disks
|
---|
161 |
|
---|
162 | static const struct Medium Empty;
|
---|
163 | };
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * A media registry. Starting with VirtualBox 3.3, this can appear in both the
|
---|
167 | * VirtualBox.xml file as well as machine XML files with settings version 1.11
|
---|
168 | * or higher, so these lists are now in ConfigFileBase.
|
---|
169 | *
|
---|
170 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
171 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
172 | * your settings might never get saved.
|
---|
173 | */
|
---|
174 | struct MediaRegistry
|
---|
175 | {
|
---|
176 | bool operator==(const MediaRegistry &m) const;
|
---|
177 |
|
---|
178 | MediaList llHardDisks,
|
---|
179 | llDvdImages,
|
---|
180 | llFloppyImages;
|
---|
181 | };
|
---|
182 |
|
---|
183 | /**
|
---|
184 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
185 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
186 | * your settings might never get saved.
|
---|
187 | */
|
---|
188 | struct NATRule
|
---|
189 | {
|
---|
190 | NATRule();
|
---|
191 |
|
---|
192 | bool operator==(const NATRule &r) const;
|
---|
193 |
|
---|
194 | com::Utf8Str strName;
|
---|
195 | NATProtocol_T proto;
|
---|
196 | uint16_t u16HostPort;
|
---|
197 | com::Utf8Str strHostIP;
|
---|
198 | uint16_t u16GuestPort;
|
---|
199 | com::Utf8Str strGuestIP;
|
---|
200 | };
|
---|
201 | typedef std::map<com::Utf8Str, NATRule> NATRulesMap;
|
---|
202 |
|
---|
203 | struct NATHostLoopbackOffset
|
---|
204 | {
|
---|
205 | NATHostLoopbackOffset();
|
---|
206 |
|
---|
207 | bool operator==(const NATHostLoopbackOffset &o) const;
|
---|
208 |
|
---|
209 | bool operator==(const com::Utf8Str& strAddr)
|
---|
210 | {
|
---|
211 | return strLoopbackHostAddress == strAddr;
|
---|
212 | }
|
---|
213 |
|
---|
214 | bool operator==(uint32_t off)
|
---|
215 | {
|
---|
216 | return u32Offset == off;
|
---|
217 | }
|
---|
218 |
|
---|
219 | /** Note: 128/8 is only acceptable */
|
---|
220 | com::Utf8Str strLoopbackHostAddress;
|
---|
221 | uint32_t u32Offset;
|
---|
222 | };
|
---|
223 |
|
---|
224 | typedef std::list<NATHostLoopbackOffset> NATLoopbackOffsetList;
|
---|
225 |
|
---|
226 | typedef std::vector<uint8_t> IconBlob;
|
---|
227 |
|
---|
228 | /**
|
---|
229 | * Common base class for both MainConfigFile and MachineConfigFile
|
---|
230 | * which contains some common logic for both.
|
---|
231 | */
|
---|
232 | class ConfigFileBase
|
---|
233 | {
|
---|
234 | public:
|
---|
235 | bool fileExists();
|
---|
236 | SettingsVersion_T getSettingsVersion();
|
---|
237 |
|
---|
238 | void copyBaseFrom(const ConfigFileBase &b);
|
---|
239 |
|
---|
240 | protected:
|
---|
241 | ConfigFileBase(const com::Utf8Str *pstrFilename);
|
---|
242 | /* Note: this copy constructor doesn't create a full copy of other, cause
|
---|
243 | * the file based stuff (xml doc) could not be copied. */
|
---|
244 | ConfigFileBase(const ConfigFileBase &other);
|
---|
245 |
|
---|
246 | ~ConfigFileBase();
|
---|
247 |
|
---|
248 | typedef enum {Error, HardDisk, DVDImage, FloppyImage} MediaType;
|
---|
249 |
|
---|
250 | static const char *stringifyMediaType(MediaType t);
|
---|
251 | SettingsVersion_T parseVersion(const com::Utf8Str &strVersion,
|
---|
252 | const xml::ElementNode *pElm);
|
---|
253 | void parseUUID(com::Guid &guid,
|
---|
254 | const com::Utf8Str &strUUID,
|
---|
255 | const xml::ElementNode *pElm) const;
|
---|
256 | void parseTimestamp(RTTIMESPEC ×tamp,
|
---|
257 | const com::Utf8Str &str,
|
---|
258 | const xml::ElementNode *pElm) const;
|
---|
259 | void parseBase64(IconBlob &binary,
|
---|
260 | const com::Utf8Str &str,
|
---|
261 | const xml::ElementNode *pElm) const;
|
---|
262 | com::Utf8Str stringifyTimestamp(const RTTIMESPEC &tm) const;
|
---|
263 | void toBase64(com::Utf8Str &str,
|
---|
264 | const IconBlob &binary) const;
|
---|
265 |
|
---|
266 | void readExtraData(const xml::ElementNode &elmExtraData,
|
---|
267 | StringsMap &map);
|
---|
268 | void readUSBDeviceFilters(const xml::ElementNode &elmDeviceFilters,
|
---|
269 | USBDeviceFiltersList &ll);
|
---|
270 | void readMediumOne(MediaType t, const xml::ElementNode &elmMedium, Medium &med);
|
---|
271 | void readMedium(MediaType t, const xml::ElementNode &elmMedium, Medium &med);
|
---|
272 | void readMediaRegistry(const xml::ElementNode &elmMediaRegistry, MediaRegistry &mr);
|
---|
273 | void readNATForwardRulesMap(const xml::ElementNode &elmParent, NATRulesMap &mapRules);
|
---|
274 | void readNATLoopbacks(const xml::ElementNode &elmParent, NATLoopbackOffsetList &llLoopBacks);
|
---|
275 |
|
---|
276 | void setVersionAttribute(xml::ElementNode &elm);
|
---|
277 | void specialBackupIfFirstBump();
|
---|
278 | void createStubDocument();
|
---|
279 |
|
---|
280 | void buildExtraData(xml::ElementNode &elmParent, const StringsMap &me);
|
---|
281 | void buildUSBDeviceFilters(xml::ElementNode &elmParent,
|
---|
282 | const USBDeviceFiltersList &ll,
|
---|
283 | bool fHostMode);
|
---|
284 | void buildMedium(MediaType t,
|
---|
285 | xml::ElementNode &elmMedium,
|
---|
286 | const Medium &med);
|
---|
287 | void buildMediaRegistry(xml::ElementNode &elmParent,
|
---|
288 | const MediaRegistry &mr);
|
---|
289 | void buildNATForwardRulesMap(xml::ElementNode &elmParent, const NATRulesMap &mapRules);
|
---|
290 | void buildNATLoopbacks(xml::ElementNode &elmParent, const NATLoopbackOffsetList &natLoopbackList);
|
---|
291 | void clearDocument();
|
---|
292 |
|
---|
293 | struct Data;
|
---|
294 | Data *m;
|
---|
295 |
|
---|
296 | friend class ConfigFileError;
|
---|
297 | };
|
---|
298 |
|
---|
299 | ////////////////////////////////////////////////////////////////////////////////
|
---|
300 | //
|
---|
301 | // VirtualBox.xml structures
|
---|
302 | //
|
---|
303 | ////////////////////////////////////////////////////////////////////////////////
|
---|
304 |
|
---|
305 | struct USBDeviceSource
|
---|
306 | {
|
---|
307 | com::Utf8Str strName;
|
---|
308 | com::Utf8Str strBackend;
|
---|
309 | com::Utf8Str strAddress;
|
---|
310 | StringsMap properties;
|
---|
311 | };
|
---|
312 |
|
---|
313 | typedef std::list<USBDeviceSource> USBDeviceSourcesList;
|
---|
314 |
|
---|
315 | #ifdef VBOX_WITH_UPDATE_AGENT
|
---|
316 | struct UpdateAgent
|
---|
317 | {
|
---|
318 | UpdateAgent();
|
---|
319 |
|
---|
320 | bool fEnabled;
|
---|
321 | UpdateChannel_T enmChannel;
|
---|
322 | uint32_t uCheckFreqSeconds;
|
---|
323 | com::Utf8Str strRepoUrl;
|
---|
324 | com::Utf8Str strLastCheckDate;
|
---|
325 | uint32_t uCheckCount;
|
---|
326 | };
|
---|
327 | #endif /* VBOX_WITH_UPDATE_AGENT */
|
---|
328 |
|
---|
329 | struct Host
|
---|
330 | {
|
---|
331 | USBDeviceFiltersList llUSBDeviceFilters;
|
---|
332 | USBDeviceSourcesList llUSBDeviceSources;
|
---|
333 | #ifdef VBOX_WITH_UPDATE_AGENT
|
---|
334 | UpdateAgent updateHost;
|
---|
335 | /** @todo Add handling for ExtPack and Guest Additions updates here later. See @bugref{7983}. */
|
---|
336 | #endif /* VBOX_WITH_UPDATE_AGENT */
|
---|
337 | };
|
---|
338 |
|
---|
339 | struct SystemProperties
|
---|
340 | {
|
---|
341 | SystemProperties();
|
---|
342 |
|
---|
343 | com::Utf8Str strDefaultMachineFolder;
|
---|
344 | com::Utf8Str strDefaultHardDiskFolder;
|
---|
345 | com::Utf8Str strDefaultHardDiskFormat;
|
---|
346 | com::Utf8Str strVRDEAuthLibrary;
|
---|
347 | com::Utf8Str strWebServiceAuthLibrary;
|
---|
348 | com::Utf8Str strDefaultVRDEExtPack;
|
---|
349 | com::Utf8Str strDefaultCryptoExtPack;
|
---|
350 | com::Utf8Str strAutostartDatabasePath;
|
---|
351 | com::Utf8Str strDefaultAdditionsISO;
|
---|
352 | com::Utf8Str strDefaultFrontend;
|
---|
353 | com::Utf8Str strLoggingLevel;
|
---|
354 | com::Utf8Str strProxyUrl;
|
---|
355 | uint32_t uProxyMode; /**< ProxyMode_T */
|
---|
356 | uint32_t uLogHistoryCount;
|
---|
357 | com::Utf8Str strLanguageId;
|
---|
358 | };
|
---|
359 |
|
---|
360 | struct PlatformProperties
|
---|
361 | {
|
---|
362 | PlatformProperties();
|
---|
363 |
|
---|
364 | bool fExclusiveHwVirt;
|
---|
365 | };
|
---|
366 |
|
---|
367 | struct MachineRegistryEntry
|
---|
368 | {
|
---|
369 | com::Guid uuid;
|
---|
370 | com::Utf8Str strSettingsFile;
|
---|
371 | };
|
---|
372 |
|
---|
373 | typedef std::list<MachineRegistryEntry> MachinesRegistry;
|
---|
374 |
|
---|
375 | struct DhcpOptValue
|
---|
376 | {
|
---|
377 | DhcpOptValue();
|
---|
378 | DhcpOptValue(const com::Utf8Str &aText, DHCPOptionEncoding_T aEncoding = DHCPOptionEncoding_Normal);
|
---|
379 |
|
---|
380 | com::Utf8Str strValue;
|
---|
381 | DHCPOptionEncoding_T enmEncoding;
|
---|
382 | };
|
---|
383 |
|
---|
384 | typedef std::map<DHCPOption_T, DhcpOptValue> DhcpOptionMap;
|
---|
385 | typedef DhcpOptionMap::value_type DhcpOptValuePair;
|
---|
386 | typedef DhcpOptionMap::iterator DhcpOptIterator;
|
---|
387 | typedef DhcpOptionMap::const_iterator DhcpOptConstIterator;
|
---|
388 |
|
---|
389 | struct DHCPGroupCondition
|
---|
390 | {
|
---|
391 | DHCPGroupCondition();
|
---|
392 |
|
---|
393 | bool fInclusive;
|
---|
394 | DHCPGroupConditionType_T enmType;
|
---|
395 | com::Utf8Str strValue;
|
---|
396 | };
|
---|
397 | typedef std::vector<DHCPGroupCondition> DHCPGroupConditionVec;
|
---|
398 |
|
---|
399 |
|
---|
400 | struct DHCPConfig
|
---|
401 | {
|
---|
402 | DHCPConfig();
|
---|
403 |
|
---|
404 | DhcpOptionMap mapOptions;
|
---|
405 | uint32_t secMinLeaseTime;
|
---|
406 | uint32_t secDefaultLeaseTime;
|
---|
407 | uint32_t secMaxLeaseTime;
|
---|
408 | com::Utf8Str strForcedOptions;
|
---|
409 | com::Utf8Str strSuppressedOptions;
|
---|
410 | };
|
---|
411 |
|
---|
412 | struct DHCPGroupConfig : DHCPConfig
|
---|
413 | {
|
---|
414 | DHCPGroupConfig();
|
---|
415 |
|
---|
416 | com::Utf8Str strName;
|
---|
417 | DHCPGroupConditionVec vecConditions;
|
---|
418 | };
|
---|
419 | typedef std::vector<DHCPGroupConfig> DHCPGroupConfigVec;
|
---|
420 |
|
---|
421 | struct DHCPIndividualConfig : DHCPConfig
|
---|
422 | {
|
---|
423 | DHCPIndividualConfig();
|
---|
424 |
|
---|
425 | com::Utf8Str strMACAddress;
|
---|
426 | com::Utf8Str strVMName;
|
---|
427 | uint32_t uSlot;
|
---|
428 | com::Utf8Str strFixedAddress;
|
---|
429 | };
|
---|
430 | typedef std::map<com::Utf8Str, DHCPIndividualConfig> DHCPIndividualConfigMap;
|
---|
431 |
|
---|
432 | struct DHCPServer
|
---|
433 | {
|
---|
434 | DHCPServer();
|
---|
435 |
|
---|
436 | com::Utf8Str strNetworkName;
|
---|
437 | com::Utf8Str strIPAddress;
|
---|
438 | com::Utf8Str strIPLower;
|
---|
439 | com::Utf8Str strIPUpper;
|
---|
440 | bool fEnabled;
|
---|
441 | DHCPConfig globalConfig;
|
---|
442 | DHCPGroupConfigVec vecGroupConfigs;
|
---|
443 | DHCPIndividualConfigMap mapIndividualConfigs;
|
---|
444 | };
|
---|
445 | typedef std::list<DHCPServer> DHCPServersList;
|
---|
446 |
|
---|
447 |
|
---|
448 | /**
|
---|
449 | * NAT Networking settings (NAT service).
|
---|
450 | */
|
---|
451 | struct NATNetwork
|
---|
452 | {
|
---|
453 | NATNetwork();
|
---|
454 |
|
---|
455 | com::Utf8Str strNetworkName;
|
---|
456 | com::Utf8Str strIPv4NetworkCidr;
|
---|
457 | com::Utf8Str strIPv6Prefix;
|
---|
458 | bool fEnabled;
|
---|
459 | bool fIPv6Enabled;
|
---|
460 | bool fAdvertiseDefaultIPv6Route;
|
---|
461 | bool fNeedDhcpServer;
|
---|
462 | uint32_t u32HostLoopback6Offset;
|
---|
463 | NATLoopbackOffsetList llHostLoopbackOffsetList;
|
---|
464 | NATRulesMap mapPortForwardRules4;
|
---|
465 | NATRulesMap mapPortForwardRules6;
|
---|
466 | };
|
---|
467 |
|
---|
468 | typedef std::list<NATNetwork> NATNetworksList;
|
---|
469 |
|
---|
470 | #ifdef VBOX_WITH_VMNET
|
---|
471 | /**
|
---|
472 | * HostOnly Networking settings.
|
---|
473 | */
|
---|
474 | struct HostOnlyNetwork
|
---|
475 | {
|
---|
476 | HostOnlyNetwork();
|
---|
477 |
|
---|
478 | com::Guid uuid;
|
---|
479 | com::Utf8Str strNetworkName;
|
---|
480 | com::Utf8Str strNetworkMask;
|
---|
481 | com::Utf8Str strIPLower;
|
---|
482 | com::Utf8Str strIPUpper;
|
---|
483 | bool fEnabled;
|
---|
484 | };
|
---|
485 |
|
---|
486 | typedef std::list<HostOnlyNetwork> HostOnlyNetworksList;
|
---|
487 | #endif /* VBOX_WITH_VMNET */
|
---|
488 |
|
---|
489 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
490 | /**
|
---|
491 | * Cloud Networking settings.
|
---|
492 | */
|
---|
493 | struct CloudNetwork
|
---|
494 | {
|
---|
495 | CloudNetwork();
|
---|
496 |
|
---|
497 | com::Utf8Str strNetworkName;
|
---|
498 | com::Utf8Str strProviderShortName;
|
---|
499 | com::Utf8Str strProfileName;
|
---|
500 | com::Utf8Str strNetworkId;
|
---|
501 | bool fEnabled;
|
---|
502 | };
|
---|
503 |
|
---|
504 | typedef std::list<CloudNetwork> CloudNetworksList;
|
---|
505 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
506 |
|
---|
507 |
|
---|
508 | class MainConfigFile : public ConfigFileBase
|
---|
509 | {
|
---|
510 | public:
|
---|
511 | MainConfigFile(const com::Utf8Str *pstrFilename);
|
---|
512 |
|
---|
513 | void readMachineRegistry(const xml::ElementNode &elmMachineRegistry);
|
---|
514 | void readNATNetworks(const xml::ElementNode &elmNATNetworks);
|
---|
515 | #ifdef VBOX_WITH_VMNET
|
---|
516 | void readHostOnlyNetworks(const xml::ElementNode &elmHostOnlyNetworks);
|
---|
517 | #endif /* VBOX_WITH_VMNET */
|
---|
518 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
519 | void readCloudNetworks(const xml::ElementNode &elmCloudNetworks);
|
---|
520 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
521 |
|
---|
522 | void write(const com::Utf8Str strFilename);
|
---|
523 |
|
---|
524 | Host host;
|
---|
525 | SystemProperties systemProperties;
|
---|
526 | PlatformProperties platformProperties;
|
---|
527 | MediaRegistry mediaRegistry;
|
---|
528 | MachinesRegistry llMachines;
|
---|
529 | DHCPServersList llDhcpServers;
|
---|
530 | NATNetworksList llNATNetworks;
|
---|
531 | #ifdef VBOX_WITH_VMNET
|
---|
532 | HostOnlyNetworksList llHostOnlyNetworks;
|
---|
533 | #endif /* VBOX_WITH_VMNET */
|
---|
534 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
535 | CloudNetworksList llCloudNetworks;
|
---|
536 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
537 | StringsMap mapExtraDataItems;
|
---|
538 |
|
---|
539 | private:
|
---|
540 | void bumpSettingsVersionIfNeeded();
|
---|
541 | void buildUSBDeviceSources(xml::ElementNode &elmParent, const USBDeviceSourcesList &ll);
|
---|
542 | void readUSBDeviceSources(const xml::ElementNode &elmDeviceSources, USBDeviceSourcesList &ll);
|
---|
543 | void buildDHCPServers(xml::ElementNode &elmDHCPServers, DHCPServersList const &ll);
|
---|
544 | void buildDHCPOptions(xml::ElementNode &elmOptions, DHCPConfig const &rConfig, bool fIgnoreSubnetMask);
|
---|
545 | void readDHCPServers(const xml::ElementNode &elmDHCPServers);
|
---|
546 | void readDHCPOptions(DHCPConfig &rConfig, const xml::ElementNode &elmOptions, bool fIgnoreSubnetMask);
|
---|
547 | bool convertGuiProxySettings(const com::Utf8Str &strUIProxySettings);
|
---|
548 | };
|
---|
549 |
|
---|
550 | ////////////////////////////////////////////////////////////////////////////////
|
---|
551 | //
|
---|
552 | // Machine XML structures
|
---|
553 | //
|
---|
554 | ////////////////////////////////////////////////////////////////////////////////
|
---|
555 |
|
---|
556 | /**
|
---|
557 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
558 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
559 | * your settings might never get saved.
|
---|
560 | */
|
---|
561 | struct VRDESettings
|
---|
562 | {
|
---|
563 | VRDESettings();
|
---|
564 |
|
---|
565 | bool areDefaultSettings(SettingsVersion_T sv) const;
|
---|
566 |
|
---|
567 | bool operator==(const VRDESettings& v) const;
|
---|
568 |
|
---|
569 | bool fEnabled;
|
---|
570 | AuthType_T authType;
|
---|
571 | uint32_t ulAuthTimeout;
|
---|
572 | com::Utf8Str strAuthLibrary;
|
---|
573 | bool fAllowMultiConnection,
|
---|
574 | fReuseSingleConnection;
|
---|
575 | com::Utf8Str strVrdeExtPack;
|
---|
576 | StringsMap mapProperties;
|
---|
577 | };
|
---|
578 |
|
---|
579 | /**
|
---|
580 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
581 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
582 | * your settings might never get saved.
|
---|
583 | */
|
---|
584 | struct FirmwareSettings
|
---|
585 | {
|
---|
586 | FirmwareSettings();
|
---|
587 |
|
---|
588 | bool areDefaultSettings(CPUArchitecture_T enmCPUArch) const;
|
---|
589 |
|
---|
590 | bool operator==(const FirmwareSettings &d) const;
|
---|
591 |
|
---|
592 | FirmwareType_T firmwareType; // requires settings version 1.9 (VirtualBox 3.1)
|
---|
593 | bool fACPIEnabled,
|
---|
594 | fIOAPICEnabled,
|
---|
595 | fLogoFadeIn,
|
---|
596 | fLogoFadeOut,
|
---|
597 | fPXEDebugEnabled,
|
---|
598 | fSmbiosUuidLittleEndian;
|
---|
599 | uint32_t ulLogoDisplayTime;
|
---|
600 | FirmwareBootMenuMode_T enmBootMenuMode;
|
---|
601 | APICMode_T apicMode; // requires settings version 1.16 (VirtualBox 5.1)
|
---|
602 | int64_t llTimeOffset;
|
---|
603 | com::Utf8Str strLogoImagePath;
|
---|
604 | };
|
---|
605 |
|
---|
606 | /**
|
---|
607 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
608 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
609 | * your settings might never get saved.
|
---|
610 | */
|
---|
611 | struct TpmSettings
|
---|
612 | {
|
---|
613 | TpmSettings();
|
---|
614 |
|
---|
615 | bool areDefaultSettings() const;
|
---|
616 |
|
---|
617 | bool operator==(const TpmSettings &d) const;
|
---|
618 |
|
---|
619 | TpmType_T tpmType;
|
---|
620 | com::Utf8Str strLocation;
|
---|
621 | };
|
---|
622 |
|
---|
623 | /**
|
---|
624 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
625 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
626 | * your settings might never get saved.
|
---|
627 | */
|
---|
628 | struct NvramSettings
|
---|
629 | {
|
---|
630 | NvramSettings();
|
---|
631 |
|
---|
632 | bool areDefaultSettings() const;
|
---|
633 |
|
---|
634 | bool operator==(const NvramSettings &d) const;
|
---|
635 |
|
---|
636 | com::Utf8Str strNvramPath;
|
---|
637 | com::Utf8Str strKeyId;
|
---|
638 | com::Utf8Str strKeyStore;
|
---|
639 | };
|
---|
640 |
|
---|
641 | /** List for keeping a recording feature list. */
|
---|
642 | typedef std::map<RecordingFeature_T, bool> RecordingFeatureMap;
|
---|
643 |
|
---|
644 | /**
|
---|
645 | * Recording settings for a single screen (e.g. virtual monitor).
|
---|
646 | *
|
---|
647 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
648 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
649 | * your settings might never get saved.
|
---|
650 | */
|
---|
651 | struct RecordingScreenSettings
|
---|
652 | {
|
---|
653 | RecordingScreenSettings(uint32_t idScreen = UINT32_MAX);
|
---|
654 |
|
---|
655 | virtual ~RecordingScreenSettings();
|
---|
656 |
|
---|
657 | void applyDefaults(void);
|
---|
658 |
|
---|
659 | bool areDefaultSettings(void) const;
|
---|
660 |
|
---|
661 | bool isFeatureEnabled(RecordingFeature_T enmFeature) const;
|
---|
662 |
|
---|
663 | static const char *getDefaultOptions(void);
|
---|
664 |
|
---|
665 | static int featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap);
|
---|
666 |
|
---|
667 | static void featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures);
|
---|
668 |
|
---|
669 | static int audioCodecFromString(const com::Utf8Str &strCodec, RecordingAudioCodec_T &enmCodec);
|
---|
670 |
|
---|
671 | static void audioCodecToString(const RecordingAudioCodec_T &enmCodec, com::Utf8Str &strCodec);
|
---|
672 |
|
---|
673 | static int videoCodecFromString(const com::Utf8Str &strCodec, RecordingVideoCodec_T &enmCodec);
|
---|
674 |
|
---|
675 | static void videoCodecToString(const RecordingVideoCodec_T &enmCodec, com::Utf8Str &strCodec);
|
---|
676 |
|
---|
677 | bool operator==(const RecordingScreenSettings &d) const;
|
---|
678 |
|
---|
679 | /** Screen ID.
|
---|
680 | * UINT32_MAX if not set. */
|
---|
681 | uint32_t idScreen;
|
---|
682 | /** Whether to record this screen or not. */
|
---|
683 | bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
684 | /** Destination to record to. */
|
---|
685 | RecordingDestination_T enmDest;
|
---|
686 | /** Which features are enable or not. */
|
---|
687 | RecordingFeatureMap featureMap; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
688 | /** Maximum time (in s) to record. If set to 0, no time limit is set. */
|
---|
689 | uint32_t ulMaxTimeS; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
690 | /** Options string for hidden / advanced / experimental features.
|
---|
691 | * Use RecordingScreenSettings::getDefaultOptions(). */
|
---|
692 | com::Utf8Str strOptions; // new since VirtualBox 5.2.
|
---|
693 |
|
---|
694 | /**
|
---|
695 | * Structure holding settings for audio recording.
|
---|
696 | */
|
---|
697 | struct Audio
|
---|
698 | {
|
---|
699 | /** The audio codec type to use. */
|
---|
700 | RecordingAudioCodec_T enmCodec; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
701 | /** Codec deadline to use. */
|
---|
702 | RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
703 | /** Rate control mode to use. */
|
---|
704 | RecordingRateControlMode_T
|
---|
705 | enmRateCtlMode;// requires settings version 1.19 (VirtualBox 7.0)
|
---|
706 | /** Hz rate. */
|
---|
707 | uint16_t uHz; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
708 | /** Bits per sample. */
|
---|
709 | uint8_t cBits; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
710 | /** Number of audio channels. */
|
---|
711 | uint8_t cChannels; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
712 | } Audio;
|
---|
713 |
|
---|
714 | /**
|
---|
715 | * Structure holding settings for video recording.
|
---|
716 | */
|
---|
717 | struct Video
|
---|
718 | {
|
---|
719 | /** The codec to use. */
|
---|
720 | RecordingVideoCodec_T enmCodec; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
721 | /** Codec deadline to use. */
|
---|
722 | RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
723 | /** Rate control mode to use. */
|
---|
724 | RecordingRateControlMode_T
|
---|
725 | enmRateCtlMode; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
726 | /** Rate control mode to use. */
|
---|
727 | RecordingVideoScalingMode_T
|
---|
728 | enmScalingMode; // requires settings version 1.19 (VirtualBox 7.0)
|
---|
729 | /** Target frame width in pixels (X). */
|
---|
730 | uint32_t ulWidth; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
731 | /** Target frame height in pixels (Y). */
|
---|
732 | uint32_t ulHeight; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
733 | /** Encoding rate. */
|
---|
734 | uint32_t ulRate; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
735 | /** Frames per second (FPS). */
|
---|
736 | uint32_t ulFPS; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
737 | } Video;
|
---|
738 |
|
---|
739 | /**
|
---|
740 | * Structure holding settings if the destination is a file.
|
---|
741 | */
|
---|
742 | struct File
|
---|
743 | {
|
---|
744 | /** Maximum size (in MB) the file is allowed to have.
|
---|
745 | * When reaching the limit, recording will stop. 0 means no limit. */
|
---|
746 | uint32_t ulMaxSizeMB; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
747 | /** Absolute file name path to use for recording.
|
---|
748 | * When empty, this is considered as being the default setting. */
|
---|
749 | com::Utf8Str strName; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
750 | } File;
|
---|
751 | };
|
---|
752 |
|
---|
753 | /** Map for keeping settings per virtual screen.
|
---|
754 | * The key specifies the screen ID. */
|
---|
755 | typedef std::map<uint32_t, RecordingScreenSettings> RecordingScreenSettingsMap;
|
---|
756 |
|
---|
757 | /**
|
---|
758 | * Common recording settings, shared among all per-screen recording settings.
|
---|
759 | *
|
---|
760 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
761 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
762 | * your settings might never get saved.
|
---|
763 | */
|
---|
764 | struct RecordingCommonSettings
|
---|
765 | {
|
---|
766 | RecordingCommonSettings();
|
---|
767 |
|
---|
768 | void applyDefaults(void);
|
---|
769 |
|
---|
770 | bool areDefaultSettings(void) const;
|
---|
771 |
|
---|
772 | bool operator==(const RecordingCommonSettings &d) const;
|
---|
773 |
|
---|
774 | /** Whether recording as a whole is enabled or disabled. */
|
---|
775 | bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
776 | };
|
---|
777 |
|
---|
778 | /**
|
---|
779 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
780 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
781 | * your settings might never get saved.
|
---|
782 | */
|
---|
783 | struct RecordingSettings
|
---|
784 | {
|
---|
785 | RecordingSettings();
|
---|
786 |
|
---|
787 | void applyDefaults(void);
|
---|
788 |
|
---|
789 | bool areDefaultSettings(void) const;
|
---|
790 |
|
---|
791 | bool operator==(const RecordingSettings &that) const;
|
---|
792 |
|
---|
793 | /** Common settings for all per-screen recording settings. */
|
---|
794 | RecordingCommonSettings common;
|
---|
795 | /** Map of handled recording screen settings.
|
---|
796 | * The key specifies the screen ID. */
|
---|
797 | RecordingScreenSettingsMap mapScreens;
|
---|
798 | };
|
---|
799 |
|
---|
800 | /**
|
---|
801 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
802 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
803 | * your settings might never get saved.
|
---|
804 | */
|
---|
805 | struct GraphicsAdapter
|
---|
806 | {
|
---|
807 | GraphicsAdapter();
|
---|
808 |
|
---|
809 | bool areDefaultSettings() const;
|
---|
810 |
|
---|
811 | bool operator==(const GraphicsAdapter &g) const;
|
---|
812 |
|
---|
813 | GraphicsControllerType_T graphicsControllerType;
|
---|
814 | uint32_t ulVRAMSizeMB;
|
---|
815 | uint32_t cMonitors;
|
---|
816 | bool fAccelerate3D,
|
---|
817 | fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
|
---|
818 | };
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
822 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
823 | * your settings might never get saved.
|
---|
824 | */
|
---|
825 | struct USBController
|
---|
826 | {
|
---|
827 | USBController();
|
---|
828 |
|
---|
829 | bool operator==(const USBController &u) const;
|
---|
830 |
|
---|
831 | com::Utf8Str strName;
|
---|
832 | USBControllerType_T enmType;
|
---|
833 | };
|
---|
834 |
|
---|
835 | typedef std::list<USBController> USBControllerList;
|
---|
836 |
|
---|
837 | struct USB
|
---|
838 | {
|
---|
839 | USB();
|
---|
840 |
|
---|
841 | bool operator==(const USB &u) const;
|
---|
842 |
|
---|
843 | /** List of USB controllers present. */
|
---|
844 | USBControllerList llUSBControllers;
|
---|
845 | /** List of USB device filters. */
|
---|
846 | USBDeviceFiltersList llDeviceFilters;
|
---|
847 | };
|
---|
848 |
|
---|
849 | struct NAT
|
---|
850 | {
|
---|
851 | NAT();
|
---|
852 |
|
---|
853 | bool areDNSDefaultSettings() const;
|
---|
854 | bool areAliasDefaultSettings() const;
|
---|
855 | bool areTFTPDefaultSettings() const;
|
---|
856 | bool areLocalhostReachableDefaultSettings(SettingsVersion_T sv) const;
|
---|
857 | bool areDefaultSettings(SettingsVersion_T sv) const;
|
---|
858 |
|
---|
859 | bool operator==(const NAT &n) const;
|
---|
860 |
|
---|
861 | com::Utf8Str strNetwork;
|
---|
862 | com::Utf8Str strBindIP;
|
---|
863 | uint32_t u32Mtu;
|
---|
864 | uint32_t u32SockRcv;
|
---|
865 | uint32_t u32SockSnd;
|
---|
866 | uint32_t u32TcpRcv;
|
---|
867 | uint32_t u32TcpSnd;
|
---|
868 | com::Utf8Str strTFTPPrefix;
|
---|
869 | com::Utf8Str strTFTPBootFile;
|
---|
870 | com::Utf8Str strTFTPNextServer;
|
---|
871 | bool fDNSPassDomain;
|
---|
872 | bool fDNSProxy;
|
---|
873 | bool fDNSUseHostResolver;
|
---|
874 | bool fAliasLog;
|
---|
875 | bool fAliasProxyOnly;
|
---|
876 | bool fAliasUseSamePorts;
|
---|
877 | bool fLocalhostReachable;
|
---|
878 | NATRulesMap mapRules;
|
---|
879 | };
|
---|
880 |
|
---|
881 | /**
|
---|
882 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
883 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
884 | * your settings might never get saved.
|
---|
885 | */
|
---|
886 | struct NetworkAdapter
|
---|
887 | {
|
---|
888 | NetworkAdapter();
|
---|
889 |
|
---|
890 | bool areGenericDriverDefaultSettings() const;
|
---|
891 | bool areDefaultSettings(SettingsVersion_T sv) const;
|
---|
892 | bool areDisabledDefaultSettings(SettingsVersion_T sv) const;
|
---|
893 |
|
---|
894 | bool operator==(const NetworkAdapter &n) const;
|
---|
895 |
|
---|
896 | uint32_t ulSlot;
|
---|
897 |
|
---|
898 | NetworkAdapterType_T type;
|
---|
899 | bool fEnabled;
|
---|
900 | com::Utf8Str strMACAddress;
|
---|
901 | bool fCableConnected;
|
---|
902 | uint32_t ulLineSpeed;
|
---|
903 | NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
|
---|
904 | bool fTraceEnabled;
|
---|
905 | com::Utf8Str strTraceFile;
|
---|
906 |
|
---|
907 | NetworkAttachmentType_T mode;
|
---|
908 | NAT nat;
|
---|
909 | com::Utf8Str strBridgedName;
|
---|
910 | com::Utf8Str strHostOnlyName;
|
---|
911 | #ifdef VBOX_WITH_VMNET
|
---|
912 | com::Utf8Str strHostOnlyNetworkName;
|
---|
913 | #endif /* VBOX_WITH_VMNET */
|
---|
914 | com::Utf8Str strInternalNetworkName;
|
---|
915 | com::Utf8Str strGenericDriver;
|
---|
916 | StringsMap genericProperties;
|
---|
917 | com::Utf8Str strNATNetworkName;
|
---|
918 | #ifdef VBOX_WITH_CLOUD_NET
|
---|
919 | com::Utf8Str strCloudNetworkName;
|
---|
920 | #endif /* VBOX_WITH_CLOUD_NET */
|
---|
921 | uint32_t ulBootPriority;
|
---|
922 | com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2)
|
---|
923 | };
|
---|
924 |
|
---|
925 | typedef std::list<NetworkAdapter> NetworkAdaptersList;
|
---|
926 |
|
---|
927 | /**
|
---|
928 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
929 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
930 | * your settings might never get saved.
|
---|
931 | */
|
---|
932 | struct SerialPort
|
---|
933 | {
|
---|
934 | SerialPort();
|
---|
935 |
|
---|
936 | bool operator==(const SerialPort &n) const;
|
---|
937 |
|
---|
938 | uint32_t ulSlot;
|
---|
939 |
|
---|
940 | bool fEnabled;
|
---|
941 | uint32_t ulIOAddress;
|
---|
942 | uint32_t ulIRQ;
|
---|
943 | PortMode_T portMode;
|
---|
944 | com::Utf8Str strPath;
|
---|
945 | bool fServer;
|
---|
946 | UartType_T uartType;
|
---|
947 | };
|
---|
948 |
|
---|
949 | typedef std::list<SerialPort> SerialPortsList;
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
953 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
954 | * your settings might never get saved.
|
---|
955 | */
|
---|
956 | struct ParallelPort
|
---|
957 | {
|
---|
958 | ParallelPort();
|
---|
959 |
|
---|
960 | bool operator==(const ParallelPort &d) const;
|
---|
961 |
|
---|
962 | uint32_t ulSlot;
|
---|
963 |
|
---|
964 | bool fEnabled;
|
---|
965 | uint32_t ulIOBase;
|
---|
966 | uint32_t ulIRQ;
|
---|
967 | com::Utf8Str strPath;
|
---|
968 | };
|
---|
969 |
|
---|
970 | typedef std::list<ParallelPort> ParallelPortsList;
|
---|
971 |
|
---|
972 | /**
|
---|
973 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
974 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
975 | * your settings might never get saved.
|
---|
976 | */
|
---|
977 | struct AudioAdapter
|
---|
978 | {
|
---|
979 | AudioAdapter();
|
---|
980 |
|
---|
981 | bool areDefaultSettings(SettingsVersion_T sv) const;
|
---|
982 |
|
---|
983 | bool operator==(const AudioAdapter &a) const;
|
---|
984 |
|
---|
985 | bool fEnabled;
|
---|
986 | bool fEnabledIn;
|
---|
987 | bool fEnabledOut;
|
---|
988 | AudioControllerType_T controllerType;
|
---|
989 | AudioCodecType_T codecType;
|
---|
990 | AudioDriverType_T driverType;
|
---|
991 | settings::StringsMap properties;
|
---|
992 | };
|
---|
993 |
|
---|
994 | /**
|
---|
995 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
996 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
997 | * your settings might never get saved.
|
---|
998 | */
|
---|
999 | struct SharedFolder
|
---|
1000 | {
|
---|
1001 | SharedFolder();
|
---|
1002 |
|
---|
1003 | bool operator==(const SharedFolder &a) const;
|
---|
1004 |
|
---|
1005 | com::Utf8Str strName,
|
---|
1006 | strHostPath;
|
---|
1007 | bool fWritable;
|
---|
1008 | bool fAutoMount;
|
---|
1009 | com::Utf8Str strAutoMountPoint;
|
---|
1010 | };
|
---|
1011 |
|
---|
1012 | typedef std::list<SharedFolder> SharedFoldersList;
|
---|
1013 |
|
---|
1014 | /**
|
---|
1015 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1016 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1017 | * your settings might never get saved.
|
---|
1018 | */
|
---|
1019 | struct GuestProperty
|
---|
1020 | {
|
---|
1021 | GuestProperty();
|
---|
1022 |
|
---|
1023 | bool operator==(const GuestProperty &g) const;
|
---|
1024 |
|
---|
1025 | com::Utf8Str strName,
|
---|
1026 | strValue;
|
---|
1027 | uint64_t timestamp;
|
---|
1028 | com::Utf8Str strFlags;
|
---|
1029 | };
|
---|
1030 |
|
---|
1031 | typedef std::list<GuestProperty> GuestPropertiesList;
|
---|
1032 |
|
---|
1033 | typedef std::map<uint32_t, DeviceType_T> BootOrderMap;
|
---|
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 CpuIdLeafX86
|
---|
1041 | {
|
---|
1042 | CpuIdLeafX86();
|
---|
1043 |
|
---|
1044 | bool operator==(const CpuIdLeafX86 &c) const;
|
---|
1045 |
|
---|
1046 | uint32_t idx;
|
---|
1047 | uint32_t idxSub;
|
---|
1048 | uint32_t uEax;
|
---|
1049 | uint32_t uEbx;
|
---|
1050 | uint32_t uEcx;
|
---|
1051 | uint32_t uEdx;
|
---|
1052 | };
|
---|
1053 |
|
---|
1054 | typedef std::list<CpuIdLeafX86> CpuIdLeafsX86List;
|
---|
1055 |
|
---|
1056 | /**
|
---|
1057 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1058 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1059 | * your settings might never get saved.
|
---|
1060 | */
|
---|
1061 | struct Cpu
|
---|
1062 | {
|
---|
1063 | Cpu();
|
---|
1064 |
|
---|
1065 | bool operator==(const Cpu &c) const;
|
---|
1066 |
|
---|
1067 | uint32_t ulId;
|
---|
1068 | };
|
---|
1069 |
|
---|
1070 | typedef std::list<Cpu> CpuList;
|
---|
1071 |
|
---|
1072 | /**
|
---|
1073 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1074 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1075 | * your settings might never get saved.
|
---|
1076 | */
|
---|
1077 | struct BandwidthGroup
|
---|
1078 | {
|
---|
1079 | BandwidthGroup();
|
---|
1080 |
|
---|
1081 | bool operator==(const BandwidthGroup &i) const;
|
---|
1082 |
|
---|
1083 | com::Utf8Str strName;
|
---|
1084 | uint64_t cMaxBytesPerSec;
|
---|
1085 | BandwidthGroupType_T enmType;
|
---|
1086 | };
|
---|
1087 |
|
---|
1088 | typedef std::list<BandwidthGroup> BandwidthGroupList;
|
---|
1089 |
|
---|
1090 | /**
|
---|
1091 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1092 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1093 | * your settings might never get saved.
|
---|
1094 | */
|
---|
1095 | struct IOSettings
|
---|
1096 | {
|
---|
1097 | IOSettings();
|
---|
1098 |
|
---|
1099 | bool areIOCacheDefaultSettings() const;
|
---|
1100 | bool areDefaultSettings() const;
|
---|
1101 |
|
---|
1102 | bool operator==(const IOSettings &i) const;
|
---|
1103 |
|
---|
1104 | bool fIOCacheEnabled;
|
---|
1105 | uint32_t ulIOCacheSize;
|
---|
1106 | BandwidthGroupList llBandwidthGroups;
|
---|
1107 | };
|
---|
1108 |
|
---|
1109 | /**
|
---|
1110 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1111 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1112 | * your settings might never get saved.
|
---|
1113 | */
|
---|
1114 | struct HostPCIDeviceAttachment
|
---|
1115 | {
|
---|
1116 | HostPCIDeviceAttachment();
|
---|
1117 |
|
---|
1118 | bool operator==(const HostPCIDeviceAttachment &a) const;
|
---|
1119 |
|
---|
1120 | com::Utf8Str strDeviceName;
|
---|
1121 | uint32_t uHostAddress;
|
---|
1122 | uint32_t uGuestAddress;
|
---|
1123 | };
|
---|
1124 |
|
---|
1125 | typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList;
|
---|
1126 |
|
---|
1127 | /**
|
---|
1128 | * A device attached to a storage controller. This can either be a
|
---|
1129 | * hard disk or a DVD drive or a floppy drive and also specifies
|
---|
1130 | * which medium is "in" the drive; as a result, this is a combination
|
---|
1131 | * of the Main IMedium and IMediumAttachment interfaces.
|
---|
1132 | *
|
---|
1133 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1134 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1135 | * your settings might never get saved.
|
---|
1136 | */
|
---|
1137 | struct AttachedDevice
|
---|
1138 | {
|
---|
1139 | AttachedDevice();
|
---|
1140 |
|
---|
1141 | bool operator==(const AttachedDevice &a) const;
|
---|
1142 |
|
---|
1143 | DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed
|
---|
1144 |
|
---|
1145 | // DVDs can be in pass-through mode:
|
---|
1146 | bool fPassThrough;
|
---|
1147 |
|
---|
1148 | // Whether guest-triggered eject of DVDs will keep the medium in the
|
---|
1149 | // VM config or not:
|
---|
1150 | bool fTempEject;
|
---|
1151 |
|
---|
1152 | // Whether the medium is non-rotational:
|
---|
1153 | bool fNonRotational;
|
---|
1154 |
|
---|
1155 | // Whether the medium supports discarding unused blocks:
|
---|
1156 | bool fDiscard;
|
---|
1157 |
|
---|
1158 | // Whether the medium is hot-pluggable:
|
---|
1159 | bool fHotPluggable;
|
---|
1160 |
|
---|
1161 | int32_t lPort;
|
---|
1162 | int32_t lDevice;
|
---|
1163 |
|
---|
1164 | // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
|
---|
1165 | // this is its UUID; it depends on deviceType which media registry this then needs to
|
---|
1166 | // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
|
---|
1167 | com::Guid uuid;
|
---|
1168 |
|
---|
1169 | // for DVDs and floppies, the attachment can also be a host device:
|
---|
1170 | com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src
|
---|
1171 |
|
---|
1172 | // Bandwidth group the device is attached to.
|
---|
1173 | com::Utf8Str strBwGroup;
|
---|
1174 | };
|
---|
1175 |
|
---|
1176 | typedef std::list<AttachedDevice> AttachedDevicesList;
|
---|
1177 |
|
---|
1178 | /**
|
---|
1179 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1180 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1181 | * your settings might never get saved.
|
---|
1182 | */
|
---|
1183 | struct StorageController
|
---|
1184 | {
|
---|
1185 | StorageController();
|
---|
1186 |
|
---|
1187 | bool operator==(const StorageController &s) const;
|
---|
1188 |
|
---|
1189 | com::Utf8Str strName;
|
---|
1190 | StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS
|
---|
1191 | StorageControllerType_T controllerType;
|
---|
1192 | uint32_t ulPortCount;
|
---|
1193 | uint32_t ulInstance;
|
---|
1194 | bool fUseHostIOCache;
|
---|
1195 | bool fBootable;
|
---|
1196 |
|
---|
1197 | // only for when controllerType == StorageControllerType_IntelAhci:
|
---|
1198 | int32_t lIDE0MasterEmulationPort,
|
---|
1199 | lIDE0SlaveEmulationPort,
|
---|
1200 | lIDE1MasterEmulationPort,
|
---|
1201 | lIDE1SlaveEmulationPort;
|
---|
1202 |
|
---|
1203 | AttachedDevicesList llAttachedDevices;
|
---|
1204 | };
|
---|
1205 |
|
---|
1206 | typedef std::list<StorageController> StorageControllersList;
|
---|
1207 |
|
---|
1208 | /**
|
---|
1209 | * We wrap the storage controllers list into an extra struct so we can
|
---|
1210 | * use an undefined struct without needing std::list<> in all the headers.
|
---|
1211 | *
|
---|
1212 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1213 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1214 | * your settings might never get saved.
|
---|
1215 | */
|
---|
1216 | struct Storage
|
---|
1217 | {
|
---|
1218 | bool operator==(const Storage &s) const;
|
---|
1219 |
|
---|
1220 | StorageControllersList llStorageControllers;
|
---|
1221 | };
|
---|
1222 |
|
---|
1223 | #ifdef VBOX_WITH_VIRT_ARMV8
|
---|
1224 | struct PlatformARM
|
---|
1225 | {
|
---|
1226 | PlatformARM();
|
---|
1227 |
|
---|
1228 | bool operator==(const PlatformARM&) const;
|
---|
1229 | };
|
---|
1230 | #endif /* VBOX_WITH_VIRT_ARMV8 */
|
---|
1231 |
|
---|
1232 | /**
|
---|
1233 | * Covers x86-specific platform attributes.
|
---|
1234 | *
|
---|
1235 | * New since settings v1.20 (VirtualBox 7.1).
|
---|
1236 | * Contains attributes which were in the Hardware settings before.
|
---|
1237 | */
|
---|
1238 | struct PlatformX86
|
---|
1239 | {
|
---|
1240 | PlatformX86();
|
---|
1241 |
|
---|
1242 | bool operator==(const PlatformX86&) const;
|
---|
1243 |
|
---|
1244 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
|
---|
1245 | bool fPAE;
|
---|
1246 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
|
---|
1247 | bool fAPIC; // requires settings version 1.16 (VirtualBox 5.1)
|
---|
1248 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
|
---|
1249 | bool fX2APIC; // requires settings version 1.16 (VirtualBox 5.1)
|
---|
1250 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
|
---|
1251 | bool fHPETEnabled;
|
---|
1252 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1253 | typedef enum LongModeType { LongMode_Enabled, LongMode_Disabled, LongMode_Legacy } LongModeType;
|
---|
1254 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1255 | LongModeType enmLongMode;
|
---|
1256 | /** Custom x86 CPUID leafs list.
|
---|
1257 | * Note: Lived in Hardware for settings < version 1.20. */
|
---|
1258 | CpuIdLeafsX86List llCpuIdLeafs;
|
---|
1259 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1260 | bool fTripleFaultReset;
|
---|
1261 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1262 | bool fIBPBOnVMExit; //< added out of cycle, after settings version 1.16 was out.
|
---|
1263 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1264 | bool fIBPBOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
|
---|
1265 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1266 | bool fSpecCtrl; //< added out of cycle, after settings version 1.16 was out.
|
---|
1267 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1268 | bool fSpecCtrlByHost; //< added out of cycle, after settings version 1.16 was out.
|
---|
1269 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1270 | bool fL1DFlushOnSched; //< added out of cycle, after settings version 1.16 was out.
|
---|
1271 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1272 | bool fL1DFlushOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
|
---|
1273 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1274 | bool fMDSClearOnSched; //< added out of cycle, after settings version 1.16 was out.
|
---|
1275 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1276 | bool fMDSClearOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
|
---|
1277 | bool fHWVirtEx;
|
---|
1278 | bool fHWVirtExNestedPaging;
|
---|
1279 | bool fHWVirtExLargePages;
|
---|
1280 | bool fHWVirtExVPID;
|
---|
1281 | /** Unrestricted execution. */
|
---|
1282 | bool fHWVirtExUX;
|
---|
1283 | bool fHWVirtExForce;
|
---|
1284 | bool fHWVirtExUseNativeApi;
|
---|
1285 | /** AMD-V VMSAVE/VMLOAD. */
|
---|
1286 | bool fHWVirtExVirtVmsaveVmload;
|
---|
1287 | /** Nested VT-x / AMD-V.
|
---|
1288 | * Note: Lived in Hardware for settings < version 1.20. */
|
---|
1289 | bool fNestedHWVirt; //< requires settings version 1.17 (VirtualBox 6.0)
|
---|
1290 | };
|
---|
1291 |
|
---|
1292 | /**
|
---|
1293 | * Covers common platform attributes.
|
---|
1294 | *
|
---|
1295 | * New since settings v1.20 (VirtualBox 7.1).
|
---|
1296 | * Contains attributes which were in the Hardware settings before.
|
---|
1297 | */
|
---|
1298 | struct Platform
|
---|
1299 | {
|
---|
1300 | Platform();
|
---|
1301 |
|
---|
1302 | bool operator==(const Platform&) const;
|
---|
1303 |
|
---|
1304 | /** Requires settings version 1.20 (VirtualBox 7.1). */
|
---|
1305 | PlatformArchitecture_T architectureType;
|
---|
1306 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.11 (VirtualBox 4.0). */
|
---|
1307 | ChipsetType_T chipsetType;
|
---|
1308 | /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.19 (VirtualBox 6.2). */
|
---|
1309 | IommuType_T iommuType;
|
---|
1310 | /** Note: Lived in Hardware for settings < version 1.20. */
|
---|
1311 | bool fRTCUseUTC;
|
---|
1312 | /** Note: Is a class, so we can't use a union here. */
|
---|
1313 | PlatformX86 x86;
|
---|
1314 | #ifdef VBOX_WITH_VIRT_ARMV8
|
---|
1315 | /** Note: Is a class, so we can't use a union here. */
|
---|
1316 | PlatformARM arm;
|
---|
1317 | #endif
|
---|
1318 | };
|
---|
1319 |
|
---|
1320 | /**
|
---|
1321 | * Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
|
---|
1322 | * field.
|
---|
1323 | *
|
---|
1324 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1325 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1326 | * your settings might never get saved.
|
---|
1327 | */
|
---|
1328 | struct Hardware
|
---|
1329 | {
|
---|
1330 | Hardware();
|
---|
1331 |
|
---|
1332 | bool areParavirtDefaultSettings(SettingsVersion_T sv) const;
|
---|
1333 | bool areBootOrderDefaultSettings() const;
|
---|
1334 | bool areDisplayDefaultSettings() const;
|
---|
1335 | bool areAllNetworkAdaptersDefaultSettings(SettingsVersion_T sv) const;
|
---|
1336 |
|
---|
1337 | bool operator==(const Hardware&) const;
|
---|
1338 |
|
---|
1339 | com::Utf8Str strVersion; // hardware version, optional
|
---|
1340 | com::Guid uuid; // hardware uuid, optional (null).
|
---|
1341 | bool fSyntheticCpu;
|
---|
1342 | uint32_t cCPUs;
|
---|
1343 | bool fCpuHotPlug; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
1344 | CpuList llCpus; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
1345 | uint32_t ulCpuExecutionCap; // requires settings version 1.11 (VirtualBox 3.3)
|
---|
1346 | uint32_t uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
|
---|
1347 | com::Utf8Str strCpuProfile; // requires settings version 1.16 (VirtualBox 5.1)
|
---|
1348 |
|
---|
1349 | uint32_t ulMemorySizeMB;
|
---|
1350 |
|
---|
1351 | BootOrderMap mapBootOrder; // item 0 has highest priority
|
---|
1352 |
|
---|
1353 | PointingHIDType_T pointingHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
1354 | KeyboardHIDType_T keyboardHIDType; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
1355 |
|
---|
1356 | ParavirtProvider_T paravirtProvider; // requires settings version 1.15 (VirtualBox 4.4)
|
---|
1357 | com::Utf8Str strParavirtDebug; // requires settings version 1.16 (VirtualBox 5.1)
|
---|
1358 |
|
---|
1359 | bool fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
|
---|
1360 |
|
---|
1361 | VRDESettings vrdeSettings;
|
---|
1362 |
|
---|
1363 | Platform platformSettings; // new since 1.20 (VirtualBox 7.1)
|
---|
1364 | FirmwareSettings firmwareSettings;
|
---|
1365 | NvramSettings nvramSettings;
|
---|
1366 | GraphicsAdapter graphicsAdapter;
|
---|
1367 | USB usbSettings;
|
---|
1368 | TpmSettings tpmSettings; // requires settings version 1.19 (VirtualBox 6.2)
|
---|
1369 | NetworkAdaptersList llNetworkAdapters;
|
---|
1370 | SerialPortsList llSerialPorts;
|
---|
1371 | ParallelPortsList llParallelPorts;
|
---|
1372 | AudioAdapter audioAdapter;
|
---|
1373 | Storage storage;
|
---|
1374 |
|
---|
1375 | // technically these two have no business in the hardware section, but for some
|
---|
1376 | // clever reason <Hardware> is where they are in the XML....
|
---|
1377 | SharedFoldersList llSharedFolders;
|
---|
1378 |
|
---|
1379 | ClipboardMode_T clipboardMode;
|
---|
1380 | bool fClipboardFileTransfersEnabled;
|
---|
1381 |
|
---|
1382 | DnDMode_T dndMode;
|
---|
1383 |
|
---|
1384 | uint32_t ulMemoryBalloonSize;
|
---|
1385 | bool fPageFusionEnabled;
|
---|
1386 |
|
---|
1387 | GuestPropertiesList llGuestProperties;
|
---|
1388 |
|
---|
1389 | IOSettings ioSettings; // requires settings version 1.10 (VirtualBox 3.2)
|
---|
1390 | HostPCIDeviceAttachmentList pciAttachments; // requires settings version 1.12 (VirtualBox 4.1)
|
---|
1391 |
|
---|
1392 | com::Utf8Str strDefaultFrontend; // requires settings version 1.14 (VirtualBox 4.3)
|
---|
1393 | };
|
---|
1394 |
|
---|
1395 | /**
|
---|
1396 | * Settings that has to do with debugging.
|
---|
1397 | */
|
---|
1398 | struct Debugging
|
---|
1399 | {
|
---|
1400 | Debugging();
|
---|
1401 |
|
---|
1402 | bool areDefaultSettings() const;
|
---|
1403 |
|
---|
1404 | bool operator==(const Debugging &rOther) const;
|
---|
1405 |
|
---|
1406 | bool fTracingEnabled;
|
---|
1407 | bool fAllowTracingToAccessVM;
|
---|
1408 | com::Utf8Str strTracingConfig;
|
---|
1409 | GuestDebugProvider_T enmDbgProvider;
|
---|
1410 | GuestDebugIoProvider_T enmIoProvider;
|
---|
1411 | com::Utf8Str strAddress;
|
---|
1412 | uint32_t ulPort;
|
---|
1413 | };
|
---|
1414 |
|
---|
1415 | /**
|
---|
1416 | * Settings that has to do with autostart.
|
---|
1417 | */
|
---|
1418 | struct Autostart
|
---|
1419 | {
|
---|
1420 | Autostart();
|
---|
1421 |
|
---|
1422 | bool areDefaultSettings() const;
|
---|
1423 |
|
---|
1424 | bool operator==(const Autostart &rOther) const;
|
---|
1425 |
|
---|
1426 | bool fAutostartEnabled;
|
---|
1427 | uint32_t uAutostartDelay;
|
---|
1428 | AutostopType_T enmAutostopType;
|
---|
1429 | };
|
---|
1430 |
|
---|
1431 | struct Snapshot;
|
---|
1432 | typedef std::list<Snapshot> SnapshotsList;
|
---|
1433 |
|
---|
1434 | /**
|
---|
1435 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1436 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1437 | * your settings might never get saved.
|
---|
1438 | */
|
---|
1439 | struct Snapshot
|
---|
1440 | {
|
---|
1441 | Snapshot();
|
---|
1442 |
|
---|
1443 | bool operator==(const Snapshot &s) const;
|
---|
1444 |
|
---|
1445 | com::Guid uuid;
|
---|
1446 | com::Utf8Str strName,
|
---|
1447 | strDescription; // optional
|
---|
1448 | RTTIMESPEC timestamp;
|
---|
1449 |
|
---|
1450 | com::Utf8Str strStateFile; // for online snapshots only
|
---|
1451 |
|
---|
1452 | Hardware hardware;
|
---|
1453 |
|
---|
1454 | Debugging debugging;
|
---|
1455 | Autostart autostart;
|
---|
1456 | RecordingSettings recordingSettings;
|
---|
1457 |
|
---|
1458 | SnapshotsList llChildSnapshots;
|
---|
1459 |
|
---|
1460 | static const struct Snapshot Empty;
|
---|
1461 | };
|
---|
1462 |
|
---|
1463 | /**
|
---|
1464 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1465 | * the operator== which is used by MachineConfigFile::operator==(), or otherwise
|
---|
1466 | * your settings might never get saved.
|
---|
1467 | */
|
---|
1468 | struct MachineUserData
|
---|
1469 | {
|
---|
1470 | MachineUserData();
|
---|
1471 |
|
---|
1472 | bool operator==(const MachineUserData &c) const;
|
---|
1473 |
|
---|
1474 | com::Utf8Str strName;
|
---|
1475 | bool fDirectoryIncludesUUID;
|
---|
1476 | bool fNameSync;
|
---|
1477 | com::Utf8Str strDescription;
|
---|
1478 | StringsList llGroups;
|
---|
1479 | com::Utf8Str strOsType;
|
---|
1480 | com::Utf8Str strSnapshotFolder;
|
---|
1481 | bool fTeleporterEnabled;
|
---|
1482 | uint32_t uTeleporterPort;
|
---|
1483 | com::Utf8Str strTeleporterAddress;
|
---|
1484 | com::Utf8Str strTeleporterPassword;
|
---|
1485 | IconBlob ovIcon;
|
---|
1486 | VMProcPriority_T enmVMPriority;
|
---|
1487 | };
|
---|
1488 |
|
---|
1489 |
|
---|
1490 | /**
|
---|
1491 | * MachineConfigFile represents an XML machine configuration. All the machine settings
|
---|
1492 | * that go out to the XML (or are read from it) are in here.
|
---|
1493 | *
|
---|
1494 | * NOTE: If you add any fields in here, you must update a) the constructor and b)
|
---|
1495 | * the operator== which is used by Machine::saveSettings(), or otherwise your settings
|
---|
1496 | * might never get saved.
|
---|
1497 | */
|
---|
1498 | class MachineConfigFile : public ConfigFileBase
|
---|
1499 | {
|
---|
1500 | public:
|
---|
1501 | com::Guid uuid;
|
---|
1502 |
|
---|
1503 | enum
|
---|
1504 | {
|
---|
1505 | ParseState_NotParsed,
|
---|
1506 | ParseState_PasswordError,
|
---|
1507 | ParseState_Parsed
|
---|
1508 | } enmParseState;
|
---|
1509 |
|
---|
1510 | MachineUserData machineUserData;
|
---|
1511 |
|
---|
1512 | com::Utf8Str strStateKeyId;
|
---|
1513 | com::Utf8Str strStateKeyStore;
|
---|
1514 | com::Utf8Str strStateFile;
|
---|
1515 | bool fCurrentStateModified; // optional, default is true
|
---|
1516 | RTTIMESPEC timeLastStateChange; // optional, defaults to now
|
---|
1517 | bool fAborted; // optional, default is false
|
---|
1518 |
|
---|
1519 | com::Guid uuidCurrentSnapshot;
|
---|
1520 |
|
---|
1521 | Hardware hardwareMachine;
|
---|
1522 | MediaRegistry mediaRegistry;
|
---|
1523 | Debugging debugging;
|
---|
1524 | Autostart autostart;
|
---|
1525 | RecordingSettings recordingSettings;
|
---|
1526 |
|
---|
1527 | StringsMap mapExtraDataItems;
|
---|
1528 |
|
---|
1529 | SnapshotsList llFirstSnapshot; // first snapshot or empty list if there's none
|
---|
1530 |
|
---|
1531 | com::Utf8Str strKeyId;
|
---|
1532 | com::Utf8Str strKeyStore; // if not empty, the encryption is used
|
---|
1533 | com::Utf8Str strLogKeyId;
|
---|
1534 | com::Utf8Str strLogKeyStore;
|
---|
1535 |
|
---|
1536 | MachineConfigFile(const com::Utf8Str *pstrFilename,
|
---|
1537 | PCVBOXCRYPTOIF pCryptoIf = NULL,
|
---|
1538 | const char *pszPassword = NULL);
|
---|
1539 |
|
---|
1540 | bool operator==(const MachineConfigFile &m) const;
|
---|
1541 |
|
---|
1542 | bool canHaveOwnMediaRegistry() const;
|
---|
1543 |
|
---|
1544 | void importMachineXML(const xml::ElementNode &elmMachine);
|
---|
1545 |
|
---|
1546 | void write(const com::Utf8Str &strFilename, PCVBOXCRYPTOIF pCryptoIf = NULL, const char *pszPassword = NULL);
|
---|
1547 |
|
---|
1548 | enum
|
---|
1549 | {
|
---|
1550 | BuildMachineXML_IncludeSnapshots = 0x01,
|
---|
1551 | BuildMachineXML_WriteVBoxVersionAttribute = 0x02,
|
---|
1552 | BuildMachineXML_SkipRemovableMedia = 0x04,
|
---|
1553 | BuildMachineXML_MediaRegistry = 0x08,
|
---|
1554 | BuildMachineXML_SuppressSavedState = 0x10
|
---|
1555 | };
|
---|
1556 |
|
---|
1557 | void copyEncryptionSettingsFrom(const MachineConfigFile &other);
|
---|
1558 | void buildMachineXML(xml::ElementNode &elmMachine,
|
---|
1559 | uint32_t fl,
|
---|
1560 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1561 |
|
---|
1562 | static bool isAudioDriverAllowedOnThisHost(AudioDriverType_T enmDrvType);
|
---|
1563 | static AudioDriverType_T getHostDefaultAudioDriver();
|
---|
1564 | static bool convertGuestOSTypeSuffix(com::Utf8Str &str, const char *pszToReplace, const char *pszReplacement);
|
---|
1565 |
|
---|
1566 | private:
|
---|
1567 | void readNetworkAdapters(const xml::ElementNode &elmHardware, NetworkAdaptersList &ll);
|
---|
1568 | void readAttachedNetworkMode(const xml::ElementNode &pelmMode, bool fEnabled, NetworkAdapter &nic);
|
---|
1569 | void readCpuIdTreeX86(const xml::ElementNode &elmCpuid, CpuIdLeafsX86List &ll);
|
---|
1570 | void readCpuTree(const xml::ElementNode &elmCpu, CpuList &ll);
|
---|
1571 | void readSerialPorts(const xml::ElementNode &elmUART, SerialPortsList &ll);
|
---|
1572 | void readParallelPorts(const xml::ElementNode &elmLPT, ParallelPortsList &ll);
|
---|
1573 | void readAudioAdapter(const xml::ElementNode &elmAudioAdapter, AudioAdapter &aa);
|
---|
1574 | void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw);
|
---|
1575 | void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
|
---|
1576 | void readPlatformCPUIDTreeX86(const xml::ElementNode &elmChild, PlatformX86 &platX86);
|
---|
1577 | void readPlatformX86(const xml::ElementNode &elmPlatformX86OrHardware, PlatformX86 &platX86);
|
---|
1578 | void readPlatform(const xml::ElementNode &elmPlatformOrHardware, Hardware &hw, Platform &plat);
|
---|
1579 | void readHardware(const xml::ElementNode &elmHardware, Hardware &hw);
|
---|
1580 | void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg);
|
---|
1581 | void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg);
|
---|
1582 | void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg);
|
---|
1583 | void readTeleporter(const xml::ElementNode &elmTeleporter, MachineUserData &userData);
|
---|
1584 | void readDebugging(const xml::ElementNode &elmDbg, Debugging &dbg);
|
---|
1585 | void readAutostart(const xml::ElementNode &elmAutostart, Autostart &autostrt);
|
---|
1586 | void readRecordingSettings(const xml::ElementNode &elmRecording, uint32_t cMonitors, RecordingSettings &recording);
|
---|
1587 | void readGroups(const xml::ElementNode &elmGroups, StringsList &llGroups);
|
---|
1588 | bool readSnapshot(const com::Guid &curSnapshotUuid, const xml::ElementNode &elmSnapshot, Snapshot &snap);
|
---|
1589 | void convertGuestOSTypeFromPre1_5(com::Utf8Str &str);
|
---|
1590 | void convertGuestOSTypeFromPre1_20(com::Utf8Str &str);
|
---|
1591 | void convertGuestOSTypeToPre1_20(com::Utf8Str &str);
|
---|
1592 | void readMachine(const xml::ElementNode &elmMachine);
|
---|
1593 | void readMachineEncrypted(const xml::ElementNode &elmMachine, PCVBOXCRYPTOIF pCryptoIf, const char *pszPassword);
|
---|
1594 |
|
---|
1595 | void buildPlatformX86XML(xml::ElementNode &elmParent, xml::ElementNode &elmCPU, const PlatformX86 &plat);
|
---|
1596 | void buildPlatformXML(xml::ElementNode &elmParent, const Hardware &h, const Platform &plat);
|
---|
1597 | void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, uint32_t fl, std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1598 | void buildNetworkXML(NetworkAttachmentType_T mode, bool fEnabled, xml::ElementNode &elmParent, const NetworkAdapter &nic);
|
---|
1599 | void buildStorageControllersXML(xml::ElementNode &elmParent,
|
---|
1600 | const Storage &st,
|
---|
1601 | bool fSkipRemovableMedia,
|
---|
1602 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
|
---|
1603 | void buildDebuggingXML(xml::ElementNode &elmParent, const Debugging &dbg);
|
---|
1604 | void buildAutostartXML(xml::ElementNode &elmParent, const Autostart &autostrt);
|
---|
1605 | void buildRecordingXML(xml::ElementNode &elmParent, const RecordingSettings &recording);
|
---|
1606 | void buildGroupsXML(xml::ElementNode &elmParent, const StringsList &llGroups);
|
---|
1607 | void buildSnapshotXML(xml::ElementNode &elmParent, const Snapshot &snap);
|
---|
1608 |
|
---|
1609 | void buildMachineEncryptedXML(xml::ElementNode &elmMachine,
|
---|
1610 | uint32_t fl,
|
---|
1611 | std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
|
---|
1612 | PCVBOXCRYPTOIF pCryptoIf,
|
---|
1613 | const char *pszPassword);
|
---|
1614 |
|
---|
1615 | void bumpSettingsVersionIfNeeded();
|
---|
1616 | };
|
---|
1617 |
|
---|
1618 | } // namespace settings
|
---|
1619 |
|
---|
1620 |
|
---|
1621 | #endif /* !VBOX_INCLUDED_settings_h */
|
---|