VirtualBox

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

Last change on this file since 96134 was 96134, checked in by vboxsync, 3 years ago

Recording/Main: Added some static codec string<->enum utility functions. ​bugref:10275

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 51.0 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
626/**
627 * Recording settings for a single screen (e.g. virtual monitor).
628 *
629 * NOTE: If you add any fields in here, you must update a) the constructor and b)
630 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
631 * your settings might never get saved.
632 */
633struct RecordingScreenSettings
634{
635 RecordingScreenSettings(uint32_t idScreen = UINT32_MAX);
636
637 virtual ~RecordingScreenSettings();
638
639 void applyDefaults(void);
640
641 bool areDefaultSettings(void) const;
642
643 bool isFeatureEnabled(RecordingFeature_T enmFeature) const;
644
645 static const char *getDefaultOptions(void);
646
647 static int featuresFromString(const com::Utf8Str &strFeatures, RecordingFeatureMap &featureMap);
648
649 static void featuresToString(const RecordingFeatureMap &featureMap, com::Utf8Str &strFeatures);
650
651 static int audioCodecFromString(const com::Utf8Str &strCodec, RecordingAudioCodec_T &enmCodec);
652
653 static void audioCodecToString(const RecordingAudioCodec_T &enmCodec, com::Utf8Str &strCodec);
654
655 static int videoCodecFromString(const com::Utf8Str &strCodec, RecordingVideoCodec_T &enmCodec);
656
657 static void videoCodecToString(const RecordingVideoCodec_T &enmCodec, com::Utf8Str &strCodec);
658
659 bool operator==(const RecordingScreenSettings &d) const;
660
661 /** Screen ID.
662 * UINT32_MAX if not set. */
663 uint32_t idScreen;
664 /** Whether to record this screen or not. */
665 bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
666 /** Destination to record to. */
667 RecordingDestination_T enmDest;
668 /** Which features are enable or not. */
669 RecordingFeatureMap featureMap; // requires settings version 1.19 (VirtualBox 7.0)
670 /** Maximum time (in s) to record. If set to 0, no time limit is set. */
671 uint32_t ulMaxTimeS; // requires settings version 1.14 (VirtualBox 4.3)
672 /** Options string for hidden / advanced / experimental features.
673 * Use RecordingScreenSettings::getDefaultOptions(). */
674 com::Utf8Str strOptions; // new since VirtualBox 5.2.
675
676 /**
677 * Structure holding settings for audio recording.
678 */
679 struct Audio
680 {
681 /** The audio codec type to use. */
682 RecordingAudioCodec_T enmAudioCodec; // requires settings version 1.19 (VirtualBox 7.0)
683 /** Codec deadline to use. */
684 RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
685 /** Hz rate. */
686 uint16_t uHz; // requires settings version 1.19 (VirtualBox 7.0)
687 /** Bits per sample. */
688 uint8_t cBits; // requires settings version 1.19 (VirtualBox 7.0)
689 /** Number of audio channels. */
690 uint8_t cChannels; // requires settings version 1.19 (VirtualBox 7.0)
691 } Audio;
692
693 /**
694 * Structure holding settings for video recording.
695 */
696 struct Video
697 {
698 /** The codec to use. */
699 RecordingVideoCodec_T enmCodec; // requires settings version 1.19 (VirtualBox 7.0)
700 /** Codec deadline to use. */
701 RecordingCodecDeadline_T enmDeadline; // requires settings version 1.19 (VirtualBox 7.0)
702 /** Target frame width in pixels (X). */
703 uint32_t ulWidth; // requires settings version 1.14 (VirtualBox 4.3)
704 /** Target frame height in pixels (Y). */
705 uint32_t ulHeight; // requires settings version 1.14 (VirtualBox 4.3)
706 /** Encoding rate. */
707 uint32_t ulRate; // requires settings version 1.14 (VirtualBox 4.3)
708 /** Frames per second (FPS). */
709 uint32_t ulFPS; // requires settings version 1.14 (VirtualBox 4.3)
710 } Video;
711
712 /**
713 * Structure holding settings if the destination is a file.
714 */
715 struct File
716 {
717 /** Maximum size (in MB) the file is allowed to have.
718 * When reaching the limit, recording will stop. 0 means no limit. */
719 uint32_t ulMaxSizeMB; // requires settings version 1.14 (VirtualBox 4.3)
720 /** Absolute file name path to use for recording.
721 * When empty, this is considered as being the default setting. */
722 com::Utf8Str strName; // requires settings version 1.14 (VirtualBox 4.3)
723 } File;
724};
725
726/** Map for keeping settings per virtual screen.
727 * The key specifies the screen ID. */
728typedef std::map<uint32_t, RecordingScreenSettings> RecordingScreenSettingsMap;
729
730/**
731 * Common recording settings, shared among all per-screen recording settings.
732 *
733 * NOTE: If you add any fields in here, you must update a) the constructor and b)
734 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
735 * your settings might never get saved.
736 */
737struct RecordingCommonSettings
738{
739 RecordingCommonSettings();
740
741 void applyDefaults(void);
742
743 bool areDefaultSettings(void) const;
744
745 bool operator==(const RecordingCommonSettings &d) const;
746
747 /** Whether recording as a whole is enabled or disabled. */
748 bool fEnabled; // requires settings version 1.14 (VirtualBox 4.3)
749};
750
751/**
752 * NOTE: If you add any fields in here, you must update a) the constructor and b)
753 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
754 * your settings might never get saved.
755 */
756struct RecordingSettings
757{
758 RecordingSettings();
759
760 void applyDefaults(void);
761
762 bool areDefaultSettings(void) const;
763
764 bool operator==(const RecordingSettings &that) const;
765
766 /** Common settings for all per-screen recording settings. */
767 RecordingCommonSettings common;
768 /** Map of handled recording screen settings.
769 * The key specifies the screen ID. */
770 RecordingScreenSettingsMap mapScreens;
771};
772
773/**
774 * NOTE: If you add any fields in here, you must update a) the constructor and b)
775 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
776 * your settings might never get saved.
777 */
778struct GraphicsAdapter
779{
780 GraphicsAdapter();
781
782 bool areDefaultSettings() const;
783
784 bool operator==(const GraphicsAdapter &g) const;
785
786 GraphicsControllerType_T graphicsControllerType;
787 uint32_t ulVRAMSizeMB;
788 uint32_t cMonitors;
789 bool fAccelerate3D,
790 fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
791};
792
793/**
794 * NOTE: If you add any fields in here, you must update a) the constructor and b)
795 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
796 * your settings might never get saved.
797 */
798struct USBController
799{
800 USBController();
801
802 bool operator==(const USBController &u) const;
803
804 com::Utf8Str strName;
805 USBControllerType_T enmType;
806};
807
808typedef std::list<USBController> USBControllerList;
809
810struct USB
811{
812 USB();
813
814 bool operator==(const USB &u) const;
815
816 /** List of USB controllers present. */
817 USBControllerList llUSBControllers;
818 /** List of USB device filters. */
819 USBDeviceFiltersList llDeviceFilters;
820};
821
822struct NAT
823{
824 NAT();
825
826 bool areDNSDefaultSettings() const;
827 bool areAliasDefaultSettings() const;
828 bool areTFTPDefaultSettings() const;
829 bool areLocalhostReachableDefaultSettings(SettingsVersion_T sv) const;
830 bool areDefaultSettings(SettingsVersion_T sv) const;
831
832 bool operator==(const NAT &n) const;
833
834 com::Utf8Str strNetwork;
835 com::Utf8Str strBindIP;
836 uint32_t u32Mtu;
837 uint32_t u32SockRcv;
838 uint32_t u32SockSnd;
839 uint32_t u32TcpRcv;
840 uint32_t u32TcpSnd;
841 com::Utf8Str strTFTPPrefix;
842 com::Utf8Str strTFTPBootFile;
843 com::Utf8Str strTFTPNextServer;
844 bool fDNSPassDomain;
845 bool fDNSProxy;
846 bool fDNSUseHostResolver;
847 bool fAliasLog;
848 bool fAliasProxyOnly;
849 bool fAliasUseSamePorts;
850 bool fLocalhostReachable;
851 NATRulesMap mapRules;
852};
853
854/**
855 * NOTE: If you add any fields in here, you must update a) the constructor and b)
856 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
857 * your settings might never get saved.
858 */
859struct NetworkAdapter
860{
861 NetworkAdapter();
862
863 bool areGenericDriverDefaultSettings() const;
864 bool areDefaultSettings(SettingsVersion_T sv) const;
865 bool areDisabledDefaultSettings(SettingsVersion_T sv) const;
866
867 bool operator==(const NetworkAdapter &n) const;
868
869 uint32_t ulSlot;
870
871 NetworkAdapterType_T type;
872 bool fEnabled;
873 com::Utf8Str strMACAddress;
874 bool fCableConnected;
875 uint32_t ulLineSpeed;
876 NetworkAdapterPromiscModePolicy_T enmPromiscModePolicy;
877 bool fTraceEnabled;
878 com::Utf8Str strTraceFile;
879
880 NetworkAttachmentType_T mode;
881 NAT nat;
882 com::Utf8Str strBridgedName;
883 com::Utf8Str strHostOnlyName;
884#ifdef VBOX_WITH_VMNET
885 com::Utf8Str strHostOnlyNetworkName;
886#endif /* VBOX_WITH_VMNET */
887 com::Utf8Str strInternalNetworkName;
888 com::Utf8Str strGenericDriver;
889 StringsMap genericProperties;
890 com::Utf8Str strNATNetworkName;
891#ifdef VBOX_WITH_CLOUD_NET
892 com::Utf8Str strCloudNetworkName;
893#endif /* VBOX_WITH_CLOUD_NET */
894 uint32_t ulBootPriority;
895 com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2)
896};
897
898typedef std::list<NetworkAdapter> NetworkAdaptersList;
899
900/**
901 * NOTE: If you add any fields in here, you must update a) the constructor and b)
902 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
903 * your settings might never get saved.
904 */
905struct SerialPort
906{
907 SerialPort();
908
909 bool operator==(const SerialPort &n) const;
910
911 uint32_t ulSlot;
912
913 bool fEnabled;
914 uint32_t ulIOBase;
915 uint32_t ulIRQ;
916 PortMode_T portMode;
917 com::Utf8Str strPath;
918 bool fServer;
919 UartType_T uartType;
920};
921
922typedef std::list<SerialPort> SerialPortsList;
923
924/**
925 * NOTE: If you add any fields in here, you must update a) the constructor and b)
926 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
927 * your settings might never get saved.
928 */
929struct ParallelPort
930{
931 ParallelPort();
932
933 bool operator==(const ParallelPort &d) const;
934
935 uint32_t ulSlot;
936
937 bool fEnabled;
938 uint32_t ulIOBase;
939 uint32_t ulIRQ;
940 com::Utf8Str strPath;
941};
942
943typedef std::list<ParallelPort> ParallelPortsList;
944
945/**
946 * NOTE: If you add any fields in here, you must update a) the constructor and b)
947 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
948 * your settings might never get saved.
949 */
950struct AudioAdapter
951{
952 AudioAdapter();
953
954 bool areDefaultSettings(SettingsVersion_T sv) const;
955
956 bool operator==(const AudioAdapter &a) const;
957
958 bool fEnabled;
959 bool fEnabledIn;
960 bool fEnabledOut;
961 AudioControllerType_T controllerType;
962 AudioCodecType_T codecType;
963 AudioDriverType_T driverType;
964 settings::StringsMap properties;
965};
966
967/**
968 * NOTE: If you add any fields in here, you must update a) the constructor and b)
969 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
970 * your settings might never get saved.
971 */
972struct SharedFolder
973{
974 SharedFolder();
975
976 bool operator==(const SharedFolder &a) const;
977
978 com::Utf8Str strName,
979 strHostPath;
980 bool fWritable;
981 bool fAutoMount;
982 com::Utf8Str strAutoMountPoint;
983};
984
985typedef std::list<SharedFolder> SharedFoldersList;
986
987/**
988 * NOTE: If you add any fields in here, you must update a) the constructor and b)
989 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
990 * your settings might never get saved.
991 */
992struct GuestProperty
993{
994 GuestProperty();
995
996 bool operator==(const GuestProperty &g) const;
997
998 com::Utf8Str strName,
999 strValue;
1000 uint64_t timestamp;
1001 com::Utf8Str strFlags;
1002};
1003
1004typedef std::list<GuestProperty> GuestPropertiesList;
1005
1006typedef std::map<uint32_t, DeviceType_T> BootOrderMap;
1007
1008/**
1009 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1010 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1011 * your settings might never get saved.
1012 */
1013struct CpuIdLeaf
1014{
1015 CpuIdLeaf();
1016
1017 bool operator==(const CpuIdLeaf &c) const;
1018
1019 uint32_t idx;
1020 uint32_t idxSub;
1021 uint32_t uEax;
1022 uint32_t uEbx;
1023 uint32_t uEcx;
1024 uint32_t uEdx;
1025};
1026
1027typedef std::list<CpuIdLeaf> CpuIdLeafsList;
1028
1029/**
1030 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1031 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1032 * your settings might never get saved.
1033 */
1034struct Cpu
1035{
1036 Cpu();
1037
1038 bool operator==(const Cpu &c) const;
1039
1040 uint32_t ulId;
1041};
1042
1043typedef std::list<Cpu> CpuList;
1044
1045/**
1046 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1047 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1048 * your settings might never get saved.
1049 */
1050struct BandwidthGroup
1051{
1052 BandwidthGroup();
1053
1054 bool operator==(const BandwidthGroup &i) const;
1055
1056 com::Utf8Str strName;
1057 uint64_t cMaxBytesPerSec;
1058 BandwidthGroupType_T enmType;
1059};
1060
1061typedef std::list<BandwidthGroup> BandwidthGroupList;
1062
1063/**
1064 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1065 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1066 * your settings might never get saved.
1067 */
1068struct IOSettings
1069{
1070 IOSettings();
1071
1072 bool areIOCacheDefaultSettings() const;
1073 bool areDefaultSettings() const;
1074
1075 bool operator==(const IOSettings &i) const;
1076
1077 bool fIOCacheEnabled;
1078 uint32_t ulIOCacheSize;
1079 BandwidthGroupList llBandwidthGroups;
1080};
1081
1082/**
1083 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1084 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1085 * your settings might never get saved.
1086 */
1087struct HostPCIDeviceAttachment
1088{
1089 HostPCIDeviceAttachment();
1090
1091 bool operator==(const HostPCIDeviceAttachment &a) const;
1092
1093 com::Utf8Str strDeviceName;
1094 uint32_t uHostAddress;
1095 uint32_t uGuestAddress;
1096};
1097
1098typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList;
1099
1100/**
1101 * A device attached to a storage controller. This can either be a
1102 * hard disk or a DVD drive or a floppy drive and also specifies
1103 * which medium is "in" the drive; as a result, this is a combination
1104 * of the Main IMedium and IMediumAttachment interfaces.
1105 *
1106 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1107 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1108 * your settings might never get saved.
1109 */
1110struct AttachedDevice
1111{
1112 AttachedDevice();
1113
1114 bool operator==(const AttachedDevice &a) const;
1115
1116 DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed
1117
1118 // DVDs can be in pass-through mode:
1119 bool fPassThrough;
1120
1121 // Whether guest-triggered eject of DVDs will keep the medium in the
1122 // VM config or not:
1123 bool fTempEject;
1124
1125 // Whether the medium is non-rotational:
1126 bool fNonRotational;
1127
1128 // Whether the medium supports discarding unused blocks:
1129 bool fDiscard;
1130
1131 // Whether the medium is hot-pluggable:
1132 bool fHotPluggable;
1133
1134 int32_t lPort;
1135 int32_t lDevice;
1136
1137 // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
1138 // this is its UUID; it depends on deviceType which media registry this then needs to
1139 // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
1140 com::Guid uuid;
1141
1142 // for DVDs and floppies, the attachment can also be a host device:
1143 com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src
1144
1145 // Bandwidth group the device is attached to.
1146 com::Utf8Str strBwGroup;
1147};
1148
1149typedef std::list<AttachedDevice> AttachedDevicesList;
1150
1151/**
1152 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1153 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1154 * your settings might never get saved.
1155 */
1156struct StorageController
1157{
1158 StorageController();
1159
1160 bool operator==(const StorageController &s) const;
1161
1162 com::Utf8Str strName;
1163 StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS
1164 StorageControllerType_T controllerType;
1165 uint32_t ulPortCount;
1166 uint32_t ulInstance;
1167 bool fUseHostIOCache;
1168 bool fBootable;
1169
1170 // only for when controllerType == StorageControllerType_IntelAhci:
1171 int32_t lIDE0MasterEmulationPort,
1172 lIDE0SlaveEmulationPort,
1173 lIDE1MasterEmulationPort,
1174 lIDE1SlaveEmulationPort;
1175
1176 AttachedDevicesList llAttachedDevices;
1177};
1178
1179typedef std::list<StorageController> StorageControllersList;
1180
1181/**
1182 * We wrap the storage controllers list into an extra struct so we can
1183 * use an undefined struct without needing std::list<> in all the headers.
1184 *
1185 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1186 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1187 * your settings might never get saved.
1188 */
1189struct Storage
1190{
1191 bool operator==(const Storage &s) const;
1192
1193 StorageControllersList llStorageControllers;
1194};
1195
1196/**
1197 * Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
1198 * field.
1199 *
1200 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1201 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1202 * your settings might never get saved.
1203 */
1204struct Hardware
1205{
1206 Hardware();
1207
1208 bool areParavirtDefaultSettings(SettingsVersion_T sv) const;
1209 bool areBootOrderDefaultSettings() const;
1210 bool areDisplayDefaultSettings() const;
1211 bool areAllNetworkAdaptersDefaultSettings(SettingsVersion_T sv) const;
1212
1213 bool operator==(const Hardware&) const;
1214
1215 com::Utf8Str strVersion; // hardware version, optional
1216 com::Guid uuid; // hardware uuid, optional (null).
1217
1218 bool fHardwareVirt,
1219 fNestedPaging,
1220 fLargePages,
1221 fVPID,
1222 fUnrestrictedExecution,
1223 fHardwareVirtForce,
1224 fUseNativeApi,
1225 fSyntheticCpu,
1226 fTripleFaultReset,
1227 fPAE,
1228 fAPIC, // requires settings version 1.16 (VirtualBox 5.1)
1229 fX2APIC; // requires settings version 1.16 (VirtualBox 5.1)
1230 bool fIBPBOnVMExit; //< added out of cycle, after 1.16 was out.
1231 bool fIBPBOnVMEntry; //< added out of cycle, after 1.16 was out.
1232 bool fSpecCtrl; //< added out of cycle, after 1.16 was out.
1233 bool fSpecCtrlByHost; //< added out of cycle, after 1.16 was out.
1234 bool fL1DFlushOnSched ; //< added out of cycle, after 1.16 was out.
1235 bool fL1DFlushOnVMEntry ; //< added out of cycle, after 1.16 was out.
1236 bool fMDSClearOnSched; //< added out of cycle, after 1.16 was out.
1237 bool fMDSClearOnVMEntry; //< added out of cycle, after 1.16 was out.
1238 bool fNestedHWVirt; //< requires settings version 1.17 (VirtualBox 6.0)
1239 bool fVirtVmsaveVmload; //< requires settings version 1.18 (VirtualBox 6.1)
1240 typedef enum LongModeType { LongMode_Enabled, LongMode_Disabled, LongMode_Legacy } LongModeType;
1241 LongModeType enmLongMode;
1242 uint32_t cCPUs;
1243 bool fCpuHotPlug; // requires settings version 1.10 (VirtualBox 3.2)
1244 CpuList llCpus; // requires settings version 1.10 (VirtualBox 3.2)
1245 bool fHPETEnabled; // requires settings version 1.10 (VirtualBox 3.2)
1246 uint32_t ulCpuExecutionCap; // requires settings version 1.11 (VirtualBox 3.3)
1247 uint32_t uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
1248 com::Utf8Str strCpuProfile; // requires settings version 1.16 (VirtualBox 5.1)
1249
1250 CpuIdLeafsList llCpuIdLeafs;
1251
1252 uint32_t ulMemorySizeMB;
1253
1254 BootOrderMap mapBootOrder; // item 0 has highest priority
1255
1256 FirmwareType_T firmwareType; // requires settings version 1.9 (VirtualBox 3.1)
1257
1258 PointingHIDType_T pointingHIDType; // requires settings version 1.10 (VirtualBox 3.2)
1259 KeyboardHIDType_T keyboardHIDType; // requires settings version 1.10 (VirtualBox 3.2)
1260
1261 ChipsetType_T chipsetType; // requires settings version 1.11 (VirtualBox 4.0)
1262 IommuType_T iommuType; // requires settings version 1.19 (VirtualBox 6.2)
1263 ParavirtProvider_T paravirtProvider; // requires settings version 1.15 (VirtualBox 4.4)
1264 com::Utf8Str strParavirtDebug; // requires settings version 1.16 (VirtualBox 5.1)
1265
1266 bool fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
1267
1268 VRDESettings vrdeSettings;
1269
1270 BIOSSettings biosSettings;
1271 NvramSettings nvramSettings;
1272 GraphicsAdapter graphicsAdapter;
1273 USB usbSettings;
1274 TpmSettings tpmSettings; // requires settings version 1.19 (VirtualBox 6.2)
1275 NetworkAdaptersList llNetworkAdapters;
1276 SerialPortsList llSerialPorts;
1277 ParallelPortsList llParallelPorts;
1278 AudioAdapter audioAdapter;
1279 Storage storage;
1280
1281 // technically these two have no business in the hardware section, but for some
1282 // clever reason <Hardware> is where they are in the XML....
1283 SharedFoldersList llSharedFolders;
1284
1285 ClipboardMode_T clipboardMode;
1286 bool fClipboardFileTransfersEnabled;
1287
1288 DnDMode_T dndMode;
1289
1290 uint32_t ulMemoryBalloonSize;
1291 bool fPageFusionEnabled;
1292
1293 GuestPropertiesList llGuestProperties;
1294
1295 IOSettings ioSettings; // requires settings version 1.10 (VirtualBox 3.2)
1296 HostPCIDeviceAttachmentList pciAttachments; // requires settings version 1.12 (VirtualBox 4.1)
1297
1298 com::Utf8Str strDefaultFrontend; // requires settings version 1.14 (VirtualBox 4.3)
1299};
1300
1301/**
1302 * Settings that has to do with debugging.
1303 */
1304struct Debugging
1305{
1306 Debugging();
1307
1308 bool areDefaultSettings() const;
1309
1310 bool operator==(const Debugging &rOther) const;
1311
1312 bool fTracingEnabled;
1313 bool fAllowTracingToAccessVM;
1314 com::Utf8Str strTracingConfig;
1315};
1316
1317/**
1318 * Settings that has to do with autostart.
1319 */
1320struct Autostart
1321{
1322 Autostart();
1323
1324 bool areDefaultSettings() const;
1325
1326 bool operator==(const Autostart &rOther) const;
1327
1328 bool fAutostartEnabled;
1329 uint32_t uAutostartDelay;
1330 AutostopType_T enmAutostopType;
1331};
1332
1333struct Snapshot;
1334typedef std::list<Snapshot> SnapshotsList;
1335
1336/**
1337 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1338 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1339 * your settings might never get saved.
1340 */
1341struct Snapshot
1342{
1343 Snapshot();
1344
1345 bool operator==(const Snapshot &s) const;
1346
1347 com::Guid uuid;
1348 com::Utf8Str strName,
1349 strDescription; // optional
1350 RTTIMESPEC timestamp;
1351
1352 com::Utf8Str strStateFile; // for online snapshots only
1353
1354 Hardware hardware;
1355
1356 Debugging debugging;
1357 Autostart autostart;
1358 RecordingSettings recordingSettings;
1359
1360 SnapshotsList llChildSnapshots;
1361
1362 static const struct Snapshot Empty;
1363};
1364
1365/**
1366 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1367 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
1368 * your settings might never get saved.
1369 */
1370struct MachineUserData
1371{
1372 MachineUserData();
1373
1374 bool operator==(const MachineUserData &c) const;
1375
1376 com::Utf8Str strName;
1377 bool fDirectoryIncludesUUID;
1378 bool fNameSync;
1379 com::Utf8Str strDescription;
1380 StringsList llGroups;
1381 com::Utf8Str strOsType;
1382 com::Utf8Str strSnapshotFolder;
1383 bool fTeleporterEnabled;
1384 uint32_t uTeleporterPort;
1385 com::Utf8Str strTeleporterAddress;
1386 com::Utf8Str strTeleporterPassword;
1387 bool fRTCUseUTC;
1388 IconBlob ovIcon;
1389 VMProcPriority_T enmVMPriority;
1390};
1391
1392
1393/**
1394 * MachineConfigFile represents an XML machine configuration. All the machine settings
1395 * that go out to the XML (or are read from it) are in here.
1396 *
1397 * NOTE: If you add any fields in here, you must update a) the constructor and b)
1398 * the operator== which is used by Machine::saveSettings(), or otherwise your settings
1399 * might never get saved.
1400 */
1401class MachineConfigFile : public ConfigFileBase
1402{
1403public:
1404 com::Guid uuid;
1405
1406 enum
1407 {
1408 ParseState_NotParsed,
1409 ParseState_PasswordError,
1410 ParseState_Parsed
1411 } enmParseState;
1412
1413 MachineUserData machineUserData;
1414
1415 com::Utf8Str strStateKeyId;
1416 com::Utf8Str strStateKeyStore;
1417 com::Utf8Str strStateFile;
1418 bool fCurrentStateModified; // optional, default is true
1419 RTTIMESPEC timeLastStateChange; // optional, defaults to now
1420 bool fAborted; // optional, default is false
1421
1422 com::Guid uuidCurrentSnapshot;
1423
1424 Hardware hardwareMachine;
1425 MediaRegistry mediaRegistry;
1426 Debugging debugging;
1427 Autostart autostart;
1428 RecordingSettings recordingSettings;
1429
1430 StringsMap mapExtraDataItems;
1431
1432 SnapshotsList llFirstSnapshot; // first snapshot or empty list if there's none
1433
1434 com::Utf8Str strKeyId;
1435 com::Utf8Str strKeyStore; // if not empty, the encryption is used
1436 com::Utf8Str strLogKeyId;
1437 com::Utf8Str strLogKeyStore;
1438
1439 MachineConfigFile(const com::Utf8Str *pstrFilename,
1440 PCVBOXCRYPTOIF pCryptoIf = NULL,
1441 const char *pszPassword = NULL);
1442
1443 bool operator==(const MachineConfigFile &m) const;
1444
1445 bool canHaveOwnMediaRegistry() const;
1446
1447 void importMachineXML(const xml::ElementNode &elmMachine);
1448
1449 void write(const com::Utf8Str &strFilename, PCVBOXCRYPTOIF pCryptoIf = NULL, const char *pszPassword = NULL);
1450
1451 enum
1452 {
1453 BuildMachineXML_IncludeSnapshots = 0x01,
1454 BuildMachineXML_WriteVBoxVersionAttribute = 0x02,
1455 BuildMachineXML_SkipRemovableMedia = 0x04,
1456 BuildMachineXML_MediaRegistry = 0x08,
1457 BuildMachineXML_SuppressSavedState = 0x10
1458 };
1459
1460 void copyEncryptionSettingsFrom(const MachineConfigFile &other);
1461 void buildMachineXML(xml::ElementNode &elmMachine,
1462 uint32_t fl,
1463 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1464
1465 static bool isAudioDriverAllowedOnThisHost(AudioDriverType_T enmDrvType);
1466 static AudioDriverType_T getHostDefaultAudioDriver();
1467
1468private:
1469 void readNetworkAdapters(const xml::ElementNode &elmHardware, NetworkAdaptersList &ll);
1470 void readAttachedNetworkMode(const xml::ElementNode &pelmMode, bool fEnabled, NetworkAdapter &nic);
1471 void readCpuIdTree(const xml::ElementNode &elmCpuid, CpuIdLeafsList &ll);
1472 void readCpuTree(const xml::ElementNode &elmCpu, CpuList &ll);
1473 void readSerialPorts(const xml::ElementNode &elmUART, SerialPortsList &ll);
1474 void readParallelPorts(const xml::ElementNode &elmLPT, ParallelPortsList &ll);
1475 void readAudioAdapter(const xml::ElementNode &elmAudioAdapter, AudioAdapter &aa);
1476 void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw);
1477 void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
1478 void readHardware(const xml::ElementNode &elmHardware, Hardware &hw);
1479 void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg);
1480 void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg);
1481 void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg);
1482 void readTeleporter(const xml::ElementNode &elmTeleporter, MachineUserData &userData);
1483 void readDebugging(const xml::ElementNode &elmDbg, Debugging &dbg);
1484 void readAutostart(const xml::ElementNode &elmAutostart, Autostart &autostrt);
1485 void readRecordingSettings(const xml::ElementNode &elmRecording, uint32_t cMonitors, RecordingSettings &recording);
1486 void readGroups(const xml::ElementNode &elmGroups, StringsList &llGroups);
1487 bool readSnapshot(const com::Guid &curSnapshotUuid, const xml::ElementNode &elmSnapshot, Snapshot &snap);
1488 void convertOldOSType_pre1_5(com::Utf8Str &str);
1489 void readMachine(const xml::ElementNode &elmMachine);
1490 void readMachineEncrypted(const xml::ElementNode &elmMachine, PCVBOXCRYPTOIF pCryptoIf, const char *pszPassword);
1491
1492 void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, uint32_t fl, std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1493 void buildNetworkXML(NetworkAttachmentType_T mode, bool fEnabled, xml::ElementNode &elmParent, const NetworkAdapter &nic);
1494 void buildStorageControllersXML(xml::ElementNode &elmParent,
1495 const Storage &st,
1496 bool fSkipRemovableMedia,
1497 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes);
1498 void buildDebuggingXML(xml::ElementNode &elmParent, const Debugging &dbg);
1499 void buildAutostartXML(xml::ElementNode &elmParent, const Autostart &autostrt);
1500 void buildRecordingXML(xml::ElementNode &elmParent, const RecordingSettings &recording);
1501 void buildGroupsXML(xml::ElementNode &elmParent, const StringsList &llGroups);
1502 void buildSnapshotXML(xml::ElementNode &elmParent, const Snapshot &snap);
1503
1504 void buildMachineEncryptedXML(xml::ElementNode &elmMachine,
1505 uint32_t fl,
1506 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
1507 PCVBOXCRYPTOIF pCryptoIf,
1508 const char *pszPassword);
1509
1510 void bumpSettingsVersionIfNeeded();
1511};
1512
1513} // namespace settings
1514
1515
1516#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