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