VirtualBox

source: vbox/trunk/include/VBox/settings.h@ 104384

Last change on this file since 104384 was 103090, checked in by vboxsync, 8 months ago

Main,FE/VBoxManage,FE/VirtualBox,ValidationKit: Allow setting the primary VM execution engine to make it easier to force particular engine for testing, bugref:10583 [forgotten file]

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette