VirtualBox

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

Last change on this file since 95486 was 95364, checked in by vboxsync, 2 years ago

Main/FE: Added new audio driver type "default" to make it possible to move VMs (appliances) between different platforms without the need of changing the audio driver explicitly. When the "default" driver is selected, the best audio backend option for a platform will be used.

While at it, also added the "WAS" (Windows Audio Session) driver type for which we only had a hack so far. This now can be explicitly selected, also by the frontends. bugref:10051

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