VirtualBox

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

最後變更 在這個檔案從94598是 94598,由 vboxsync 提交於 3 年 前

Main/Machine+Medium+Snapshot+VirtualBox: Recursion elimination to save stack space. Caused trouble with the current settings limits already in ASAN builds, now much higher limits would be possible, but that's not urgent. Also fix the behavior of forgetting medium objects when unregistering VMs (was previously not doing what the API documentation said in the CleanupMode_UnregisterOnly case). bugref:7717

Settings.cpp: Recursion elimination and make the handling of settings reading and writing more similar.

ValidationKit/tests/api/tdTreeDepth1.py: Improve testcase. Make sure that VM unregistering does the right thing with the associated medium objects.

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

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