VirtualBox

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

Last change on this file since 107330 was 107187, checked in by vboxsync, 2 months ago

include/VBox/settings.h: Removed Hardware::fSyntheticCpu (unused), found by Parfait.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 56.4 KB
Line 
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-2024 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
87namespace xml
88{
89 class ElementNode;
90}
91
92namespace settings
93{
94
95class ConfigFileError;
96
97////////////////////////////////////////////////////////////////////////////////
98//
99// Structures shared between Machine XML and VirtualBox.xml
100//
101////////////////////////////////////////////////////////////////////////////////
102
103typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;
104typedef 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 */
114struct 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
134typedef std::list<USBDeviceFilter> USBDeviceFiltersList;
135
136struct Medium;
137typedef 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 */
144struct 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 */
174struct 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 */
188struct 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};
201typedef std::map<com::Utf8Str, NATRule> NATRulesMap;
202
203struct 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
224typedef std::list<NATHostLoopbackOffset> NATLoopbackOffsetList;
225
226typedef 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 */
232class ConfigFileBase
233{
234public:
235 bool fileExists();
236 SettingsVersion_T getSettingsVersion();
237
238 void copyBaseFrom(const ConfigFileBase &b);
239
240protected:
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 &timestamp,
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
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
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
329struct 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
339struct 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
360struct PlatformProperties
361{
362 PlatformProperties();
363
364 bool fExclusiveHwVirt;
365};
366
367struct MachineRegistryEntry
368{
369 com::Guid uuid;
370 com::Utf8Str strSettingsFile;
371};
372
373typedef std::list<MachineRegistryEntry> MachinesRegistry;
374
375struct 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
384typedef std::map<DHCPOption_T, DhcpOptValue> DhcpOptionMap;
385typedef DhcpOptionMap::value_type DhcpOptValuePair;
386typedef DhcpOptionMap::iterator DhcpOptIterator;
387typedef DhcpOptionMap::const_iterator DhcpOptConstIterator;
388
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
400struct 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
412struct DHCPGroupConfig : DHCPConfig
413{
414 DHCPGroupConfig();
415
416 com::Utf8Str strName;
417 DHCPGroupConditionVec vecConditions;
418};
419typedef std::vector<DHCPGroupConfig> DHCPGroupConfigVec;
420
421struct DHCPIndividualConfig : DHCPConfig
422{
423 DHCPIndividualConfig();
424
425 com::Utf8Str strMACAddress;
426 com::Utf8Str strVMName;
427 uint32_t uSlot;
428 com::Utf8Str strFixedAddress;
429};
430typedef std::map<com::Utf8Str, DHCPIndividualConfig> DHCPIndividualConfigMap;
431
432struct 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};
445typedef std::list<DHCPServer> DHCPServersList;
446
447
448/**
449 * NAT Networking settings (NAT service).
450 */
451struct 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
468typedef std::list<NATNetwork> NATNetworksList;
469
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
489#ifdef VBOX_WITH_CLOUD_NET
490/**
491 * Cloud Networking settings.
492 */
493struct 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
504typedef std::list<CloudNetwork> CloudNetworksList;
505#endif /* VBOX_WITH_CLOUD_NET */
506
507
508class MainConfigFile : public ConfigFileBase
509{
510public:
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
539private:
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 */
561struct 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 */
584struct 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 fAutoSerialNumGen;
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;
605};
606
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
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;
638 com::Utf8Str strKeyId;
639 com::Utf8Str strKeyStore;
640};
641
642/** List for keeping a recording feature list. */
643typedef std::map<RecordingFeature_T, bool> RecordingFeatureMap;
644
645/**
646 * Recording settings for a single screen (e.g. virtual monitor).
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.
651 */
652struct RecordingScreen
653{
654 RecordingScreen(uint32_t idScreen = UINT32_MAX);
655 virtual ~RecordingScreen();
656
657#if RT_CPLUSPLUS_PREREQ(201100) /* VC2022: Excplit default copy constructor and copy assignment operator to avoid warnings. */
658 RecordingScreen(RecordingScreen const &) = default;
659 RecordingScreen &operator=(RecordingScreen const &) = default;
660#endif
661
662 void applyDefaults(void);
663
664 bool areDefaultSettings(void) const;
665
666 bool isFeatureEnabled(RecordingFeature_T enmFeature) const;
667
668 static const char *getDefaultOptions(void);
669
670 static int featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap);
671
672 static void featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures);
673
674 static int audioCodecFromString(const com::Utf8Str &strCodec, RecordingAudioCodec_T &enmCodec);
675
676 static void audioCodecToString(const RecordingAudioCodec_T &enmCodec, com::Utf8Str &strCodec);
677
678 static int videoCodecFromString(const com::Utf8Str &strCodec, RecordingVideoCodec_T &enmCodec);
679
680 static void videoCodecToString(const RecordingVideoCodec_T &enmCodec, com::Utf8Str &strCodec);
681
682 bool operator==(const RecordingScreen &d) const;
683
684 /** Screen ID.
685 * UINT32_MAX if not set. */
686 uint32_t idScreen;
687 /** Whether to record this screen or not. */
688 bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
689 /** Destination to record to. */
690 RecordingDestination_T enmDest;
691 /** Which features are enable or not. */
692 RecordingFeatureMap featureMap; // requires settings version 1.19 (VirtualBox 7.0)
693 /** Maximum time (in s) to record. If set to 0, no time limit is set. */
694 uint32_t ulMaxTimeS; // requires settings version 1.14 (VirtualBox 4.3)
695 /** Options string for hidden / advanced / experimental features.
696 * Use RecordingScreenSettings::getDefaultOptions(). */
697 com::Utf8Str strOptions; // new since VirtualBox 5.2.
698
699 /**
700 * Structure holding settings for audio recording.
701 */
702 struct Audio
703 {
704 /** The audio codec type to use. */
705 RecordingAudioCodec_T enmCodec; // requires settings version 1.19 (VirtualBox 7.0)
706 /** Codec deadline to use. */
707 RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
708 /** Rate control mode to use. */
709 RecordingRateControlMode_T
710 enmRateCtlMode;// requires settings version 1.19 (VirtualBox 7.0)
711 /** Hz rate. */
712 uint16_t uHz; // requires settings version 1.19 (VirtualBox 7.0)
713 /** Bits per sample. */
714 uint8_t cBits; // requires settings version 1.19 (VirtualBox 7.0)
715 /** Number of audio channels. */
716 uint8_t cChannels; // requires settings version 1.19 (VirtualBox 7.0)
717 } Audio;
718
719 /**
720 * Structure holding settings for video recording.
721 */
722 struct Video
723 {
724 /** The codec to use. */
725 RecordingVideoCodec_T enmCodec; // requires settings version 1.19 (VirtualBox 7.0)
726 /** Codec deadline to use. */
727 RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
728 /** Rate control mode to use. */
729 RecordingRateControlMode_T
730 enmRateCtlMode; // requires settings version 1.19 (VirtualBox 7.0)
731 /** Rate control mode to use. */
732 RecordingVideoScalingMode_T
733 enmScalingMode; // requires settings version 1.19 (VirtualBox 7.0)
734 /** Target frame width in pixels (X). */
735 uint32_t ulWidth; // requires settings version 1.14 (VirtualBox 4.3)
736 /** Target frame height in pixels (Y). */
737 uint32_t ulHeight; // requires settings version 1.14 (VirtualBox 4.3)
738 /** Encoding rate. */
739 uint32_t ulRate; // requires settings version 1.14 (VirtualBox 4.3)
740 /** Frames per second (FPS). */
741 uint32_t ulFPS; // requires settings version 1.14 (VirtualBox 4.3)
742 } Video;
743
744 /**
745 * Structure holding settings if the destination is a file.
746 */
747 struct File
748 {
749 /** Maximum size (in MB) the file is allowed to have.
750 * When reaching the limit, recording will stop. 0 means no limit. */
751 uint32_t ulMaxSizeMB; // requires settings version 1.14 (VirtualBox 4.3)
752 /** Absolute file name path to use for recording.
753 * When empty, this is considered as being the default setting. */
754 com::Utf8Str strName; // requires settings version 1.14 (VirtualBox 4.3)
755 } File;
756};
757
758/** Map for keeping settings per virtual screen.
759 * The key specifies the screen ID. */
760typedef std::map<uint32_t, RecordingScreen> RecordingScreenSettingsMap;
761
762/**
763 * Common recording settings, shared among all per-screen recording settings.
764 *
765 * NOTE: If you add any fields in here, you must update a) the constructor and b)
766 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
767 * your settings might never get saved.
768 */
769struct RecordingCommon
770{
771 RecordingCommon();
772
773 void applyDefaults(void);
774
775 bool areDefaultSettings(void) const;
776
777 bool operator==(const RecordingCommon &d) const;
778
779 /** Whether recording as a whole is enabled or disabled. */
780 bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
781};
782
783/**
784 * NOTE: If you add any fields in here, you must update a) the constructor and b)
785 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
786 * your settings might never get saved.
787 */
788struct Recording
789{
790 Recording();
791
792 void applyDefaults(void);
793
794 bool areDefaultSettings(void) const;
795
796 bool operator==(const Recording &that) const;
797
798 /** Common settings for all per-screen recording settings. */
799 RecordingCommon common;
800 /** Map of handled recording screen settings.
801 * The key specifies the screen ID. */
802 RecordingScreenSettingsMap mapScreens;
803};
804
805/**
806 * NOTE: If you add any fields in here, you must update a) the constructor and b)
807 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
808 * your settings might never get saved.
809 */
810struct GraphicsAdapter
811{
812 GraphicsAdapter();
813
814 bool areDefaultSettings() const;
815
816 bool operator==(const GraphicsAdapter &g) const;
817
818 GraphicsControllerType_T graphicsControllerType;
819 uint32_t ulVRAMSizeMB;
820 uint32_t cMonitors;
821 bool fAccelerate3D,
822 fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
823};
824
825/**
826 * NOTE: If you add any fields in here, you must update a) the constructor and b)
827 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
828 * your settings might never get saved.
829 */
830struct USBController
831{
832 USBController();
833
834 bool operator==(const USBController &u) const;
835
836 com::Utf8Str strName;
837 USBControllerType_T enmType;
838};
839
840typedef std::list<USBController> USBControllerList;
841
842struct USB
843{
844 USB();
845
846 bool operator==(const USB &u) const;
847
848 /** List of USB controllers present. */
849 USBControllerList llUSBControllers;
850 /** List of USB device filters. */
851 USBDeviceFiltersList llDeviceFilters;
852};
853
854struct NAT
855{
856 NAT();
857
858 bool areDNSDefaultSettings() const;
859 bool areAliasDefaultSettings() const;
860 bool areTFTPDefaultSettings() const;
861 bool areLocalhostReachableDefaultSettings(SettingsVersion_T sv) const;
862 bool areDefaultSettings(SettingsVersion_T sv) const;
863
864 bool operator==(const NAT &n) const;
865
866 com::Utf8Str strNetwork;
867 com::Utf8Str strBindIP;
868 uint32_t u32Mtu;
869 uint32_t u32SockRcv;
870 uint32_t u32SockSnd;
871 uint32_t u32TcpRcv;
872 uint32_t u32TcpSnd;
873 com::Utf8Str strTFTPPrefix;
874 com::Utf8Str strTFTPBootFile;
875 com::Utf8Str strTFTPNextServer;
876 bool fDNSPassDomain;
877 bool fDNSProxy;
878 bool fDNSUseHostResolver;
879 bool fAliasLog;
880 bool fAliasProxyOnly;
881 bool fAliasUseSamePorts;
882 bool fLocalhostReachable;
883 NATRulesMap mapRules;
884};
885
886/**
887 * NOTE: If you add any fields in here, you must update a) the constructor and b)
888 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
889 * your settings might never get saved.
890 */
891struct NetworkAdapter
892{
893 NetworkAdapter();
894
895 bool areGenericDriverDefaultSettings() const;
896 bool areDefaultSettings(SettingsVersion_T sv) const;
897 bool areDisabledDefaultSettings(SettingsVersion_T sv) const;
898
899 bool operator==(const NetworkAdapter &n) const;
900
901 uint32_t ulSlot;
902
903 NetworkAdapterType_T type;
904 bool fEnabled;
905 com::Utf8Str strMACAddress;
906 bool fCableConnected;
907 uint32_t ulLineSpeed;
908 NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
909 bool fTraceEnabled;
910 com::Utf8Str strTraceFile;
911
912 NetworkAttachmentType_T mode;
913 NAT nat;
914 com::Utf8Str strBridgedName;
915 com::Utf8Str strHostOnlyName;
916#ifdef VBOX_WITH_VMNET
917 com::Utf8Str strHostOnlyNetworkName;
918#endif /* VBOX_WITH_VMNET */
919 com::Utf8Str strInternalNetworkName;
920 com::Utf8Str strGenericDriver;
921 StringsMap genericProperties;
922 com::Utf8Str strNATNetworkName;
923#ifdef VBOX_WITH_CLOUD_NET
924 com::Utf8Str strCloudNetworkName;
925#endif /* VBOX_WITH_CLOUD_NET */
926 uint32_t ulBootPriority;
927 com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2)
928};
929
930typedef std::list<NetworkAdapter> NetworkAdaptersList;
931
932/**
933 * NOTE: If you add any fields in here, you must update a) the constructor and b)
934 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
935 * your settings might never get saved.
936 */
937struct SerialPort
938{
939 SerialPort();
940
941 bool operator==(const SerialPort &n) const;
942
943 uint32_t ulSlot;
944
945 bool fEnabled;
946 uint32_t ulIOAddress;
947 uint32_t ulIRQ;
948 PortMode_T portMode;
949 com::Utf8Str strPath;
950 bool fServer;
951 UartType_T uartType;
952};
953
954typedef std::list<SerialPort> SerialPortsList;
955
956/**
957 * NOTE: If you add any fields in here, you must update a) the constructor and b)
958 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
959 * your settings might never get saved.
960 */
961struct ParallelPort
962{
963 ParallelPort();
964
965 bool operator==(const ParallelPort &d) const;
966
967 uint32_t ulSlot;
968
969 bool fEnabled;
970 uint32_t ulIOBase;
971 uint32_t ulIRQ;
972 com::Utf8Str strPath;
973};
974
975typedef std::list<ParallelPort> ParallelPortsList;
976
977/**
978 * NOTE: If you add any fields in here, you must update a) the constructor and b)
979 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
980 * your settings might never get saved.
981 */
982struct AudioAdapter
983{
984 AudioAdapter();
985
986 bool areDefaultSettings(SettingsVersion_T sv) const;
987
988 bool operator==(const AudioAdapter &a) const;
989
990 bool fEnabled;
991 bool fEnabledIn;
992 bool fEnabledOut;
993 AudioControllerType_T controllerType;
994 AudioCodecType_T codecType;
995 AudioDriverType_T driverType;
996 settings::StringsMap properties;
997};
998
999/**
1000 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1001 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1002 * your settings might never get saved.
1003 */
1004struct SharedFolder
1005{
1006 SharedFolder();
1007
1008 bool operator==(const SharedFolder &a) const;
1009
1010 com::Utf8Str strName,
1011 strHostPath;
1012 bool fWritable;
1013 bool fAutoMount;
1014 com::Utf8Str strAutoMountPoint;
1015 SymlinkPolicy_T enmSymlinkPolicy;
1016};
1017
1018typedef std::list<SharedFolder> SharedFoldersList;
1019
1020/**
1021 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1022 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1023 * your settings might never get saved.
1024 */
1025struct GuestProperty
1026{
1027 GuestProperty();
1028
1029 bool operator==(const GuestProperty &g) const;
1030
1031 com::Utf8Str strName,
1032 strValue;
1033 uint64_t timestamp;
1034 com::Utf8Str strFlags;
1035};
1036
1037typedef std::list<GuestProperty> GuestPropertiesList;
1038
1039typedef std::map<uint32_t, DeviceType_T> BootOrderMap;
1040
1041/**
1042 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1043 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1044 * your settings might never get saved.
1045 */
1046struct CpuIdLeafX86
1047{
1048 CpuIdLeafX86();
1049
1050 bool operator==(const CpuIdLeafX86 &c) const;
1051
1052 uint32_t idx;
1053 uint32_t idxSub;
1054 uint32_t uEax;
1055 uint32_t uEbx;
1056 uint32_t uEcx;
1057 uint32_t uEdx;
1058};
1059
1060typedef std::list<CpuIdLeafX86> CpuIdLeafsX86List;
1061
1062/**
1063 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1064 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1065 * your settings might never get saved.
1066 */
1067struct Cpu
1068{
1069 Cpu();
1070
1071 bool operator==(const Cpu &c) const;
1072
1073 uint32_t ulId;
1074};
1075
1076typedef std::list<Cpu> CpuList;
1077
1078/**
1079 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1080 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1081 * your settings might never get saved.
1082 */
1083struct BandwidthGroup
1084{
1085 BandwidthGroup();
1086
1087 bool operator==(const BandwidthGroup &i) const;
1088
1089 com::Utf8Str strName;
1090 uint64_t cMaxBytesPerSec;
1091 BandwidthGroupType_T enmType;
1092};
1093
1094typedef std::list<BandwidthGroup> BandwidthGroupList;
1095
1096/**
1097 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1098 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1099 * your settings might never get saved.
1100 */
1101struct IOSettings
1102{
1103 IOSettings();
1104
1105 bool areIOCacheDefaultSettings() const;
1106 bool areDefaultSettings() const;
1107
1108 bool operator==(const IOSettings &i) const;
1109
1110 bool fIOCacheEnabled;
1111 uint32_t ulIOCacheSize;
1112 BandwidthGroupList llBandwidthGroups;
1113};
1114
1115/**
1116 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1117 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1118 * your settings might never get saved.
1119 */
1120struct HostPCIDeviceAttachment
1121{
1122 HostPCIDeviceAttachment();
1123
1124 bool operator==(const HostPCIDeviceAttachment &a) const;
1125
1126 com::Utf8Str strDeviceName;
1127 uint32_t uHostAddress;
1128 uint32_t uGuestAddress;
1129};
1130
1131typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList;
1132
1133/**
1134 * A device attached to a storage controller. This can either be a
1135 * hard disk or a DVD drive or a floppy drive and also specifies
1136 * which medium is "in" the drive; as a result, this is a combination
1137 * of the Main IMedium and IMediumAttachment interfaces.
1138 *
1139 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1140 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1141 * your settings might never get saved.
1142 */
1143struct AttachedDevice
1144{
1145 AttachedDevice();
1146
1147 bool operator==(const AttachedDevice &a) const;
1148
1149 DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed
1150
1151 // DVDs can be in pass-through mode:
1152 bool fPassThrough;
1153
1154 // Whether guest-triggered eject of DVDs will keep the medium in the
1155 // VM config or not:
1156 bool fTempEject;
1157
1158 // Whether the medium is non-rotational:
1159 bool fNonRotational;
1160
1161 // Whether the medium supports discarding unused blocks:
1162 bool fDiscard;
1163
1164 // Whether the medium is hot-pluggable:
1165 bool fHotPluggable;
1166
1167 int32_t lPort;
1168 int32_t lDevice;
1169
1170 // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
1171 // this is its UUID; it depends on deviceType which media registry this then needs to
1172 // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
1173 com::Guid uuid;
1174
1175 // for DVDs and floppies, the attachment can also be a host device:
1176 com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src
1177
1178 // Bandwidth group the device is attached to.
1179 com::Utf8Str strBwGroup;
1180};
1181
1182typedef std::list<AttachedDevice> AttachedDevicesList;
1183
1184/**
1185 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1186 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1187 * your settings might never get saved.
1188 */
1189struct StorageController
1190{
1191 StorageController();
1192
1193 bool operator==(const StorageController &s) const;
1194
1195 com::Utf8Str strName;
1196 StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS
1197 StorageControllerType_T controllerType;
1198 uint32_t ulPortCount;
1199 uint32_t ulInstance;
1200 bool fUseHostIOCache;
1201 bool fBootable;
1202
1203 // only for when controllerType == StorageControllerType_IntelAhci:
1204 int32_t lIDE0MasterEmulationPort,
1205 lIDE0SlaveEmulationPort,
1206 lIDE1MasterEmulationPort,
1207 lIDE1SlaveEmulationPort;
1208
1209 AttachedDevicesList llAttachedDevices;
1210};
1211
1212typedef std::list<StorageController> StorageControllersList;
1213
1214/**
1215 * We wrap the storage controllers list into an extra struct so we can
1216 * use an undefined struct without needing std::list<> in all the headers.
1217 *
1218 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1219 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1220 * your settings might never get saved.
1221 */
1222struct Storage
1223{
1224 bool operator==(const Storage &s) const;
1225
1226 StorageControllersList llStorageControllers;
1227};
1228
1229#ifdef VBOX_WITH_VIRT_ARMV8
1230struct PlatformARM
1231{
1232 PlatformARM();
1233
1234 bool operator==(const PlatformARM&) const;
1235
1236 /** Nested hardware virtualization. */
1237 bool fNestedHWVirt; //< requires settings version 1.20 (VirtualBox 7.1)
1238};
1239#endif /* VBOX_WITH_VIRT_ARMV8 */
1240
1241/**
1242 * Covers x86-specific platform attributes.
1243 *
1244 * New since settings v1.20 (VirtualBox 7.1).
1245 * Contains attributes which were in the Hardware settings before.
1246 */
1247struct PlatformX86
1248{
1249 PlatformX86();
1250
1251 bool operator==(const PlatformX86&) const;
1252
1253 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
1254 bool fPAE;
1255 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
1256 bool fAPIC; // requires settings version 1.16 (VirtualBox 5.1)
1257 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
1258 bool fX2APIC; // requires settings version 1.16 (VirtualBox 5.1)
1259 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.10 (VirtualBox 3.2). */
1260 bool fHPETEnabled;
1261 /** Note: Lived in Hardware for settings < version 1.20. */
1262 typedef enum LongModeType { LongMode_Enabled, LongMode_Disabled, LongMode_Legacy } LongModeType;
1263 /** Note: Lived in Hardware for settings < version 1.20. */
1264 LongModeType enmLongMode;
1265 /** Custom x86 CPUID leafs list.
1266 * Note: Lived in Hardware for settings < version 1.20. */
1267 CpuIdLeafsX86List llCpuIdLeafs;
1268 /** Note: Lived in Hardware for settings < version 1.20. */
1269 bool fTripleFaultReset;
1270 /** Note: Lived in Hardware for settings < version 1.20. */
1271 bool fIBPBOnVMExit; //< added out of cycle, after settings version 1.16 was out.
1272 /** Note: Lived in Hardware for settings < version 1.20. */
1273 bool fIBPBOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
1274 /** Note: Lived in Hardware for settings < version 1.20. */
1275 bool fSpecCtrl; //< added out of cycle, after settings version 1.16 was out.
1276 /** Note: Lived in Hardware for settings < version 1.20. */
1277 bool fSpecCtrlByHost; //< added out of cycle, after settings version 1.16 was out.
1278 /** Note: Lived in Hardware for settings < version 1.20. */
1279 bool fL1DFlushOnSched; //< added out of cycle, after settings version 1.16 was out.
1280 /** Note: Lived in Hardware for settings < version 1.20. */
1281 bool fL1DFlushOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
1282 /** Note: Lived in Hardware for settings < version 1.20. */
1283 bool fMDSClearOnSched; //< added out of cycle, after settings version 1.16 was out.
1284 /** Note: Lived in Hardware for settings < version 1.20. */
1285 bool fMDSClearOnVMEntry; //< added out of cycle, after settings version 1.16 was out.
1286 bool fHWVirtEx;
1287 bool fHWVirtExNestedPaging;
1288 bool fHWVirtExLargePages;
1289 bool fHWVirtExVPID;
1290 /** Unrestricted execution. */
1291 bool fHWVirtExUX;
1292 bool fHWVirtExForce;
1293 bool fHWVirtExUseNativeApi;
1294 /** AMD-V VMSAVE/VMLOAD. */
1295 bool fHWVirtExVirtVmsaveVmload;
1296 /** Nested VT-x / AMD-V.
1297 * Note: Lived in Hardware for settings < version 1.20. */
1298 bool fNestedHWVirt; //< requires settings version 1.17 (VirtualBox 6.0)
1299};
1300
1301/**
1302 * Covers common platform attributes.
1303 *
1304 * New since settings v1.20 (VirtualBox 7.1).
1305 * Contains attributes which were in the Hardware settings before.
1306 */
1307struct Platform
1308{
1309 Platform();
1310
1311 bool operator==(const Platform&) const;
1312
1313 /** Requires settings version 1.20 (VirtualBox 7.1). */
1314 PlatformArchitecture_T architectureType;
1315 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.11 (VirtualBox 4.0). */
1316 ChipsetType_T chipsetType;
1317 /** Note: Lived in Hardware for settings < version 1.20 (requires settings version 1.19 (VirtualBox 6.2). */
1318 IommuType_T iommuType;
1319 /** Note: Lived in Hardware for settings < version 1.20. */
1320 bool fRTCUseUTC;
1321 /** Note: Is a class, so we can't use a union here. */
1322 PlatformX86 x86;
1323#ifdef VBOX_WITH_VIRT_ARMV8
1324 /** Note: Is a class, so we can't use a union here. */
1325 PlatformARM arm;
1326#endif
1327};
1328
1329/**
1330 * Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
1331 * field.
1332 *
1333 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1334 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1335 * your settings might never get saved.
1336 */
1337struct Hardware
1338{
1339 Hardware();
1340
1341 bool areParavirtDefaultSettings(SettingsVersion_T sv) const;
1342 bool areBootOrderDefaultSettings() const;
1343 bool areDisplayDefaultSettings() const;
1344 bool areAllNetworkAdaptersDefaultSettings(SettingsVersion_T sv) const;
1345
1346 bool operator==(const Hardware&) const;
1347
1348 com::Utf8Str strVersion; // hardware version, optional
1349 com::Guid uuid; // hardware uuid, optional (null).
1350 uint32_t cCPUs;
1351 bool fCpuHotPlug; // requires settings version 1.10 (VirtualBox 3.2)
1352 CpuList llCpus; // requires settings version 1.10 (VirtualBox 3.2)
1353 uint32_t ulCpuExecutionCap; // requires settings version 1.11 (VirtualBox 3.3)
1354 uint32_t uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
1355 com::Utf8Str strCpuProfile; // requires settings version 1.16 (VirtualBox 5.1)
1356
1357 uint32_t ulMemorySizeMB;
1358
1359 BootOrderMap mapBootOrder; // item 0 has highest priority
1360
1361 PointingHIDType_T pointingHIDType; // requires settings version 1.10 (VirtualBox 3.2)
1362 KeyboardHIDType_T keyboardHIDType; // requires settings version 1.10 (VirtualBox 3.2)
1363
1364 ParavirtProvider_T paravirtProvider; // requires settings version 1.15 (VirtualBox 4.4)
1365 com::Utf8Str strParavirtDebug; // requires settings version 1.16 (VirtualBox 5.1)
1366
1367 bool fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
1368
1369 VRDESettings vrdeSettings;
1370
1371 Platform platformSettings; // new since 1.20 (VirtualBox 7.1)
1372 FirmwareSettings firmwareSettings;
1373 NvramSettings nvramSettings;
1374 GraphicsAdapter graphicsAdapter;
1375 USB usbSettings;
1376 TpmSettings tpmSettings; // requires settings version 1.19 (VirtualBox 6.2)
1377 NetworkAdaptersList llNetworkAdapters;
1378 SerialPortsList llSerialPorts;
1379 ParallelPortsList llParallelPorts;
1380 AudioAdapter audioAdapter;
1381 Storage storage;
1382
1383 // technically these two have no business in the hardware section, but for some
1384 // clever reason <Hardware> is where they are in the XML....
1385 SharedFoldersList llSharedFolders;
1386
1387 ClipboardMode_T clipboardMode;
1388 bool fClipboardFileTransfersEnabled;
1389
1390 DnDMode_T dndMode;
1391
1392 uint32_t ulMemoryBalloonSize;
1393 bool fPageFusionEnabled;
1394
1395 GuestPropertiesList llGuestProperties;
1396
1397 IOSettings ioSettings; // requires settings version 1.10 (VirtualBox 3.2)
1398 HostPCIDeviceAttachmentList pciAttachments; // requires settings version 1.12 (VirtualBox 4.1)
1399
1400 com::Utf8Str strDefaultFrontend; // requires settings version 1.14 (VirtualBox 4.3)
1401};
1402
1403/**
1404 * Settings that has to do with debugging.
1405 */
1406struct Debugging
1407{
1408 Debugging();
1409
1410 bool areDefaultSettings() const;
1411
1412 bool operator==(const Debugging &rOther) const;
1413
1414 bool fTracingEnabled;
1415 bool fAllowTracingToAccessVM;
1416 com::Utf8Str strTracingConfig;
1417 GuestDebugProvider_T enmDbgProvider;
1418 GuestDebugIoProvider_T enmIoProvider;
1419 com::Utf8Str strAddress;
1420 uint32_t ulPort;
1421};
1422
1423/**
1424 * Settings that has to do with autostart.
1425 */
1426struct Autostart
1427{
1428 Autostart();
1429
1430 bool areDefaultSettings() const;
1431
1432 bool operator==(const Autostart &rOther) const;
1433
1434 bool fAutostartEnabled;
1435 uint32_t uAutostartDelay;
1436 AutostopType_T enmAutostopType;
1437};
1438
1439struct Snapshot;
1440typedef std::list<Snapshot> SnapshotsList;
1441
1442/**
1443 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1444 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1445 * your settings might never get saved.
1446 */
1447struct Snapshot
1448{
1449 Snapshot();
1450
1451 bool operator==(const Snapshot &s) const;
1452
1453 com::Guid uuid;
1454 com::Utf8Str strName,
1455 strDescription; // optional
1456 RTTIMESPEC timestamp;
1457
1458 com::Utf8Str strStateFile; // for online snapshots only
1459
1460 Hardware hardware;
1461
1462 Debugging debugging;
1463 Autostart autostart;
1464 Recording recordingSettings;
1465
1466 SnapshotsList llChildSnapshots;
1467
1468 static const struct Snapshot Empty;
1469};
1470
1471/**
1472 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1473 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1474 * your settings might never get saved.
1475 */
1476struct MachineUserData
1477{
1478 MachineUserData();
1479
1480 bool operator==(const MachineUserData &c) const;
1481
1482 com::Utf8Str strName;
1483 bool fDirectoryIncludesUUID;
1484 bool fNameSync;
1485 com::Utf8Str strDescription;
1486 StringsList llGroups;
1487 com::Utf8Str strOsType;
1488 com::Utf8Str strSnapshotFolder;
1489 bool fTeleporterEnabled;
1490 uint32_t uTeleporterPort;
1491 com::Utf8Str strTeleporterAddress;
1492 com::Utf8Str strTeleporterPassword;
1493 IconBlob ovIcon;
1494 VMProcPriority_T enmVMPriority;
1495 VMExecutionEngine_T enmExecEngine;
1496};
1497
1498
1499/**
1500 * MachineConfigFile represents an XML machine configuration. All the machine settings
1501 * that go out to the XML (or are read from it) are in here.
1502 *
1503 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1504 * the operator== which is used by Machine::saveSettings(), or otherwise your settings
1505 * might never get saved.
1506 */
1507class MachineConfigFile : public ConfigFileBase
1508{
1509public:
1510 com::Guid uuid;
1511
1512 enum
1513 {
1514 ParseState_NotParsed,
1515 ParseState_PasswordError,
1516 ParseState_Parsed
1517 } enmParseState;
1518
1519 MachineUserData machineUserData;
1520
1521 com::Utf8Str strStateKeyId;
1522 com::Utf8Str strStateKeyStore;
1523 com::Utf8Str strStateFile;
1524 bool fCurrentStateModified; // optional, default is true
1525 RTTIMESPEC timeLastStateChange; // optional, defaults to now
1526 bool fAborted; // optional, default is false
1527
1528 com::Guid uuidCurrentSnapshot;
1529
1530 Hardware hardwareMachine;
1531 MediaRegistry mediaRegistry;
1532 Debugging debugging;
1533 Autostart autostart;
1534 Recording recordingSettings;
1535
1536 StringsMap mapExtraDataItems;
1537
1538 SnapshotsList llFirstSnapshot; // first snapshot or empty list if there's none
1539
1540 com::Utf8Str strKeyId;
1541 com::Utf8Str strKeyStore; // if not empty, the encryption is used
1542 com::Utf8Str strLogKeyId;
1543 com::Utf8Str strLogKeyStore;
1544
1545 MachineConfigFile(const com::Utf8Str *pstrFilename,
1546 PCVBOXCRYPTOIF pCryptoIf = NULL,
1547 const char *pszPassword = NULL);
1548
1549 bool operator==(const MachineConfigFile &m) const;
1550
1551 bool canHaveOwnMediaRegistry() const;
1552
1553 void importMachineXML(const xml::ElementNode &elmMachine);
1554
1555 void write(const com::Utf8Str &strFilename, PCVBOXCRYPTOIF pCryptoIf = NULL, const char *pszPassword = NULL);
1556
1557 enum
1558 {
1559 BuildMachineXML_IncludeSnapshots = 0x01,
1560 BuildMachineXML_WriteVBoxVersionAttribute = 0x02,
1561 BuildMachineXML_SkipRemovableMedia = 0x04,
1562 BuildMachineXML_MediaRegistry = 0x08,
1563 BuildMachineXML_SuppressSavedState = 0x10
1564 };
1565
1566 void copyEncryptionSettingsFrom(const MachineConfigFile &other);
1567 void buildMachineXML(xml::ElementNode &elmMachine,
1568 uint32_t fl,
1569 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1570
1571 static bool isAudioDriverAllowedOnThisHost(AudioDriverType_T enmDrvType);
1572 static AudioDriverType_T getHostDefaultAudioDriver();
1573
1574private:
1575 void readNetworkAdapters(const xml::ElementNode &elmHardware, NetworkAdaptersList &ll);
1576 void readAttachedNetworkMode(const xml::ElementNode &pelmMode, bool fEnabled, NetworkAdapter &nic);
1577 void readCpuIdTreeX86(const xml::ElementNode &elmCpuid, CpuIdLeafsX86List &ll);
1578 void readCpuTree(const xml::ElementNode &elmCpu, CpuList &ll);
1579 void readSerialPorts(const xml::ElementNode &elmUART, SerialPortsList &ll);
1580 void readParallelPorts(const xml::ElementNode &elmLPT, ParallelPortsList &ll);
1581 void readAudioAdapter(const xml::ElementNode &elmAudioAdapter, AudioAdapter &aa);
1582 void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw);
1583 void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
1584 void readPlatformCPUIDTreeX86(const xml::ElementNode &elmChild, PlatformX86 &platX86);
1585 void readPlatformX86(const xml::ElementNode &elmPlatformX86OrHardware, PlatformX86 &platX86);
1586#ifdef VBOX_WITH_VIRT_ARMV8
1587 void readPlatformARM(const xml::ElementNode &elmPlatformARM, PlatformARM &platARM);
1588#endif
1589 void readPlatform(const xml::ElementNode &elmPlatformOrHardware, Hardware &hw, Platform &plat);
1590 void readHardware(const xml::ElementNode &elmHardware, Hardware &hw);
1591 void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg);
1592 void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg);
1593 void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg);
1594 void readTeleporter(const xml::ElementNode &elmTeleporter, MachineUserData &userData);
1595 void readDebugging(const xml::ElementNode &elmDbg, Debugging &dbg);
1596 void readAutostart(const xml::ElementNode &elmAutostart, Autostart &autostrt);
1597 void readRecordingSettings(const xml::ElementNode &elmRecording, uint32_t cMonitors, Recording &recording);
1598 void readGroups(const xml::ElementNode &elmGroups, StringsList &llGroups);
1599 bool readSnapshot(const com::Guid &curSnapshotUuid, const xml::ElementNode &elmSnapshot, Snapshot &snap);
1600 static void convertGuestOSTypeFromPre1_5(com::Utf8Str &str);
1601#ifdef GUEST_OS_ID_STYLE_PARTIAL_CLEANUP
1602 static void convertGuestOSTypeFromPre1_20(com::Utf8Str &str);
1603 static void convertGuestOSTypeToPre1_20(com::Utf8Str &str);
1604#else
1605 static void convertGuestOSTypeFromDev1_20(com::Utf8Str &a_rstrOsType);
1606#endif
1607 static void convertGuestOSTypeSuffix(com::Utf8Str &a_rstrOsType, const char *a_pszToReplace, const char *a_pszReplacement);
1608 void readMachine(const xml::ElementNode &elmMachine);
1609 void readMachineEncrypted(const xml::ElementNode &elmMachine, PCVBOXCRYPTOIF pCryptoIf, const char *pszPassword);
1610
1611 void buildPlatformX86XML(xml::ElementNode &elmParent, xml::ElementNode &elmCPU, const PlatformX86 &plat);
1612#ifdef VBOX_WITH_VIRT_ARMV8
1613 void buildPlatformARMXML(xml::ElementNode &elmParent, const PlatformARM &plat);
1614#endif
1615 void buildPlatformXML(xml::ElementNode &elmParent, const Hardware &h, const Platform &plat);
1616 void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, uint32_t fl, std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1617 void buildNetworkXML(NetworkAttachmentType_T mode, bool fEnabled, xml::ElementNode &elmParent, const NetworkAdapter &nic);
1618 void buildStorageControllersXML(xml::ElementNode &elmParent,
1619 const Storage &st,
1620 bool fSkipRemovableMedia,
1621 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1622 void buildDebuggingXML(xml::ElementNode &elmParent, const Debugging &dbg);
1623 void buildAutostartXML(xml::ElementNode &elmParent, const Autostart &autostrt);
1624 void buildRecordingXML(xml::ElementNode &elmParent, const Recording &recording);
1625 void buildGroupsXML(xml::ElementNode &elmParent, const StringsList &llGroups);
1626 void buildSnapshotXML(xml::ElementNode &elmParent, const Snapshot &snap);
1627
1628 void buildMachineEncryptedXML(xml::ElementNode &elmMachine,
1629 uint32_t fl,
1630 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
1631 PCVBOXCRYPTOIF pCryptoIf,
1632 const char *pszPassword);
1633
1634 void bumpSettingsVersionIfNeeded();
1635};
1636
1637} // namespace settings
1638
1639
1640#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