- Timestamp:
- May 17, 2016 5:18:29 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
-
include/VBox/settings.h (modified) (51 diffs)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (3 diffs)
-
src/VBox/Main/include/BusAssignmentManager.h (modified) (5 diffs)
-
src/VBox/Main/include/DHCPServerImpl.h (modified) (5 diffs)
-
src/VBox/Main/include/MachineImpl.h (modified) (6 diffs)
-
src/VBox/Main/include/NATEngineImpl.h (modified) (1 diff)
-
src/VBox/Main/include/NATNetworkImpl.h (modified) (1 diff)
-
src/VBox/Main/include/PCIDeviceAttachmentImpl.h (modified) (3 diffs)
-
src/VBox/Main/include/USBProxyService.h (modified) (2 diffs)
-
src/VBox/Main/include/VRDEServerImpl.h (modified) (4 diffs)
-
src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp (modified) (5 diffs)
-
src/VBox/Main/src-client/BusAssignmentManager.cpp (modified) (6 diffs)
-
src/VBox/Main/src-client/ConsoleImpl.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/ApplianceImplImport.cpp (modified) (5 diffs)
-
src/VBox/Main/src-server/DHCPServerImpl.cpp (modified) (16 diffs)
-
src/VBox/Main/src-server/MachineImpl.cpp (modified) (14 diffs)
-
src/VBox/Main/src-server/MachineImplCloneVM.cpp (modified) (4 diffs)
-
src/VBox/Main/src-server/MediumImpl.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/NetworkAdapterImpl.cpp (modified) (6 diffs)
-
src/VBox/Main/src-server/SnapshotImpl.cpp (modified) (4 diffs)
-
src/VBox/Main/src-server/VRDEServerImpl.cpp (modified) (24 diffs)
-
src/VBox/Main/src-server/VirtualBoxImpl.cpp (modified) (1 diff)
-
src/VBox/Main/xml/Settings.cpp (modified) (79 diffs)
-
src/VBox/Main/xml/VirtualBox-settings.xsd (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r60786 r61009 50 50 #include <list> 51 51 #include <map> 52 #include <vector> 52 53 53 54 /** … … 85 86 //////////////////////////////////////////////////////////////////////////////// 86 87 88 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap; 89 typedef std::list<com::Utf8Str> StringsList; 90 87 91 /** 88 92 * USB device filter definition. This struct is used both in MainConfigFile … … 95 99 struct USBDeviceFilter 96 100 { 97 USBDeviceFilter() 98 : fActive(false), 99 action(USBDeviceFilterAction_Null), 100 ulMaskedInterfaces(0) 101 {} 101 USBDeviceFilter(); 102 102 103 103 bool operator==(const USBDeviceFilter&u) const; … … 117 117 }; 118 118 119 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;120 typedef std::list<com::Utf8Str> StringsList;121 122 // ExtraDataItem (used by both VirtualBox.xml and machines XML)123 struct USBDeviceFilter;124 119 typedef std::list<USBDeviceFilter> USBDeviceFiltersList; 125 120 … … 134 129 struct Medium 135 130 { 136 Medium() 137 : fAutoReset(false), 138 hdType(MediumType_Normal) 139 {} 131 Medium(); 132 133 bool operator==(const Medium &m) const; 140 134 141 135 com::Guid uuid; … … 151 145 MediaList llChildren; // only used with hard disks 152 146 153 bool operator==(const Medium &m) const; 154 }; 155 156 extern const struct Medium g_MediumEmpty; 147 static const struct Medium Empty; 148 }; 157 149 158 150 /** … … 167 159 struct MediaRegistry 168 160 { 161 bool operator==(const MediaRegistry &m) const; 162 169 163 MediaList llHardDisks, 170 164 llDvdImages, 171 165 llFloppyImages; 172 173 bool operator==(const MediaRegistry &m) const; 174 }; 175 176 /** 177 * 166 }; 167 168 /** 169 * NOTE: If you add any fields in here, you must update a) the constructor and b) 170 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 171 * your settings might never get saved. 178 172 */ 179 173 struct NATRule 180 174 { 181 NATRule() 182 : proto(NATProtocol_TCP), 183 u16HostPort(0), 184 u16GuestPort(0) 185 {} 186 187 bool operator==(const NATRule &r) const 188 { 189 return strName == r.strName 190 && proto == r.proto 191 && u16HostPort == r.u16HostPort 192 && strHostIP == r.strHostIP 193 && u16GuestPort == r.u16GuestPort 194 && strGuestIP == r.strGuestIP; 195 } 175 NATRule(); 176 177 bool operator==(const NATRule &r) const; 196 178 197 179 com::Utf8Str strName; … … 204 186 typedef std::map<com::Utf8Str, NATRule> NATRulesMap; 205 187 206 207 188 struct NATHostLoopbackOffset 208 189 { 209 /** Note: 128/8 is only acceptable */ 210 com::Utf8Str strLoopbackHostAddress; 211 uint32_t u32Offset; 190 NATHostLoopbackOffset(); 191 192 bool operator==(const NATHostLoopbackOffset &o) const; 193 212 194 bool operator==(const com::Utf8Str& strAddr) 213 195 { … … 220 202 } 221 203 222 bool operator==(const NATHostLoopbackOffset &o) const 223 { 224 return strLoopbackHostAddress == o.strLoopbackHostAddress 225 && u32Offset == o.u32Offset; 226 } 227 }; 204 /** Note: 128/8 is only acceptable */ 205 com::Utf8Str strLoopbackHostAddress; 206 uint32_t u32Offset; 207 }; 208 228 209 typedef std::list<NATHostLoopbackOffset> NATLoopbackOffsetList; 210 211 typedef std::vector<uint8_t> IconBlob; 229 212 230 213 /** … … 254 237 void parseTimestamp(RTTIMESPEC ×tamp, 255 238 const com::Utf8Str &str) const; 239 void parseBase64(IconBlob &binary, 240 const com::Utf8Str &str) const; 256 241 com::Utf8Str stringifyTimestamp(const RTTIMESPEC &tm) const; 242 void toBase64(com::Utf8Str &str, 243 const IconBlob &binary) const; 257 244 258 245 void readExtraData(const xml::ElementNode &elmExtraData, … … 313 300 struct SystemProperties 314 301 { 315 SystemProperties() 316 : ulLogHistoryCount(3) 317 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) 318 , fExclusiveHwVirt(false) 319 #else 320 , fExclusiveHwVirt(true) 321 #endif 322 {} 302 SystemProperties(); 323 303 324 304 com::Utf8Str strDefaultMachineFolder; … … 341 321 com::Utf8Str strSettingsFile; 342 322 }; 323 343 324 typedef std::list<MachineRegistryEntry> MachinesRegistry; 344 325 345 326 struct DhcpOptValue 346 327 { 347 enum Encoding { 348 LEGACY = DhcpOptEncoding_Legacy, 349 HEX = DhcpOptEncoding_Hex 350 }; 328 DhcpOptValue(); 329 DhcpOptValue(const com::Utf8Str &aText, DhcpOptEncoding_T aEncoding = DhcpOptEncoding_Legacy); 351 330 352 331 com::Utf8Str text; 353 Encoding encoding; 354 355 DhcpOptValue() 356 : text(), encoding(LEGACY) {} 357 358 DhcpOptValue(const com::Utf8Str &aText, Encoding aEncoding = LEGACY) 359 : text(aText), encoding(aEncoding) {} 332 DhcpOptEncoding_T encoding; 360 333 }; 361 334 … … 367 340 typedef struct VmNameSlotKey 368 341 { 369 VmNameSlotKey(const com::Utf8Str& aVmName, LONG aSlot): VmName(aVmName), 370 Slot(aSlot){} 342 VmNameSlotKey(const com::Utf8Str& aVmName, LONG aSlot); 343 344 bool operator<(const VmNameSlotKey& that) const; 345 371 346 const com::Utf8Str VmName; 372 347 LONG Slot; 373 bool operator< (const VmNameSlotKey& that) const374 {375 if (VmName == that.VmName)376 return Slot < that.Slot;377 else return VmName < that.VmName;378 }379 348 } VmNameSlotKey; 349 380 350 typedef std::map<VmNameSlotKey, DhcpOptionMap> VmSlot2OptionsMap; 381 351 typedef VmSlot2OptionsMap::value_type VmSlot2OptionsPair; … … 385 355 struct DHCPServer 386 356 { 387 DHCPServer() 388 : fEnabled(false) 389 {} 357 DHCPServer(); 390 358 391 359 com::Utf8Str strNetworkName, … … 397 365 VmSlot2OptionsMap VmSlot2OptionsM; 398 366 }; 367 399 368 typedef std::list<DHCPServer> DHCPServersList; 400 369 401 370 402 371 /** 403 * N atNetworking settings (NAT service).372 * NAT Networking settings (NAT service). 404 373 */ 405 374 struct NATNetwork 406 375 { 376 NATNetwork(); 377 407 378 com::Utf8Str strNetworkName; 408 379 com::Utf8Str strIPv4NetworkCidr; … … 416 387 NATRulesMap mapPortForwardRules4; 417 388 NATRulesMap mapPortForwardRules6; 418 NATNetwork() : 419 fEnabled(true), 420 fIPv6Enabled(false), 421 fAdvertiseDefaultIPv6Route(false), 422 fNeedDhcpServer(true), 423 u32HostLoopback6Offset(0) 424 {} 425 bool operator==(const NATNetwork &n) const 426 { 427 return strNetworkName == n.strNetworkName 428 && strIPv4NetworkCidr == n.strIPv4NetworkCidr 429 && strIPv6Prefix == n.strIPv6Prefix 430 && fEnabled == n.fEnabled 431 && fIPv6Enabled == n.fIPv6Enabled 432 && fAdvertiseDefaultIPv6Route == n.fAdvertiseDefaultIPv6Route 433 && fNeedDhcpServer == n.fNeedDhcpServer 434 && u32HostLoopback6Offset == n.u32HostLoopback6Offset 435 && llHostLoopbackOffsetList == n.llHostLoopbackOffsetList 436 && mapPortForwardRules4 == n.mapPortForwardRules4 437 && mapPortForwardRules6 == n.mapPortForwardRules6; 438 } 439 440 }; 389 }; 390 441 391 typedef std::list<NATNetwork> NATNetworksList; 442 392 … … 481 431 struct VRDESettings 482 432 { 483 VRDESettings() 484 : fEnabled(true), 485 authType(AuthType_Null), 486 ulAuthTimeout(5000), 487 fAllowMultiConnection(false), 488 fReuseSingleConnection(false) 489 {} 433 VRDESettings(); 434 435 bool areDefaultSettings() const; 490 436 491 437 bool operator==(const VRDESettings& v) const; … … 508 454 struct BIOSSettings 509 455 { 510 BIOSSettings() 511 : fACPIEnabled(true), 512 fIOAPICEnabled(false), 513 fLogoFadeIn(true), 514 fLogoFadeOut(true), 515 ulLogoDisplayTime(0), 516 biosBootMenuMode(BIOSBootMenuMode_MessageAndMenu), 517 fPXEDebugEnabled(false), 518 llTimeOffset(0) 519 {} 456 BIOSSettings(); 457 458 bool areDefaultSettings() const; 520 459 521 460 bool operator==(const BIOSSettings &d) const; … … 539 478 struct USBController 540 479 { 541 USBController() 542 : enmType(USBControllerType_Null) 543 {} 480 USBController(); 544 481 545 482 bool operator==(const USBController &u) const; … … 548 485 USBControllerType_T enmType; 549 486 }; 487 550 488 typedef std::list<USBController> USBControllerList; 551 489 552 490 struct USB 553 491 { 554 USB() {}492 USB(); 555 493 556 494 bool operator==(const USB &u) const; … … 564 502 struct NAT 565 503 { 566 NAT() 567 : u32Mtu(0), 568 u32SockRcv(0), 569 u32SockSnd(0), 570 u32TcpRcv(0), 571 u32TcpSnd(0), 572 fDNSPassDomain(true), /* historically this value is true */ 573 fDNSProxy(false), 574 fDNSUseHostResolver(false), 575 fAliasLog(false), 576 fAliasProxyOnly(false), 577 fAliasUseSamePorts(false) 578 {} 579 580 bool operator==(const NAT &n) const 581 { 582 return strNetwork == n.strNetwork 583 && strBindIP == n.strBindIP 584 && u32Mtu == n.u32Mtu 585 && u32SockRcv == n.u32SockRcv 586 && u32SockSnd == n.u32SockSnd 587 && u32TcpSnd == n.u32TcpSnd 588 && u32TcpRcv == n.u32TcpRcv 589 && strTFTPPrefix == n.strTFTPPrefix 590 && strTFTPBootFile == n.strTFTPBootFile 591 && strTFTPNextServer == n.strTFTPNextServer 592 && fDNSPassDomain == n.fDNSPassDomain 593 && fDNSProxy == n.fDNSProxy 594 && fDNSUseHostResolver == n.fDNSUseHostResolver 595 && fAliasLog == n.fAliasLog 596 && fAliasProxyOnly == n.fAliasProxyOnly 597 && fAliasUseSamePorts == n.fAliasUseSamePorts 598 && mapRules == n.mapRules; 599 } 504 NAT(); 505 506 bool areDNSDefaultSettings() const; 507 bool areAliasDefaultSettings() const; 508 bool areTFTPDefaultSettings() const; 509 bool areDefaultSettings() const; 510 511 bool operator==(const NAT &n) const; 600 512 601 513 com::Utf8Str strNetwork; … … 625 537 struct NetworkAdapter 626 538 { 627 NetworkAdapter() 628 : ulSlot(0), 629 type(NetworkAdapterType_Am79C970A), 630 fEnabled(false), 631 fCableConnected(false), 632 ulLineSpeed(0), 633 enmPromiscModePolicy(NetworkAdapterPromiscModePolicy_Deny), 634 fTraceEnabled(false), 635 mode(NetworkAttachmentType_Null), 636 ulBootPriority(0) 637 {} 539 NetworkAdapter(); 540 541 bool areGenericDriverDefaultSettings() const; 542 bool areDefaultSettings() const; 543 bool areDisabledDefaultSettings() const; 638 544 639 545 bool operator==(const NetworkAdapter &n) const; … … 661 567 com::Utf8Str strBandwidthGroup; // requires settings version 1.13 (VirtualBox 4.2) 662 568 }; 569 663 570 typedef std::list<NetworkAdapter> NetworkAdaptersList; 664 571 … … 670 577 struct SerialPort 671 578 { 672 SerialPort() 673 : ulSlot(0), 674 fEnabled(false), 675 ulIOBase(0x3f8), 676 ulIRQ(4), 677 portMode(PortMode_Disconnected), 678 fServer(false) 679 {} 579 SerialPort(); 680 580 681 581 bool operator==(const SerialPort &n) const; … … 690 590 bool fServer; 691 591 }; 592 692 593 typedef std::list<SerialPort> SerialPortsList; 693 594 … … 699 600 struct ParallelPort 700 601 { 701 ParallelPort() 702 : ulSlot(0), 703 fEnabled(false), 704 ulIOBase(0x378), 705 ulIRQ(7) 706 {} 602 ParallelPort(); 707 603 708 604 bool operator==(const ParallelPort &d) const; … … 715 611 com::Utf8Str strPath; 716 612 }; 613 717 614 typedef std::list<ParallelPort> ParallelPortsList; 718 615 … … 724 621 struct AudioAdapter 725 622 { 726 AudioAdapter() 727 : fEnabled(true), 728 controllerType(AudioControllerType_AC97), 729 codecType(AudioCodecType_STAC9700), 730 driverType(AudioDriverType_Null) 731 {} 732 733 bool operator==(const AudioAdapter &a) const 734 { 735 return (this == &a) 736 || ( (fEnabled == a.fEnabled) 737 && (controllerType == a.controllerType) 738 && (codecType == a.codecType) 739 && (driverType == a.driverType) 740 && (properties == a.properties) 741 ); 742 } 623 AudioAdapter(); 624 625 bool areDefaultSettings() const; 626 627 bool operator==(const AudioAdapter &a) const; 743 628 744 629 bool fEnabled; … … 756 641 struct SharedFolder 757 642 { 758 SharedFolder() 759 : fWritable(false) 760 , fAutoMount(false) 761 {} 643 SharedFolder(); 762 644 763 645 bool operator==(const SharedFolder &a) const; … … 768 650 bool fAutoMount; 769 651 }; 652 770 653 typedef std::list<SharedFolder> SharedFoldersList; 771 654 … … 777 660 struct GuestProperty 778 661 { 779 GuestProperty() 780 : timestamp(0) 781 {}; 662 GuestProperty(); 782 663 783 664 bool operator==(const GuestProperty &g) const; … … 788 669 com::Utf8Str strFlags; 789 670 }; 671 790 672 typedef std::list<GuestProperty> GuestPropertiesList; 791 673 … … 799 681 struct CpuIdLeaf 800 682 { 801 CpuIdLeaf() 802 : ulId(UINT32_MAX), 803 ulEax(0), 804 ulEbx(0), 805 ulEcx(0), 806 ulEdx(0) 807 {} 808 809 bool operator==(const CpuIdLeaf &c) const 810 { 811 return ( (this == &c) 812 || ( (ulId == c.ulId) 813 && (ulEax == c.ulEax) 814 && (ulEbx == c.ulEbx) 815 && (ulEcx == c.ulEcx) 816 && (ulEdx == c.ulEdx) 817 ) 818 ); 819 } 683 CpuIdLeaf(); 684 685 bool operator==(const CpuIdLeaf &c) const; 820 686 821 687 uint32_t ulId; … … 825 691 uint32_t ulEdx; 826 692 }; 693 827 694 typedef std::list<CpuIdLeaf> CpuIdLeafsList; 828 695 … … 834 701 struct Cpu 835 702 { 836 Cpu() 837 : ulId(UINT32_MAX) 838 {} 839 840 bool operator==(const Cpu &c) const 841 { 842 return (ulId == c.ulId); 843 } 703 Cpu(); 704 705 bool operator==(const Cpu &c) const; 844 706 845 707 uint32_t ulId; 846 708 }; 709 847 710 typedef std::list<Cpu> CpuList; 848 711 … … 854 717 struct BandwidthGroup 855 718 { 856 BandwidthGroup() 857 : cMaxBytesPerSec(0), 858 enmType(BandwidthGroupType_Null) 859 {} 860 861 bool operator==(const BandwidthGroup &i) const 862 { 863 return ( (strName == i.strName) 864 && (cMaxBytesPerSec == i.cMaxBytesPerSec) 865 && (enmType == i.enmType)); 866 } 719 BandwidthGroup(); 720 721 bool operator==(const BandwidthGroup &i) const; 867 722 868 723 com::Utf8Str strName; … … 870 725 BandwidthGroupType_T enmType; 871 726 }; 727 872 728 typedef std::list<BandwidthGroup> BandwidthGroupList; 873 729 … … 881 737 IOSettings(); 882 738 883 bool operator==(const IOSettings &i) const 884 { 885 return ( (fIOCacheEnabled == i.fIOCacheEnabled) 886 && (ulIOCacheSize == i.ulIOCacheSize) 887 && (llBandwidthGroups == i.llBandwidthGroups)); 888 } 739 bool areIOCacheDefaultSettings() const; 740 bool areDefaultSettings() const; 741 742 bool operator==(const IOSettings &i) const; 889 743 890 744 bool fIOCacheEnabled; … … 900 754 struct HostPCIDeviceAttachment 901 755 { 902 HostPCIDeviceAttachment() 903 : uHostAddress(0), 904 uGuestAddress(0) 905 {} 906 907 bool operator==(const HostPCIDeviceAttachment &a) const 908 { 909 return ( (uHostAddress == a.uHostAddress) 910 && (uGuestAddress == a.uGuestAddress) 911 && (strDeviceName == a.strDeviceName) 912 ); 913 } 756 HostPCIDeviceAttachment(); 757 758 bool operator==(const HostPCIDeviceAttachment &a) const; 914 759 915 760 com::Utf8Str strDeviceName; … … 917 762 uint32_t uGuestAddress; 918 763 }; 764 919 765 typedef std::list<HostPCIDeviceAttachment> HostPCIDeviceAttachmentList; 766 767 /** 768 * A device attached to a storage controller. This can either be a 769 * hard disk or a DVD drive or a floppy drive and also specifies 770 * which medium is "in" the drive; as a result, this is a combination 771 * of the Main IMedium and IMediumAttachment interfaces. 772 * 773 * NOTE: If you add any fields in here, you must update a) the constructor and b) 774 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 775 * your settings might never get saved. 776 */ 777 struct AttachedDevice 778 { 779 AttachedDevice(); 780 781 bool operator==(const AttachedDevice &a) const; 782 783 DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed 784 785 // DVDs can be in pass-through mode: 786 bool fPassThrough; 787 788 // Whether guest-triggered eject of DVDs will keep the medium in the 789 // VM config or not: 790 bool fTempEject; 791 792 // Whether the medium is non-rotational: 793 bool fNonRotational; 794 795 // Whether the medium supports discarding unused blocks: 796 bool fDiscard; 797 798 // Whether the medium is hot-pluggable: 799 bool fHotPluggable; 800 801 int32_t lPort; 802 int32_t lDevice; 803 804 // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI), 805 // this is its UUID; it depends on deviceType which media registry this then needs to 806 // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL 807 com::Guid uuid; 808 809 // for DVDs and floppies, the attachment can also be a host device: 810 com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src 811 812 // Bandwidth group the device is attached to. 813 com::Utf8Str strBwGroup; 814 }; 815 816 typedef std::list<AttachedDevice> AttachedDevicesList; 817 818 /** 819 * NOTE: If you add any fields in here, you must update a) the constructor and b) 820 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 821 * your settings might never get saved. 822 */ 823 struct StorageController 824 { 825 StorageController(); 826 827 bool operator==(const StorageController &s) const; 828 829 com::Utf8Str strName; 830 StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS 831 StorageControllerType_T controllerType; 832 uint32_t ulPortCount; 833 uint32_t ulInstance; 834 bool fUseHostIOCache; 835 bool fBootable; 836 837 // only for when controllerType == StorageControllerType_IntelAhci: 838 int32_t lIDE0MasterEmulationPort, 839 lIDE0SlaveEmulationPort, 840 lIDE1MasterEmulationPort, 841 lIDE1SlaveEmulationPort; 842 843 AttachedDevicesList llAttachedDevices; 844 }; 845 846 typedef std::list<StorageController> StorageControllersList; 847 848 /** 849 * We wrap the storage controllers list into an extra struct so we can 850 * use an undefined struct without needing std::list<> in all the headers. 851 * 852 * NOTE: If you add any fields in here, you must update a) the constructor and b) 853 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 854 * your settings might never get saved. 855 */ 856 struct Storage 857 { 858 bool operator==(const Storage &s) const; 859 860 StorageControllersList llStorageControllers; 861 }; 920 862 921 863 /** … … 931 873 Hardware(); 932 874 875 bool areParavirtDefaultSettings() const; 876 bool areBootOrderDefaultSettings() const; 877 bool areDisplayDefaultSettings() const; 878 bool areVideoCaptureDefaultSettings() const; 879 bool areAllNetworkAdaptersDefaultSettings() const; 880 933 881 bool operator==(const Hardware&) const; 934 935 bool areParavirtDefaultSettings() const936 {937 return paravirtProvider == ParavirtProvider_Legacy;938 }939 882 940 883 com::Utf8Str strVersion; // hardware version, optional … … 1001 944 ParallelPortsList llParallelPorts; 1002 945 AudioAdapter audioAdapter; 946 Storage storage; 1003 947 1004 948 // technically these two have no business in the hardware section, but for some … … 1020 964 1021 965 /** 1022 * A device attached to a storage controller. This can either be a1023 * hard disk or a DVD drive or a floppy drive and also specifies1024 * which medium is "in" the drive; as a result, this is a combination1025 * of the Main IMedium and IMediumAttachment interfaces.1026 *1027 * NOTE: If you add any fields in here, you must update a) the constructor and b)1028 * the operator== which is used by MachineConfigFile::operator==(), or otherwise1029 * your settings might never get saved.1030 */1031 struct AttachedDevice1032 {1033 AttachedDevice()1034 : deviceType(DeviceType_Null),1035 fPassThrough(false),1036 fTempEject(false),1037 fNonRotational(false),1038 fDiscard(false),1039 fHotPluggable(false),1040 lPort(0),1041 lDevice(0)1042 {}1043 1044 bool operator==(const AttachedDevice &a) const;1045 1046 DeviceType_T deviceType; // only HardDisk, DVD or Floppy are allowed1047 1048 // DVDs can be in pass-through mode:1049 bool fPassThrough;1050 1051 // Whether guest-triggered eject of DVDs will keep the medium in the1052 // VM config or not:1053 bool fTempEject;1054 1055 // Whether the medium is non-rotational:1056 bool fNonRotational;1057 1058 // Whether the medium supports discarding unused blocks:1059 bool fDiscard;1060 1061 // Whether the medium is hot-pluggable:1062 bool fHotPluggable;1063 1064 int32_t lPort;1065 int32_t lDevice;1066 1067 // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),1068 // this is its UUID; it depends on deviceType which media registry this then needs to1069 // be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL1070 com::Guid uuid;1071 1072 // for DVDs and floppies, the attachment can also be a host device:1073 com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src1074 1075 // Bandwidth group the device is attached to.1076 com::Utf8Str strBwGroup;1077 };1078 typedef std::list<AttachedDevice> AttachedDevicesList;1079 1080 /**1081 * NOTE: If you add any fields in here, you must update a) the constructor and b)1082 * the operator== which is used by MachineConfigFile::operator==(), or otherwise1083 * your settings might never get saved.1084 */1085 struct StorageController1086 {1087 StorageController()1088 : storageBus(StorageBus_IDE),1089 controllerType(StorageControllerType_PIIX3),1090 ulPortCount(2),1091 ulInstance(0),1092 fUseHostIOCache(true),1093 fBootable(true)1094 {}1095 1096 bool operator==(const StorageController &s) const;1097 1098 com::Utf8Str strName;1099 StorageBus_T storageBus; // _SATA, _SCSI, _IDE, _SAS1100 StorageControllerType_T controllerType;1101 uint32_t ulPortCount;1102 uint32_t ulInstance;1103 bool fUseHostIOCache;1104 bool fBootable;1105 1106 // only for when controllerType == StorageControllerType_IntelAhci:1107 int32_t lIDE0MasterEmulationPort,1108 lIDE0SlaveEmulationPort,1109 lIDE1MasterEmulationPort,1110 lIDE1SlaveEmulationPort;1111 1112 AttachedDevicesList llAttachedDevices;1113 };1114 typedef std::list<StorageController> StorageControllersList;1115 1116 /**1117 * We wrap the storage controllers list into an extra struct so we can1118 * use an undefined struct without needing std::list<> in all the headers.1119 *1120 * NOTE: If you add any fields in here, you must update a) the constructor and b)1121 * the operator== which is used by MachineConfigFile::operator==(), or otherwise1122 * your settings might never get saved.1123 */1124 struct Storage1125 {1126 bool operator==(const Storage &s) const;1127 1128 StorageControllersList llStorageControllers;1129 };1130 1131 /**1132 966 * Settings that has to do with debugging. 1133 967 */ 1134 968 struct Debugging 1135 969 { 1136 Debugging() 1137 : fTracingEnabled(false), 1138 fAllowTracingToAccessVM(false), 1139 strTracingConfig() 1140 { } 1141 1142 bool operator==(const Debugging &rOther) const 1143 { 1144 return fTracingEnabled == rOther.fTracingEnabled 1145 && fAllowTracingToAccessVM == rOther.fAllowTracingToAccessVM 1146 && strTracingConfig == rOther.strTracingConfig; 1147 } 1148 1149 bool areDefaultSettings() const 1150 { 1151 return !fTracingEnabled 1152 && !fAllowTracingToAccessVM 1153 && strTracingConfig.isEmpty(); 1154 } 970 Debugging(); 971 972 bool areDefaultSettings() const; 973 974 bool operator==(const Debugging &rOther) const; 1155 975 1156 976 bool fTracingEnabled; … … 1164 984 struct Autostart 1165 985 { 1166 Autostart() 1167 : fAutostartEnabled(false), 1168 uAutostartDelay(0), 1169 enmAutostopType(AutostopType_Disabled) 1170 { } 1171 1172 bool operator==(const Autostart &rOther) const 1173 { 1174 return fAutostartEnabled == rOther.fAutostartEnabled 1175 && uAutostartDelay == rOther.uAutostartDelay 1176 && enmAutostopType == rOther.enmAutostopType; 1177 } 1178 1179 bool areDefaultSettings() const 1180 { 1181 return !fAutostartEnabled 1182 && !uAutostartDelay 1183 && enmAutostopType == AutostopType_Disabled; 1184 } 986 Autostart(); 987 988 bool areDefaultSettings() const; 989 990 bool operator==(const Autostart &rOther) const; 1185 991 1186 992 bool fAutostartEnabled; … … 1199 1005 struct Snapshot 1200 1006 { 1201 Snapshot() 1202 { 1203 RTTimeSpecSetNano(×tamp, 0); 1204 } 1007 Snapshot(); 1205 1008 1206 1009 bool operator==(const Snapshot &s) const; … … 1214 1017 1215 1018 Hardware hardware; 1216 Storage storage;1217 1019 1218 1020 Debugging debugging; … … 1220 1022 1221 1023 SnapshotsList llChildSnapshots; 1222 }; 1223 1024 1025 static const struct Snapshot Empty; 1026 }; 1027 1028 /** 1029 * NOTE: If you add any fields in here, you must update a) the constructor and b) 1030 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 1031 * your settings might never get saved. 1032 */ 1224 1033 struct MachineUserData 1225 1034 { 1226 MachineUserData() 1227 : fDirectoryIncludesUUID(false), 1228 fNameSync(true), 1229 fTeleporterEnabled(false), 1230 uTeleporterPort(0), 1231 enmFaultToleranceState(FaultToleranceState_Inactive), 1232 uFaultTolerancePort(0), 1233 uFaultToleranceInterval(0), 1234 fRTCUseUTC(false), 1235 strVMPriority("") 1236 { 1237 llGroups.push_back("/"); 1238 } 1239 1240 bool operator==(const MachineUserData &c) const 1241 { 1242 return (strName == c.strName) 1243 && (fDirectoryIncludesUUID == c.fDirectoryIncludesUUID) 1244 && (fNameSync == c.fNameSync) 1245 && (strDescription == c.strDescription) 1246 && (llGroups == c.llGroups) 1247 && (strOsType == c.strOsType) 1248 && (strSnapshotFolder == c.strSnapshotFolder) 1249 && (fTeleporterEnabled == c.fTeleporterEnabled) 1250 && (uTeleporterPort == c.uTeleporterPort) 1251 && (strTeleporterAddress == c.strTeleporterAddress) 1252 && (strTeleporterPassword == c.strTeleporterPassword) 1253 && (enmFaultToleranceState == c.enmFaultToleranceState) 1254 && (uFaultTolerancePort == c.uFaultTolerancePort) 1255 && (uFaultToleranceInterval == c.uFaultToleranceInterval) 1256 && (strFaultToleranceAddress == c.strFaultToleranceAddress) 1257 && (strFaultTolerancePassword == c.strFaultTolerancePassword) 1258 && (fRTCUseUTC == c.fRTCUseUTC) 1259 && (ovIcon == c.ovIcon) 1260 && (strVMPriority == c.strVMPriority); 1261 } 1035 MachineUserData(); 1036 1037 bool operator==(const MachineUserData &c) const; 1262 1038 1263 1039 com::Utf8Str strName; … … 1278 1054 uint32_t uFaultToleranceInterval; 1279 1055 bool fRTCUseUTC; 1280 com::Utf8StrovIcon;1056 IconBlob ovIcon; 1281 1057 com::Utf8Str strVMPriority; 1282 1058 }; 1283 1059 1284 extern const struct Snapshot g_SnapshotEmpty;1285 1060 1286 1061 /** … … 1307 1082 1308 1083 Hardware hardwareMachine; 1309 Storage storageMachine;1310 1084 MediaRegistry mediaRegistry; 1311 1085 Debugging debugging; … … 1351 1125 void readGuestProperties(const xml::ElementNode &elmGuestProperties, Hardware &hw); 1352 1126 void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl); 1353 void readHardware(const xml::ElementNode &elmHardware, Hardware &hw , Storage &strg);1127 void readHardware(const xml::ElementNode &elmHardware, Hardware &hw); 1354 1128 void readHardDiskAttachments_pre1_7(const xml::ElementNode &elmHardDiskAttachments, Storage &strg); 1355 1129 void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg); … … 1363 1137 void readMachine(const xml::ElementNode &elmMachine); 1364 1138 1365 void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, const Storage &strg);1366 void buildNetworkXML(NetworkAttachmentType_T mode, xml::ElementNode &elmParent, bool fEnabled,const NetworkAdapter &nic);1139 void buildHardwareXML(xml::ElementNode &elmParent, const Hardware &hw, uint32_t fl, std::list<xml::ElementNode*> *pllElementsWithUuidAttributes); 1140 void buildNetworkXML(NetworkAttachmentType_T mode, xml::ElementNode &elmParent, const NetworkAdapter &nic); 1367 1141 void buildStorageControllersXML(xml::ElementNode &elmParent, 1368 1142 const Storage &st, -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r60608 r61009 3 3 <!-- 4 4 5 Copyright (C) 2006-201 5Oracle Corporation5 Copyright (C) 2006-2016 Oracle Corporation 6 6 7 7 This file is part of VirtualBox Open Source Edition (OSE), as … … 7425 7425 transferred except the VM name and the hardware UUID. You can set the 7426 7426 VM name and the new hardware UUID when creating the target machine. The 7427 network MAC addresses are newly created for all network adapters. You7428 can change that behaviour with the options parameter. The operation is7429 performed asynchronously, so the machine object will be not be usable7430 until the @a progress object signals completion.7427 network MAC addresses are newly created for all enabled network 7428 adapters. You can change that behaviour with the options parameter. 7429 The operation is performed asynchronously, so the machine object will 7430 be not be usable until the @a progress object signals completion. 7431 7431 7432 7432 <result name="E_INVALIDARG"> … … 17134 17134 <attribute name="MACAddress" type="wstring"> 17135 17135 <desc> 17136 Ethernet MAC address of the adapter, 12 hexadecimal characters. When setting 17137 it to @c null or an empty string, VirtualBox will generate a unique MAC address. 17136 Ethernet MAC address of the adapter, 12 hexadecimal characters. When 17137 setting it to @c null or an empty string for an enabled adapter, 17138 VirtualBox will generate a unique MAC address. Disabled adapters can 17139 have an empty MAC address. 17138 17140 </desc> 17139 17141 </attribute> -
trunk/src/VBox/Main/include/BusAssignmentManager.h
r51612 r61009 7 7 8 8 /* 9 * Copyright (C) 2010-201 4Oracle Corporation9 * Copyright (C) 2010-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 private: 30 30 struct State; 31 State *pState;31 State *pState; 32 32 33 33 BusAssignmentManager(); 34 34 virtual ~BusAssignmentManager(); 35 35 36 HRESULT assignPCIDeviceImpl(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress,36 HRESULT assignPCIDeviceImpl(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress, 37 37 PCIBusAddress HostAddress, bool fGuestAddressRequired = false); 38 38 39 39 public: 40 static BusAssignmentManager* createInstance(ChipsetType_T chipsetType); 40 struct PCIDeviceInfo 41 { 42 com::Utf8Str strDeviceName; 43 PCIBusAddress guestAddress; 44 PCIBusAddress hostAddress; 45 }; 46 47 static BusAssignmentManager *createInstance(ChipsetType_T chipsetType); 41 48 virtual void AddRef(); 42 49 virtual void Release(); 43 50 44 virtual HRESULT assignHostPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress,51 virtual HRESULT assignHostPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress, 45 52 PCIBusAddress& GuestAddress, bool fAddressRequired = false) 46 53 { … … 48 55 } 49 56 50 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& Address, bool fAddressRequired = false)57 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg, PCIBusAddress& Address, bool fAddressRequired = false) 51 58 { 52 59 PCIBusAddress HostAddress; … … 54 61 } 55 62 56 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg)63 virtual HRESULT assignPCIDevice(const char *pszDevName, PCFGMNODE pCfg) 57 64 { 58 65 PCIBusAddress GuestAddress; … … 60 67 return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, false); 61 68 } 62 virtual bool findPCIAddress(const char *pszDevName, int iInstance, PCIBusAddress& Address);63 virtual bool hasPCIDevice(const char *pszDevName, int iInstance)69 virtual bool findPCIAddress(const char *pszDevName, int iInstance, PCIBusAddress& Address); 70 virtual bool hasPCIDevice(const char *pszDevName, int iInstance) 64 71 { 65 72 PCIBusAddress Address; 66 73 return findPCIAddress(pszDevName, iInstance, Address); 67 74 } 68 virtual void listAttachedPCIDevices(std::vector< ComPtr<IPCIDeviceAttachment>> &aAttached);75 virtual void listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached); 69 76 }; 70 77 -
trunk/src/VBox/Main/include/DHCPServerImpl.h
r56319 r61009 7 7 8 8 /* 9 * Copyright (C) 2006-201 3Oracle Corporation9 * Copyright (C) 2006-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_H_DHCPSERVERIMPL 22 22 23 #include <VBox/settings.h>24 23 #include "DHCPServerWrap.h" 24 25 namespace settings 26 { 27 struct DHCPServer; 28 struct DhcpOptValue; 29 typedef std::map<DhcpOpt_T, DhcpOptValue> DhcpOptionMap; 30 } 31 25 32 26 33 #ifdef VBOX_WITH_HOSTNETIF_API … … 58 65 */ 59 66 60 using settings::DhcpOptValue;61 using settings::DhcpOptionMap;62 using settings::DhcpOptValuePair;63 using settings::DhcpOptConstIterator;64 using settings::DhcpOptIterator;65 66 using settings::VmNameSlotKey;67 using settings::VmSlot2OptionsMap;68 using settings::VmSlot2OptionsPair;69 using settings::VmSlot2OptionsIterator;70 71 72 67 class ATL_NO_VTABLE DHCPServer : 73 68 public DHCPServerWrap … … 88 83 // Public internal methids. 89 84 HRESULT i_saveSettings(settings::DHCPServer &data); 90 DhcpOptionMap& i_findOptMapByVmNameSlot(const com::Utf8Str&aVmName,91 LONG Slot);85 settings::DhcpOptionMap &i_findOptMapByVmNameSlot(const com::Utf8Str &aVmName, 86 LONG Slot); 92 87 93 88 private: 94 89 HRESULT encodeOption(com::Utf8Str &aEncoded, 95 uint32_t aOptCode, const DhcpOptValue &aOptValue);96 int addOption( DhcpOptionMap &aMap,90 uint32_t aOptCode, const settings::DhcpOptValue &aOptValue); 91 int addOption(settings::DhcpOptionMap &aMap, 97 92 DhcpOpt_T aOption, const com::Utf8Str &aValue); 98 93 … … 134 129 Data *m; 135 130 /** weak VirtualBox parent */ 136 VirtualBox * const mVirtualBox; 137 const Bstr mName; 138 131 VirtualBox *const mVirtualBox; 132 const Utf8Str mName; 139 133 }; 140 134 -
trunk/src/VBox/Main/include/MachineImpl.h
r60765 r61009 36 36 #include "BandwidthControlImpl.h" 37 37 #include "BandwidthGroupImpl.h" 38 #include "VBox/settings.h"39 38 #ifdef VBOX_WITH_RESOURCE_USAGE_API 40 39 #include "Performance.h" … … 55 54 56 55 #include "MachineWrap.h" 56 57 /** @todo r=klaus after moving the various Machine settings structs to 58 * MachineImpl.cpp it should be possible to eliminate this include. */ 59 #include <VBox/settings.h> 57 60 58 61 // defines … … 76 79 class SessionMachine; 77 80 78 namespace settings79 {80 class MachineConfigFile;81 struct Snapshot;82 struct Hardware;83 struct Storage;84 struct StorageController;85 struct MachineRegistryEntry;86 }87 88 81 // Machine class 89 82 //////////////////////////////////////////////////////////////////////////////// … … 229 222 { 230 223 settings::MachineUserData s; 231 typedef std::vector<uint8_t> IconBlob;232 IconBlob mIcon;233 224 }; 234 225 … … 643 634 const Guid &aCurSnapshotId, 644 635 Snapshot *aParentSnapshot); 645 HRESULT i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg, 636 HRESULT i_loadHardware(const Guid *puuidRegistry, 637 const Guid *puuidSnapshot, 638 const settings::Hardware &data, 639 const settings::Debugging *pDbg, 646 640 const settings::Autostart *pAutostart); 647 641 HRESULT i_loadDebugging(const settings::Debugging *pDbg); … … 1570 1564 const settings::Debugging *pDbg, 1571 1565 const settings::Autostart *pAutostart, 1572 const settings::Storage &storage,1573 1566 IN_GUID aSnapshotId, 1574 1567 const Utf8Str &aStateFilePath); -
trunk/src/VBox/Main/include/NATEngineImpl.h
r57694 r61009 21 21 #define ____H_NATENGINE 22 22 23 24 #include <VBox/settings.h>25 23 #include "NATEngineWrap.h" 26 24 -
trunk/src/VBox/Main/include/NATNetworkImpl.h
r60786 r61009 29 29 struct NATNetwork; 30 30 struct NATRule; 31 typedef std::map<com::Utf8Str, NATRule> NATRulesMap; 31 32 } 32 33 -
trunk/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
r50922 r61009 7 7 8 8 /* 9 * Copyright (C) 2010-201 2Oracle Corporation9 * Copyright (C) 2010-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 23 23 #include "PCIDeviceAttachmentWrap.h" 24 #include <VBox/settings.h> 24 25 namespace settings 26 { 27 struct HostPCIDeviceAttachment; 28 } 25 29 26 30 class ATL_NO_VTABLE PCIDeviceAttachment : … … 33 37 // public initializer/uninitializer for internal purposes only 34 38 HRESULT init(IMachine * aParent, 35 const Bstr&aName,39 const Utf8Str &aName, 36 40 LONG aHostAddess, 37 41 LONG aGuestAddress, -
trunk/src/VBox/Main/include/USBProxyService.h
r60742 r61009 22 22 #include <VBox/usb.h> 23 23 #include <VBox/usbfilter.h> 24 #include <VBox/settings.h>25 24 26 25 #include "VirtualBoxBase.h" … … 28 27 #include "HostUSBDeviceImpl.h" 29 28 #include "USBProxyBackend.h" 29 30 30 class Host; 31 32 namespace settings 33 { 34 struct USBDeviceSource; 35 typedef std::list<USBDeviceSource> USBDeviceSourcesList; 36 } 37 31 38 32 39 /** -
trunk/src/VBox/Main/include/VRDEServerImpl.h
r49644 r61009 7 7 8 8 /* 9 * Copyright (C) 2006-201 3Oracle Corporation9 * Copyright (C) 2006-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_VRDPSERVER 22 22 23 #include <VBox/settings.h>24 23 #include "VRDEServerWrap.h" 24 25 namespace settings 26 { 27 struct VRDESettings; 28 } 25 29 26 30 class ATL_NO_VTABLE VRDEServer : … … 28 32 { 29 33 public: 30 31 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;32 34 33 35 DECLARE_EMPTY_CTOR_DTOR(VRDEServer) … … 74 76 com::Utf8Str &aValue); 75 77 76 struct Data77 {78 BOOL mEnabled;79 com::Utf8Str mAuthLibrary;80 AuthType_T mAuthType;81 ULONG mAuthTimeout;82 BOOL mAllowMultiConnection;83 BOOL mReuseSingleConnection;84 Utf8Str mVrdeExtPack;85 StringsMap mProperties;86 };87 88 78 Machine * const mParent; 89 79 const ComObjPtr<VRDEServer> mPeer; 90 80 91 Backupable< Data>mData;81 Backupable<settings::VRDESettings> mData; 92 82 }; 93 83 -
trunk/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp
r58959 r61009 7 7 8 8 /* 9 * Copyright (C) 2010-201 2Oracle Corporation9 * Copyright (C) 2010-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 #include "Logging.h" 24 24 25 #include <VBox/settings.h> 26 25 27 struct PCIDeviceAttachment::Data 26 28 { 27 Data(const Bstr&aDevName,29 Data(const Utf8Str &aDevName, 28 30 LONG aHostAddress, 29 31 LONG aGuestAddress, … … 35 37 } 36 38 37 BstrDevName;39 Utf8Str DevName; 38 40 LONG HostAddress; 39 41 LONG GuestAddress; … … 61 63 ///////////////////////////////////////////////////////////////////////////// 62 64 HRESULT PCIDeviceAttachment::init(IMachine *aParent, 63 const Bstr&aDevName,65 const Utf8Str &aDevName, 64 66 LONG aHostAddress, 65 67 LONG aGuestAddress, … … 83 85 const settings::HostPCIDeviceAttachment &hpda) 84 86 { 85 Bstr bname(hpda.strDeviceName); 86 return init(aParent, bname, hpda.uHostAddress, hpda.uGuestAddress, TRUE); 87 return init(aParent, hpda.strDeviceName, hpda.uHostAddress, hpda.uGuestAddress, TRUE); 87 88 } 88 89 -
trunk/src/VBox/Main/src-client/BusAssignmentManager.cpp
r57809 r61009 7 7 8 8 /* 9 * Copyright (C) 2010-201 4Oracle Corporation9 * Copyright (C) 2010-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 #include <VBox/vmm/cfgm.h> 25 25 #include <VBox/com/array.h> 26 27 28 #include "PCIDeviceAttachmentImpl.h"29 26 30 27 #include <map> … … 253 250 }; 254 251 255 typedef std::map <PCIBusAddress,PCIDeviceRecord >PCIMap;252 typedef std::map<PCIBusAddress,PCIDeviceRecord> PCIMap; 256 253 typedef std::vector<PCIBusAddress> PCIAddrList; 257 typedef std::vector<const DeviceAssignmentRule *>PCIRulesList;258 typedef std::map <PCIDeviceRecord,PCIAddrList >ReversePCIMap;254 typedef std::vector<const DeviceAssignmentRule *> PCIRulesList; 255 typedef std::map<PCIDeviceRecord,PCIAddrList> ReversePCIMap; 259 256 260 257 volatile int32_t cRefCnt; … … 278 275 const char* findAlias(const char* pszName); 279 276 void addMatchingRules(const char* pszName, PCIRulesList& aList); 280 void listAttachedPCIDevices(std::vector< ComPtr<IPCIDeviceAttachment>> &aAttached);277 void listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached); 281 278 }; 282 279 … … 404 401 } 405 402 406 void BusAssignmentManager::State::listAttachedPCIDevices(std::vector< ComPtr<IPCIDeviceAttachment>> &aAttached)403 void BusAssignmentManager::State::listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached) 407 404 { 408 405 aAttached.resize(mPCIMap.size()); 409 406 410 407 size_t i = 0; 411 ComObjPtr<PCIDeviceAttachment>dev;408 PCIDeviceInfo dev; 412 409 for (PCIMap::const_iterator it = mPCIMap.begin(); it != mPCIMap.end(); ++it, ++i) 413 410 { 414 dev.createObject(); 415 com::Bstr devname(it->second.szDevName); 416 dev->init(NULL, devname, 417 it->second.HostAddress.valid() ? it->second.HostAddress.asLong() : -1, 418 it->first.asLong(), it->second.HostAddress.valid()); 419 dev.queryInterfaceTo(aAttached[i].asOutParam()); 411 dev.strDeviceName = it->second.szDevName; 412 dev.guestAddress = it->first; 413 dev.hostAddress = it->second.HostAddress; 414 aAttached[i] = dev; 420 415 } 421 416 } … … 514 509 return pState->findPCIAddress(pszDevName, iInstance, Address); 515 510 } 516 void BusAssignmentManager::listAttachedPCIDevices(std::vector< ComPtr<IPCIDeviceAttachment>> &aAttached)511 void BusAssignmentManager::listAttachedPCIDevices(std::vector<PCIDeviceInfo> &aAttached) 517 512 { 518 513 pState->listAttachedPCIDevices(aAttached); -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r60404 r61009 5 5 6 6 /* 7 * Copyright (C) 2005-201 5Oracle Corporation7 * Copyright (C) 2005-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 68 68 #endif 69 69 #include "BusAssignmentManager.h" 70 #include "PCIDeviceAttachmentImpl.h" 70 71 #include "EmulatedUSBImpl.h" 71 72 … … 2000 2001 2001 2002 if (mBusMgr) 2002 mBusMgr->listAttachedPCIDevices(aAttachedPCIDevices); 2003 { 2004 std::vector<BusAssignmentManager::PCIDeviceInfo> devInfos; 2005 mBusMgr->listAttachedPCIDevices(devInfos); 2006 ComObjPtr<PCIDeviceAttachment> dev; 2007 aAttachedPCIDevices.resize(devInfos.size()); 2008 for (size_t i = 0; i < devInfos.size(); i++) 2009 { 2010 const BusAssignmentManager::PCIDeviceInfo &devInfo = devInfos[i]; 2011 dev.createObject(); 2012 dev->init(NULL, devInfo.strDeviceName, 2013 devInfo.hostAddress.valid() ? devInfo.hostAddress.asLong() : -1, 2014 devInfo.guestAddress.asLong(), 2015 devInfo.hostAddress.valid()); 2016 dev.queryInterfaceTo(aAttachedPCIDevices[i].asOutParam()); 2017 } 2018 } 2003 2019 else 2004 2020 aAttachedPCIDevices.resize(0); -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r61005 r61009 469 469 if (vsysThis.pelmVBoxMachine) 470 470 { 471 settings::StorageControllersList &llControllers = pNewDesc->m->pConfig-> storageMachine.llStorageControllers;471 settings::StorageControllersList &llControllers = pNewDesc->m->pConfig->hardwareMachine.storage.llStorageControllers; 472 472 settings::StorageControllersList::iterator it3; 473 473 for (it3 = llControllers.begin(); … … 3579 3579 * attachments pointing to the last hard disk image, which causes import 3580 3580 * failures. A long fixed bug, however the OVF files are long lived. */ 3581 settings::StorageControllersList &llControllers = config. storageMachine.llStorageControllers;3581 settings::StorageControllersList &llControllers = config.hardwareMachine.storage.llStorageControllers; 3582 3582 Guid hdUuid; 3583 3583 uint32_t cDisks = 0; … … 3792 3792 3793 3793 // for each storage controller... 3794 for (settings::StorageControllersList::iterator sit = config. storageMachine.llStorageControllers.begin();3795 sit != config. storageMachine.llStorageControllers.end();3794 for (settings::StorageControllersList::iterator sit = config.hardwareMachine.storage.llStorageControllers.begin(); 3795 sit != config.hardwareMachine.storage.llStorageControllers.end(); 3796 3796 ++sit) 3797 3797 { … … 3910 3910 break; 3911 3911 } // for (settings::AttachedDevicesList::const_iterator dit = sc.llAttachedDevices.begin(); 3912 } // for (settings::StorageControllersList::const_iterator sit = config. storageMachine.llStorageControllers.begin();3912 } // for (settings::StorageControllersList::const_iterator sit = config.hardwareMachine.storage.llStorageControllers.begin(); 3913 3913 3914 3914 // no disk with such a UUID found: … … 4093 4093 HRESULT rc = S_OK; 4094 4094 4095 settings::StorageControllersList &llControllers = config-> storageMachine.llStorageControllers;4095 settings::StorageControllersList &llControllers = config->hardwareMachine.storage.llStorageControllers; 4096 4096 settings::StorageControllersList::iterator itscl; 4097 4097 for (itscl = llControllers.begin(); -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r54705 r61009 7 7 8 8 /* 9 * Copyright (C) 2006-201 3Oracle Corporation9 * Copyright (C) 2006-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 53 53 DHCPServerRunner dhcp; 54 54 55 DhcpOptionMap GlobalDhcpOptions;56 VmSlot2OptionsMap VmSlot2Options;55 settings::DhcpOptionMap GlobalDhcpOptions; 56 settings::VmSlot2OptionsMap VmSlot2Options; 57 57 }; 58 58 … … 113 113 unconst(mName) = aName; 114 114 m->IPAddress = "0.0.0.0"; 115 m->GlobalDhcpOptions[DhcpOpt_SubnetMask] = DhcpOptValue("0.0.0.0");115 m->GlobalDhcpOptions[DhcpOpt_SubnetMask] = settings::DhcpOptValue("0.0.0.0"); 116 116 m->enabled = FALSE; 117 117 … … 275 275 276 276 HRESULT DHCPServer::encodeOption(com::Utf8Str &aEncoded, 277 uint32_t aOptCode, const DhcpOptValue &aOptValue) 277 uint32_t aOptCode, 278 const settings::DhcpOptValue &aOptValue) 278 279 { 279 280 switch (aOptValue.encoding) 280 281 { 281 case DhcpOpt Value::LEGACY:282 case DhcpOptEncoding_Legacy: 282 283 { 283 284 /* … … 293 294 } 294 295 295 case DhcpOpt Value::HEX:296 case DhcpOptEncoding_Hex: 296 297 { 297 298 /* … … 323 324 324 325 325 int DHCPServer::addOption( DhcpOptionMap &aMap,326 int DHCPServer::addOption(settings::DhcpOptionMap &aMap, 326 327 DhcpOpt_T aOption, const com::Utf8Str &aValue) 327 328 { 328 DhcpOptValue OptValue;329 settings::DhcpOptValue OptValue; 329 330 330 331 if (aOption != 0) 331 332 { 332 OptValue = DhcpOptValue(aValue, DhcpOptValue::LEGACY);333 OptValue = settings::DhcpOptValue(aValue, DhcpOptEncoding_Legacy); 333 334 } 334 335 /* … … 353 354 case ':': /* support legacy format too */ 354 355 { 355 u32Enc = DhcpOpt Value::LEGACY;356 u32Enc = DhcpOptEncoding_Legacy; 356 357 break; 357 358 } … … 359 360 case '=': 360 361 { 361 u32Enc = DhcpOpt Value::HEX;362 u32Enc = DhcpOptEncoding_Hex; 362 363 break; 363 364 } … … 378 379 379 380 aOption = (DhcpOpt_T)u8Code; 380 OptValue = DhcpOptValue(pszNext + 1, (DhcpOptValue::Encoding)u32Enc);381 OptValue = settings::DhcpOptValue(pszNext + 1, (DhcpOptEncoding_T)u32Enc); 381 382 } 382 383 … … 412 413 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 413 414 aValues.resize(m->GlobalDhcpOptions.size()); 414 DhcpOptionMap::const_iterator it;415 settings::DhcpOptionMap::const_iterator it; 415 416 size_t i = 0; 416 417 for (it = m->GlobalDhcpOptions.begin(); it != m->GlobalDhcpOptions.end(); ++it, ++i) 417 418 { 418 419 uint32_t OptCode = (*it).first; 419 const DhcpOptValue &OptValue = (*it).second;420 const settings::DhcpOptValue &OptValue = (*it).second; 420 421 421 422 encodeOption(aValues[i], OptCode, OptValue); … … 429 430 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 430 431 aValues.resize(m->VmSlot2Options.size()); 431 VmSlot2OptionsMap::const_iterator it;432 settings::VmSlot2OptionsMap::const_iterator it; 432 433 size_t i = 0; 433 434 for (it = m->VmSlot2Options.begin(); it != m->VmSlot2Options.end(); ++it, ++i) … … 447 448 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 448 449 449 DhcpOptionMap &map = m->VmSlot2Options[VmNameSlotKey(aVmName, aSlot)];450 settings::DhcpOptionMap &map = m->VmSlot2Options[settings::VmNameSlotKey(aVmName, aSlot)]; 450 451 int rc = addOption(map, aOption, aValue); 451 452 if (!RT_SUCCESS(rc)) … … 462 463 { 463 464 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 464 DhcpOptionMap&map = i_findOptMapByVmNameSlot(aVmName, aSlot);465 settings::DhcpOptionMap &map = i_findOptMapByVmNameSlot(aVmName, aSlot); 465 466 map.clear(); 466 467 … … 480 481 481 482 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 482 DhcpOptionMap&map = i_findOptMapByVmNameSlot(aVmName, aSlot);483 settings::DhcpOptionMap &map = i_findOptMapByVmNameSlot(aVmName, aSlot); 483 484 aValues.resize(map.size()); 484 485 size_t i = 0; 485 DhcpOptionMap::const_iterator it;486 settings::DhcpOptionMap::const_iterator it; 486 487 for (it = map.begin(); it != map.end(); ++it, ++i) 487 488 { 488 489 uint32_t OptCode = (*it).first; 489 const DhcpOptValue &OptValue = (*it).second;490 const settings::DhcpOptValue &OptValue = (*it).second; 490 491 491 492 encodeOption(aValues[i], OptCode, OptValue); … … 502 503 ComPtr<IMachine> machine; 503 504 ComPtr<INetworkAdapter> nic; 504 VmSlot2OptionsIterator it;505 settings::VmSlot2OptionsIterator it; 505 506 for(it = m->VmSlot2Options.begin(); it != m->VmSlot2Options.end(); ++it) 506 507 { … … 585 586 586 587 587 DhcpOptionMap& DHCPServer::i_findOptMapByVmNameSlot(const com::Utf8Str&aVmName,588 LONG aSlot)588 settings::DhcpOptionMap &DHCPServer::i_findOptMapByVmNameSlot(const com::Utf8Str &aVmName, 589 LONG aSlot) 589 590 { 590 591 return m->VmSlot2Options[settings::VmNameSlotKey(aVmName, aSlot)]; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r60809 r61009 67 67 #include <iprt/sha.h> 68 68 #include <iprt/string.h> 69 #include <iprt/base64.h>70 69 71 70 #include <VBox/com/array.h> … … 2036 2035 { 2037 2036 /* check VRAM limits */ 2038 if (aVRAMSize < SchemaDefs::MinGuestVRAM || 2039 aVRAMSize > SchemaDefs::MaxGuestVRAM) 2037 if (aVRAMSize > SchemaDefs::MaxGuestVRAM) 2040 2038 return setError(E_INVALIDARG, 2041 2039 tr("Invalid VRAM size: %lu MB (must be in range [%lu, %lu] MB)"), … … 7050 7048 { 7051 7049 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 7052 size_t cbIcon = mUserData-> mIcon.size();7050 size_t cbIcon = mUserData->s.ovIcon.size(); 7053 7051 aIcon.resize(cbIcon); 7054 7052 if (cbIcon) 7055 memcpy(&aIcon.front(), &mUserData-> mIcon[0], cbIcon);7053 memcpy(&aIcon.front(), &mUserData->s.ovIcon[0], cbIcon); 7056 7054 return S_OK; 7057 7055 } … … 7066 7064 mUserData.backup(); 7067 7065 size_t cbIcon = aIcon.size(); 7068 mUserData-> mIcon.resize(cbIcon);7066 mUserData->s.ovIcon.resize(cbIcon); 7069 7067 if (cbIcon) 7070 memcpy(&mUserData-> mIcon[0], &aIcon.front(), cbIcon);7068 memcpy(&mUserData->s.ovIcon[0], &aIcon.front(), cbIcon); 7071 7069 } 7072 7070 return hrc; … … 8631 8629 mUserData->s = config.machineUserData; 8632 8630 8633 // Decode the Icon overide data from config userdata and set onto Machine.8634 #define DECODE_STR_MAX _1M8635 const char* pszStr = config.machineUserData.ovIcon.c_str();8636 ssize_t cbOut = RTBase64DecodedSize(pszStr, NULL);8637 if (cbOut > DECODE_STR_MAX)8638 return setError(E_FAIL,8639 tr("Icon Data too long.'%d' > '%d'"),8640 cbOut,8641 DECODE_STR_MAX);8642 mUserData->mIcon.resize(cbOut);8643 int vrc = VINF_SUCCESS;8644 if (cbOut)8645 vrc = RTBase64Decode(pszStr, &mUserData->mIcon.front(), cbOut, NULL, NULL);8646 if (RT_FAILURE(vrc))8647 {8648 mUserData->mIcon.resize(0);8649 return setError(E_FAIL,8650 tr("Failure to Decode Icon Data. '%s' (%Rrc)"),8651 pszStr,8652 vrc);8653 }8654 8655 8631 // look up the object by Id to check it is valid 8656 8632 ComPtr<IGuestOSType> guestOSType; … … 8665 8641 { 8666 8642 Utf8Str stateFilePathFull(config.strStateFile); 8667 vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull);8643 int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull); 8668 8644 if (RT_FAILURE(vrc)) 8669 8645 return setError(E_FAIL, … … 8723 8699 8724 8700 // hardware data 8725 rc = i_loadHardware(config.hardwareMachine, &config.debugging, &config.autostart); 8726 if (FAILED(rc)) return rc; 8727 8728 // load storage controllers 8729 rc = i_loadStorageControllers(config.storageMachine, 8730 puuidRegistry, 8731 NULL /* puuidSnapshot */); 8701 rc = i_loadHardware(puuidRegistry, NULL, config.hardwareMachine, &config.debugging, &config.autostart); 8732 8702 if (FAILED(rc)) return rc; 8733 8703 … … 8795 8765 &data.debugging, 8796 8766 &data.autostart, 8797 data.storage,8798 8767 data.uuid.ref(), 8799 8768 strStateFile); … … 8846 8815 * @param pAutostart Pointer to the autostart settings. 8847 8816 */ 8848 HRESULT Machine::i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg, 8817 HRESULT Machine::i_loadHardware(const Guid *puuidRegistry, 8818 const Guid *puuidSnapshot, 8819 const settings::Hardware &data, 8820 const settings::Debugging *pDbg, 8849 8821 const settings::Autostart *pAutostart) 8850 8822 { … … 9050 9022 /* AudioAdapter */ 9051 9023 rc = mAudioAdapter->i_loadSettings(data.audioAdapter); 9024 if (FAILED(rc)) return rc; 9025 9026 /* storage controllers */ 9027 rc = i_loadStorageControllers(data.storage, 9028 puuidRegistry, 9029 puuidSnapshot); 9052 9030 if (FAILED(rc)) return rc; 9053 9031 … … 10049 10027 config.machineUserData = mUserData->s; 10050 10028 10051 // Encode the Icon Override data from Machine and store on config userdata.10052 std::vector<BYTE> iconByte;10053 getIcon(iconByte);10054 ssize_t cbData = iconByte.size();10055 if (cbData > 0)10056 {10057 ssize_t cchOut = RTBase64EncodedLength(cbData);10058 Utf8Str strIconData;10059 strIconData.reserve(cchOut+1);10060 int vrc = RTBase64Encode(&iconByte.front(), cbData,10061 strIconData.mutableRaw(), strIconData.capacity(),10062 NULL);10063 if (RT_FAILURE(vrc))10064 throw setError(E_FAIL, tr("Failure to Encode Icon Data. '%s' (%Rrc)"), strIconData.mutableRaw(), vrc);10065 strIconData.jolt();10066 config.machineUserData.ovIcon = strIconData;10067 }10068 else10069 config.machineUserData.ovIcon.setNull();10070 10071 10029 if ( mData->mMachineState == MachineState_Saved 10072 10030 || mData->mMachineState == MachineState_Restoring … … 10102 10060 if (FAILED(rc)) throw rc; 10103 10061 10104 rc = i_saveStorageControllers(config.storageMachine);10105 if (FAILED(rc)) throw rc;10106 10107 10062 // save machine's media registry if this is VirtualBox 4.0 or later 10108 10063 if (config.canHaveOwnMediaRegistry()) … … 10141 10096 { 10142 10097 // the settings use a list for "the first snapshot" 10143 config.llFirstSnapshot.push_back(settings:: g_SnapshotEmpty);10098 config.llFirstSnapshot.push_back(settings::Snapshot::Empty); 10144 10099 10145 10100 // get reference to the snapshot on the list and work on that … … 10360 10315 /* Audio adapter */ 10361 10316 rc = mAudioAdapter->i_saveSettings(data.audioAdapter); 10317 if (FAILED(rc)) return rc; 10318 10319 rc = i_saveStorageControllers(data.storage); 10362 10320 if (FAILED(rc)) return rc; 10363 10321 -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r60627 r61009 673 673 ++it) 674 674 { 675 updateStorageLists(it-> storage.llStorageControllers, bstrOldId, bstrNewId);675 updateStorageLists(it->hardware.storage.llStorageControllers, bstrOldId, bstrNewId); 676 676 if (!it->llChildSnapshots.empty()) 677 677 updateSnapshotStorageLists(it->llChildSnapshots, bstrOldId, bstrNewId); … … 1021 1021 { 1022 1022 if (sn.uuid.isValid() && !sn.uuid.isZero()) 1023 {1024 1023 trgMCF.hardwareMachine = sn.hardware; 1025 trgMCF.storageMachine = sn.storage;1026 }1027 1024 1028 1025 /* Remove any hint on snapshots. */ … … 1038 1035 /* Copy the snapshot data to the current machine. */ 1039 1036 trgMCF.hardwareMachine = sn.hardware; 1040 trgMCF.storageMachine = sn.storage;1041 1037 1042 1038 /* Current state is under root snapshot. */ … … 1350 1346 } 1351 1347 /* update 'Current State' configuration */ 1352 d->updateStorageLists(trgMCF. storageMachine.llStorageControllers, bstrSrcId, bstrTrgId);1348 d->updateStorageLists(trgMCF.hardwareMachine.storage.llStorageControllers, bstrSrcId, bstrTrgId); 1353 1349 } 1354 1350 /* Make sure all disks know of the new machine uuid. We do this last to -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r60628 r61009 4252 4252 // settings sub-tree is copied) and the stack footprint (the settings 4253 4253 // need almost 1K, and there can be VMs with long image chains. 4254 llSettingsChildren.push_back(settings:: g_MediumEmpty);4254 llSettingsChildren.push_back(settings::Medium::Empty); 4255 4255 HRESULT rc = (*it)->i_saveSettings(llSettingsChildren.back(), strHardDiskFolder); 4256 4256 if (FAILED(rc)) -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r60808 r61009 5 5 6 6 /* 7 * Copyright (C) 2006-201 5Oracle Corporation7 * Copyright (C) 2006-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 89 89 /* default to Am79C973 */ 90 90 mData->mAdapterType = NetworkAdapterType_Am79C973; 91 92 /* generate the MAC address early to guarantee it is the same both after93 * changing some other property (i.e. after mData.backup()) and after the94 * subsequent mData.rollback(). */95 i_generateMACAddress();96 91 97 92 /* Confirm a successful initialization */ … … 303 298 mData.backup(); 304 299 mData->mEnabled = aEnabled; 300 if (aEnabled && mData->mMACAddress.isEmpty()) 301 i_generateMACAddress(); 305 302 306 303 // leave the lock before informing callbacks … … 323 320 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 324 321 325 ComAssertRet(!mData->m MACAddress.isEmpty(), E_FAIL);322 ComAssertRet(!mData->mEnabled || !mData->mMACAddress.isEmpty(), E_FAIL); 326 323 327 324 aMACAddress = mData->mMACAddress; … … 337 334 * Are we supposed to generate a MAC? 338 335 */ 339 if ( aMACAddress.isEmpty())336 if (mData->mEnabled && aMACAddress.isEmpty()) 340 337 i_generateMACAddress(); 341 338 else … … 343 340 if (mData->mMACAddress != aMACAddress) 344 341 { 345 /* 346 * Verify given MAC address 347 */ 348 char *macAddressStr = aMACAddress.mutableRaw(); 349 int i = 0; 350 while ((i < 13) && macAddressStr && *macAddressStr && (rc == S_OK)) 342 if (mData->mEnabled || !aMACAddress.isEmpty()) 351 343 { 352 char c = *macAddressStr; 353 /* canonicalize hex digits to capital letters */ 354 if (c >= 'a' && c <= 'f') 344 /* 345 * Verify given MAC address 346 */ 347 char *macAddressStr = aMACAddress.mutableRaw(); 348 int i = 0; 349 while ((i < 13) && macAddressStr && *macAddressStr && (rc == S_OK)) 355 350 { 356 /** @todo the runtime lacks an ascii lower/upper conv */ 357 c &= 0xdf; 358 *macAddressStr = c; 351 char c = *macAddressStr; 352 /* canonicalize hex digits to capital letters */ 353 if (c >= 'a' && c <= 'f') 354 { 355 /** @todo the runtime lacks an ascii lower/upper conv */ 356 c &= 0xdf; 357 *macAddressStr = c; 358 } 359 /* we only accept capital letters */ 360 if (((c < '0') || (c > '9')) && 361 ((c < 'A') || (c > 'F'))) 362 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 363 /* the second digit must have even value for unicast addresses */ 364 if ((i == 1) && (!!(c & 1) == (c >= '0' && c <= '9'))) 365 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 366 367 macAddressStr++; 368 i++; 359 369 } 360 /* we only accept capital letters */ 361 if (((c < '0') || (c > '9')) && 362 ((c < 'A') || (c > 'F'))) 370 /* we must have parsed exactly 12 characters */ 371 if (i != 12) 363 372 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 364 /* the second digit must have even value for unicast addresses */365 if ((i == 1) && (!!(c & 1) == (c >= '0' && c <= '9')))366 rc = setError(E_INVALIDARG, tr("Invalid MAC address format"));367 368 macAddressStr++;369 i++;370 373 } 371 /* we must have parsed exactly 12 characters */372 if (i != 12)373 rc = setError(E_INVALIDARG, tr("Invalid MAC address format"));374 374 375 375 if (SUCCEEDED(rc)) -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r60288 r61009 758 758 if (FAILED(rc)) return rc; 759 759 760 rc = m->pMachine->i_saveStorageControllers(data.storage);761 if (FAILED(rc)) return rc;762 763 760 return S_OK; 764 761 } … … 786 783 // need a lot of stack space. There can be VMs with deeply nested 787 784 // snapshots. The stack can be quite small, especially with XPCOM. 788 llSettingsChildren.push_back(settings:: g_SnapshotEmpty);785 llSettingsChildren.push_back(settings::Snapshot::Empty); 789 786 Snapshot *pSnap = *it; 790 787 rc = pSnap->i_saveSnapshotImpl(llSettingsChildren.back()); … … 1126 1123 const settings::Debugging *pDbg, 1127 1124 const settings::Autostart *pAutostart, 1128 const settings::Storage &storage,1129 1125 IN_GUID aSnapshotId, 1130 1126 const Utf8Str &aStateFilePath) … … 1203 1199 mBandwidthControl->init(this); 1204 1200 1205 /* load hardware and harddisk settings */ 1206 1207 HRESULT rc = i_loadHardware(hardware, pDbg, pAutostart); 1208 if (SUCCEEDED(rc)) 1209 rc = i_loadStorageControllers(storage, 1210 NULL, /* puuidRegistry */ 1211 &mSnapshotId); 1201 /* load hardware and storage settings */ 1202 HRESULT rc = i_loadHardware(NULL, &mSnapshotId, hardware, pDbg, pAutostart); 1212 1203 1213 1204 if (SUCCEEDED(rc)) -
trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
r60826 r61009 6 6 7 7 /* 8 * Copyright (C) 2006-201 5Oracle Corporation8 * Copyright (C) 2006-2016 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 89 89 90 90 mData.allocate(); 91 92 mData->mAuthType = AuthType_Null;93 mData->mAuthTimeout = 5000;94 mData->mAuthLibrary.setNull();95 mData->mEnabled = FALSE;96 mData->mAllowMultiConnection = FALSE;97 mData->mReuseSingleConnection = FALSE;98 mData->mVrdeExtPack.setNull();99 91 100 92 /* Confirm a successful initialization */ … … 206 198 207 199 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 208 mData->mEnabled = data.fEnabled; 209 mData->mAuthType = data.authType; 210 mData->mAuthTimeout = data.ulAuthTimeout; 211 mData->mAuthLibrary = data.strAuthLibrary; 212 mData->mAllowMultiConnection = data.fAllowMultiConnection; 213 mData->mReuseSingleConnection = data.fReuseSingleConnection; 214 mData->mVrdeExtPack = data.strVrdeExtPack; 215 mData->mProperties = data.mapProperties; 200 mData.assignCopy(&data); 216 201 217 202 return S_OK; … … 231 216 232 217 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 233 234 data.fEnabled = !!mData->mEnabled; 235 data.authType = mData->mAuthType; 236 data.strAuthLibrary = mData->mAuthLibrary; 237 data.ulAuthTimeout = mData->mAuthTimeout; 238 data.fAllowMultiConnection = !!mData->mAllowMultiConnection; 239 data.fReuseSingleConnection = !!mData->mReuseSingleConnection; 240 data.strVrdeExtPack = mData->mVrdeExtPack; 241 data.mapProperties = mData->mProperties; 218 data = *mData.data(); 242 219 243 220 return S_OK; … … 251 228 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 252 229 253 *aEnabled = mData-> mEnabled;230 *aEnabled = mData->fEnabled; 254 231 255 232 return S_OK; … … 266 243 HRESULT rc = S_OK; 267 244 268 if (mData-> mEnabled != aEnabled)245 if (mData->fEnabled != RT_BOOL(aEnabled)) 269 246 { 270 247 mData.backup(); 271 mData-> mEnabled = aEnabled;248 mData->fEnabled = RT_BOOL(aEnabled); 272 249 273 250 /* leave the lock before informing callbacks */ … … 390 367 return E_INVALIDARG; 391 368 392 if (strPorts != mData->m Properties["TCP/Ports"])369 if (strPorts != mData->mapProperties["TCP/Ports"]) 393 370 { 394 371 /* Port value is not verified here because it is up to VRDP transport to … … 397 374 */ 398 375 mData.backup(); 399 mData->m Properties["TCP/Ports"] = strPorts;376 mData->mapProperties["TCP/Ports"] = strPorts; 400 377 401 378 /* leave the lock before informing callbacks */ … … 419 396 Utf8Str strOldValue; 420 397 421 settings::StringsMap::const_iterator it = mData->m Properties.find(aKey);422 if (it != mData->m Properties.end())398 settings::StringsMap::const_iterator it = mData->mapProperties.find(aKey); 399 if (it != mData->mapProperties.end()) 423 400 strOldValue = it->second; 424 401 … … 426 403 { 427 404 if (aValue.isEmpty()) 428 mData->m Properties.erase(aKey);405 mData->mapProperties.erase(aKey); 429 406 else 430 mData->m Properties[aKey] = aValue;407 mData->mapProperties[aKey] = aValue; 431 408 432 409 /* leave the lock before informing callbacks */ … … 450 427 { 451 428 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 452 settings::StringsMap::const_iterator it = mData->m Properties.find(aKey);453 if (it != mData->m Properties.end())429 settings::StringsMap::const_iterator it = mData->mapProperties.find(aKey); 430 if (it != mData->mapProperties.end()) 454 431 aValue = it->second; // source is a Utf8Str 455 432 else if (aKey == "TCP/Ports") … … 509 486 aProperties.resize(0); 510 487 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 511 if (!mData-> mEnabled)488 if (!mData->fEnabled) 512 489 { 513 490 return S_OK; … … 595 572 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 596 573 597 *aType = mData-> mAuthType;574 *aType = mData->authType; 598 575 599 576 return S_OK; … … 608 585 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 609 586 610 if (mData-> mAuthType != aType)587 if (mData->authType != aType) 611 588 { 612 589 mData.backup(); 613 mData-> mAuthType = aType;590 mData->authType = aType; 614 591 615 592 /* leave the lock before informing callbacks */ … … 630 607 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 631 608 632 *aTimeout = mData-> mAuthTimeout;609 *aTimeout = mData->ulAuthTimeout; 633 610 634 611 return S_OK; … … 644 621 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 645 622 646 if (aTimeout != mData-> mAuthTimeout)623 if (aTimeout != mData->ulAuthTimeout) 647 624 { 648 625 mData.backup(); 649 mData-> mAuthTimeout = aTimeout;626 mData->ulAuthTimeout = aTimeout; 650 627 651 628 /* leave the lock before informing callbacks */ … … 669 646 { 670 647 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 671 aLibrary = mData-> mAuthLibrary;648 aLibrary = mData->strAuthLibrary; 672 649 alock.release(); 673 650 … … 701 678 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 702 679 703 if (mData-> mAuthLibrary != aLibrary)680 if (mData->strAuthLibrary != aLibrary) 704 681 { 705 682 mData.backup(); 706 mData-> mAuthLibrary = aLibrary;683 mData->strAuthLibrary = aLibrary; 707 684 708 685 /* leave the lock before informing callbacks */ … … 724 701 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 725 702 726 *aAllowMultiConnection = mData-> mAllowMultiConnection;703 *aAllowMultiConnection = mData->fAllowMultiConnection; 727 704 728 705 return S_OK; … … 738 715 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 739 716 740 if (mData-> mAllowMultiConnection != aAllowMultiConnection)717 if (mData->fAllowMultiConnection != RT_BOOL(aAllowMultiConnection)) 741 718 { 742 719 mData.backup(); 743 mData-> mAllowMultiConnection = aAllowMultiConnection;720 mData->fAllowMultiConnection = RT_BOOL(aAllowMultiConnection); 744 721 745 722 /* leave the lock before informing callbacks */ … … 760 737 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 761 738 762 *aReuseSingleConnection = mData-> mReuseSingleConnection;739 *aReuseSingleConnection = mData->fReuseSingleConnection; 763 740 764 741 return S_OK; … … 773 750 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 774 751 775 if (mData-> mReuseSingleConnection != aReuseSingleConnection)752 if (mData->fReuseSingleConnection != RT_BOOL(aReuseSingleConnection)) 776 753 { 777 754 mData.backup(); 778 mData-> mReuseSingleConnection = aReuseSingleConnection;755 mData->fReuseSingleConnection = RT_BOOL(aReuseSingleConnection); 779 756 780 757 /* leave the lock before informing callbacks */ … … 794 771 { 795 772 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 796 Utf8Str strExtPack = mData-> mVrdeExtPack;773 Utf8Str strExtPack = mData->strVrdeExtPack; 797 774 alock.release(); 798 775 HRESULT hrc = S_OK; … … 864 841 */ 865 842 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 866 if (aExtPack != mData-> mVrdeExtPack)843 if (aExtPack != mData->strVrdeExtPack) 867 844 { 868 845 mData.backup(); 869 mData-> mVrdeExtPack = aExtPack;846 mData->strVrdeExtPack = aExtPack; 870 847 871 848 /* leave the lock before informing callbacks */ -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r60786 r61009 4131 4131 if (pMedium->i_isInRegistry(uuidRegistry)) 4132 4132 { 4133 llTarget.push_back(settings:: g_MediumEmpty);4133 llTarget.push_back(settings::Medium::Empty); 4134 4134 rc = pMedium->i_saveSettings(llTarget.back(), strMachineFolder); // this recurses into child hard disks 4135 4135 if (FAILED(rc)) -
trunk/src/VBox/Main/xml/Settings.cpp
r60786 r61009 52 52 * version (stored in m->sv) is high enough. That is, for VirtualBox 4.0, write it 53 53 * only if (m->sv >= SettingsVersion_v1_11). 54 * 55 * 5) You _must_ update xml/VirtalBox-settings.xsd to contain the new tags and attributes. 56 * Check that settings file from before and after your change are validating properly. 57 * Use "kmk testvalidsettings", it should not find any files which don't validate. 54 58 */ 55 59 … … 74 78 #include <iprt/process.h> 75 79 #include <iprt/ldr.h> 80 #include <iprt/base64.h> 76 81 #include <iprt/cpp/lock.h> 77 82 … … 92 97 93 98 /** VirtualBox XML settings namespace */ 94 #define VBOX_XML_NAMESPACE "http://www.innotek.de/VirtualBox-settings" 99 #define VBOX_XML_NAMESPACE "http://www.virtualbox.org/" 100 101 /** VirtualBox XML schema location (relative URI) */ 102 #define VBOX_XML_SCHEMA "VirtualBox-settings.xsd" 95 103 96 104 /** VirtualBox XML settings version number substring ("x.y") */ … … 121 129 #define VBOX_XML_VERSION_FULL VBOX_XML_VERSION "-" VBOX_XML_PLATFORM 122 130 123 const struct Snapshot settings::g_SnapshotEmpty; /* default ctor is OK */124 const struct Medium settings::g_MediumEmpty; /* default ctor is OK */125 126 131 //////////////////////////////////////////////////////////////////////////////// 127 132 // … … 212 217 } 213 218 }; 214 215 ////////////////////////////////////////////////////////////////////////////////216 //217 // MediaRegistry218 //219 ////////////////////////////////////////////////////////////////////////////////220 221 bool Medium::operator==(const Medium &m) const222 {223 return (uuid == m.uuid)224 && (strLocation == m.strLocation)225 && (strDescription == m.strDescription)226 && (strFormat == m.strFormat)227 && (fAutoReset == m.fAutoReset)228 && (properties == m.properties)229 && (hdType == m.hdType)230 && (llChildren== m.llChildren); // this is deep and recurses231 }232 233 bool MediaRegistry::operator==(const MediaRegistry &m) const234 {235 return llHardDisks == m.llHardDisks236 && llDvdImages == m.llDvdImages237 && llFloppyImages == m.llFloppyImages;238 }239 219 240 220 //////////////////////////////////////////////////////////////////////////////// … … 337 317 else if (ulMinor == 16) 338 318 m->sv = SettingsVersion_v1_16; 339 else if (ulMinor > 1 5)319 else if (ulMinor > 16) 340 320 m->sv = SettingsVersion_Future; 341 321 } … … 488 468 489 469 /** 470 * Helper function that parses a Base64 formatted string into a binary blob. 471 * @param guid 472 * @param strUUID 473 */ 474 void ConfigFileBase::parseBase64(IconBlob &binary, 475 const Utf8Str &str) const 476 { 477 #define DECODE_STR_MAX _1M 478 const char* psz = str.c_str(); 479 ssize_t cbOut = RTBase64DecodedSize(psz, NULL); 480 if (cbOut > DECODE_STR_MAX) 481 throw ConfigFileError(this, NULL, N_("Base64 encoded data too long. %d > %d"), cbOut, DECODE_STR_MAX); 482 binary.resize(cbOut); 483 int vrc = VINF_SUCCESS; 484 if (cbOut) 485 vrc = RTBase64Decode(psz, &binary.front(), cbOut, NULL, NULL); 486 if (RT_FAILURE(vrc)) 487 { 488 binary.resize(0); 489 throw ConfigFileError(this, NULL, N_("Base64 encoded data could not be decoded (%Rrc)"), vrc); 490 } 491 } 492 493 /** 490 494 * Helper to create a string for a RTTIMESPEC for writing out ISO timestamps. 491 495 * @param stamp … … 501 505 time.i32Year, time.u8Month, time.u8MonthDay, 502 506 time.u8Hour, time.u8Minute, time.u8Second); 507 } 508 509 /** 510 * Helper to create a base64 encoded string out of a binary blob. 511 * @param str 512 * @param binary 513 */ 514 void ConfigFileBase::toBase64(com::Utf8Str &str, const IconBlob &binary) const 515 { 516 ssize_t cb = binary.size(); 517 if (cb > 0) 518 { 519 ssize_t cchOut = RTBase64EncodedLength(cb); 520 str.reserve(cchOut+1); 521 int vrc = RTBase64Encode(&binary.front(), cb, 522 str.mutableRaw(), str.capacity(), 523 NULL); 524 if (RT_FAILURE(vrc)) 525 throw ConfigFileError(this, NULL, N_("Failed to convert binary data to base64 format (%Rrc)"), vrc); 526 str.jolt(); 527 } 503 528 } 504 529 … … 800 825 // XPCOM has very small stack, avoid big local variables and use the 801 826 // list element. 802 llSettingsChildren.push_back( g_MediumEmpty);827 llSettingsChildren.push_back(Medium::Empty); 803 828 readMedium(t, 804 829 depth + 1, … … 843 868 && (pelmMedium->nameEquals("HardDisk"))) 844 869 { 845 mr.llHardDisks.push_back( g_MediumEmpty);870 mr.llHardDisks.push_back(Medium::Empty); 846 871 readMedium(t, 1, *pelmMedium, mr.llHardDisks.back()); 847 872 } … … 849 874 && (pelmMedium->nameEquals("Image"))) 850 875 { 851 mr.llDvdImages.push_back( g_MediumEmpty);876 mr.llDvdImages.push_back(Medium::Empty); 852 877 readMedium(t, 1, *pelmMedium, mr.llDvdImages.back()); 853 878 } … … 855 880 && (pelmMedium->nameEquals("Image"))) 856 881 { 857 mr.llFloppyImages.push_back( g_MediumEmpty);882 mr.llFloppyImages.push_back(Medium::Empty); 858 883 readMedium(t, 1, *pelmMedium, mr.llFloppyImages.back()); 859 884 } … … 973 998 // but as it's an omission of someone who changed this file 974 999 // it's the only generic possibility. 975 pcszVersion = "1.1 5";976 m->sv = SettingsVersion_v1_1 5;1000 pcszVersion = "1.16"; 1001 m->sv = SettingsVersion_v1_16; 977 1002 } 978 1003 break; … … 1012 1037 ); 1013 1038 m->pelmRoot->setAttribute("xmlns", VBOX_XML_NAMESPACE); 1039 // Have the code for producing a proper schema reference. Not used by most 1040 // tools, so don't bother doing it. The schema is not on the server anyway. 1041 #ifdef VBOX_WITH_SETTINGS_SCHEMA 1042 m->pelmRoot->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); 1043 m->pelmRoot->setAttribute("xsi:schemaLocation", VBOX_XML_NAMESPACE " " VBOX_XML_SCHEMA); 1044 #endif 1014 1045 1015 1046 // add settings version attribute to root element … … 1231 1262 const MediaRegistry &mr) 1232 1263 { 1264 if (mr.llHardDisks.size() == 0 && mr.llDvdImages.size() == 0 && mr.llFloppyImages.size() == 0) 1265 return; 1266 1233 1267 xml::ElementNode *pelmMediaRegistry = elmParent.createChild("MediaRegistry"); 1234 1268 1235 xml::ElementNode *pelmHardDisks = pelmMediaRegistry->createChild("HardDisks"); 1236 for (MediaList::const_iterator it = mr.llHardDisks.begin(); 1237 it != mr.llHardDisks.end(); 1238 ++it) 1239 { 1240 buildMedium(HardDisk, 1, *pelmHardDisks, *it); 1241 } 1242 1243 xml::ElementNode *pelmDVDImages = pelmMediaRegistry->createChild("DVDImages"); 1244 for (MediaList::const_iterator it = mr.llDvdImages.begin(); 1245 it != mr.llDvdImages.end(); 1246 ++it) 1247 { 1248 buildMedium(DVDImage, 1, *pelmDVDImages, *it); 1249 } 1250 1251 xml::ElementNode *pelmFloppyImages = pelmMediaRegistry->createChild("FloppyImages"); 1252 for (MediaList::const_iterator it = mr.llFloppyImages.begin(); 1253 it != mr.llFloppyImages.end(); 1254 ++it) 1255 { 1256 buildMedium(FloppyImage, 1, *pelmFloppyImages, *it); 1269 if (mr.llHardDisks.size()) 1270 { 1271 xml::ElementNode *pelmHardDisks = pelmMediaRegistry->createChild("HardDisks"); 1272 for (MediaList::const_iterator it = mr.llHardDisks.begin(); 1273 it != mr.llHardDisks.end(); 1274 ++it) 1275 { 1276 buildMedium(HardDisk, 1, *pelmHardDisks, *it); 1277 } 1278 } 1279 1280 if (mr.llDvdImages.size()) 1281 { 1282 xml::ElementNode *pelmDVDImages = pelmMediaRegistry->createChild("DVDImages"); 1283 for (MediaList::const_iterator it = mr.llDvdImages.begin(); 1284 it != mr.llDvdImages.end(); 1285 ++it) 1286 { 1287 buildMedium(DVDImage, 1, *pelmDVDImages, *it); 1288 } 1289 } 1290 1291 if (mr.llFloppyImages.size()) 1292 { 1293 xml::ElementNode *pelmFloppyImages = pelmMediaRegistry->createChild("FloppyImages"); 1294 for (MediaList::const_iterator it = mr.llFloppyImages.begin(); 1295 it != mr.llFloppyImages.end(); 1296 ++it) 1297 { 1298 buildMedium(FloppyImage, 1, *pelmFloppyImages, *it); 1299 } 1257 1300 } 1258 1301 } … … 1335 1378 //////////////////////////////////////////////////////////////////////////////// 1336 1379 1380 1381 /** 1382 * Constructor. Needs to set sane defaults which stand the test of time. 1383 */ 1384 USBDeviceFilter::USBDeviceFilter() : 1385 fActive(false), 1386 action(USBDeviceFilterAction_Null), 1387 ulMaskedInterfaces(0) 1388 { 1389 } 1390 1337 1391 /** 1338 1392 * Comparison operator. This gets called from MachineConfigFile::operator==, … … 1342 1396 bool USBDeviceFilter::operator==(const USBDeviceFilter &u) const 1343 1397 { 1344 return ( (this == &u) 1345 || ( (strName == u.strName) 1346 && (fActive == u.fActive) 1347 && (strVendorId == u.strVendorId) 1348 && (strProductId == u.strProductId) 1349 && (strRevision == u.strRevision) 1350 && (strManufacturer == u.strManufacturer) 1351 && (strProduct == u.strProduct) 1352 && (strSerialNumber == u.strSerialNumber) 1353 && (strPort == u.strPort) 1354 && (action == u.action) 1355 && (strRemote == u.strRemote) 1356 && (ulMaskedInterfaces == u.ulMaskedInterfaces) 1357 ) 1358 ); 1359 } 1398 return (this == &u) 1399 || ( strName == u.strName 1400 && fActive == u.fActive 1401 && strVendorId == u.strVendorId 1402 && strProductId == u.strProductId 1403 && strRevision == u.strRevision 1404 && strManufacturer == u.strManufacturer 1405 && strProduct == u.strProduct 1406 && strSerialNumber == u.strSerialNumber 1407 && strPort == u.strPort 1408 && action == u.action 1409 && strRemote == u.strRemote 1410 && ulMaskedInterfaces == u.ulMaskedInterfaces); 1411 } 1412 1413 /** 1414 * Constructor. Needs to set sane defaults which stand the test of time. 1415 */ 1416 Medium::Medium() : 1417 fAutoReset(false), 1418 hdType(MediumType_Normal) 1419 { 1420 } 1421 1422 /** 1423 * Comparison operator. This gets called from MachineConfigFile::operator==, 1424 * which in turn gets called from Machine::saveSettings to figure out whether 1425 * machine settings have really changed and thus need to be written out to disk. 1426 */ 1427 bool Medium::operator==(const Medium &m) const 1428 { 1429 return (this == &m) 1430 || ( uuid == m.uuid 1431 && strLocation == m.strLocation 1432 && strDescription == m.strDescription 1433 && strFormat == m.strFormat 1434 && fAutoReset == m.fAutoReset 1435 && properties == m.properties 1436 && hdType == m.hdType 1437 && llChildren == m.llChildren); // this is deep and recurses 1438 } 1439 1440 const struct Medium Medium::Empty; /* default ctor is OK */ 1441 1442 /** 1443 * Comparison operator. This gets called from MachineConfigFile::operator==, 1444 * which in turn gets called from Machine::saveSettings to figure out whether 1445 * machine settings have really changed and thus need to be written out to disk. 1446 */ 1447 bool MediaRegistry::operator==(const MediaRegistry &m) const 1448 { 1449 return (this == &m) 1450 || ( llHardDisks == m.llHardDisks 1451 && llDvdImages == m.llDvdImages 1452 && llFloppyImages == m.llFloppyImages); 1453 } 1454 1455 /** 1456 * Constructor. Needs to set sane defaults which stand the test of time. 1457 */ 1458 NATRule::NATRule() : 1459 proto(NATProtocol_TCP), 1460 u16HostPort(0), 1461 u16GuestPort(0) 1462 { 1463 } 1464 1465 /** 1466 * Comparison operator. This gets called from MachineConfigFile::operator==, 1467 * which in turn gets called from Machine::saveSettings to figure out whether 1468 * machine settings have really changed and thus need to be written out to disk. 1469 */ 1470 bool NATRule::operator==(const NATRule &r) const 1471 { 1472 return (this == &r) 1473 || ( strName == r.strName 1474 && proto == r.proto 1475 && u16HostPort == r.u16HostPort 1476 && strHostIP == r.strHostIP 1477 && u16GuestPort == r.u16GuestPort 1478 && strGuestIP == r.strGuestIP); 1479 } 1480 1481 /** 1482 * Constructor. Needs to set sane defaults which stand the test of time. 1483 */ 1484 NATHostLoopbackOffset::NATHostLoopbackOffset() : 1485 u32Offset(0) 1486 { 1487 } 1488 1489 /** 1490 * Comparison operator. This gets called from MachineConfigFile::operator==, 1491 * which in turn gets called from Machine::saveSettings to figure out whether 1492 * machine settings have really changed and thus need to be written out to disk. 1493 */ 1494 bool NATHostLoopbackOffset::operator==(const NATHostLoopbackOffset &o) const 1495 { 1496 return (this == &o) 1497 || ( strLoopbackHostAddress == o.strLoopbackHostAddress 1498 && u32Offset == o.u32Offset); 1499 } 1500 1501 1502 //////////////////////////////////////////////////////////////////////////////// 1503 // 1504 // VirtualBox.xml structures 1505 // 1506 //////////////////////////////////////////////////////////////////////////////// 1507 1508 /** 1509 * Constructor. Needs to set sane defaults which stand the test of time. 1510 */ 1511 SystemProperties::SystemProperties() : 1512 ulLogHistoryCount(3), 1513 fExclusiveHwVirt(true) 1514 { 1515 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) 1516 fExclusiveHwVirt = false; 1517 #endif 1518 } 1519 1520 /** 1521 * Constructor. Needs to set sane defaults which stand the test of time. 1522 */ 1523 DhcpOptValue::DhcpOptValue() : 1524 text(), 1525 encoding(DhcpOptEncoding_Legacy) 1526 { 1527 } 1528 1529 /** 1530 * Non-standard constructor. 1531 */ 1532 DhcpOptValue::DhcpOptValue(const com::Utf8Str &aText, DhcpOptEncoding_T aEncoding) : 1533 text(aText), 1534 encoding(aEncoding) 1535 { 1536 } 1537 1538 /** 1539 * Non-standard constructor. 1540 */ 1541 VmNameSlotKey::VmNameSlotKey(const com::Utf8Str& aVmName, LONG aSlot) : 1542 VmName(aVmName), 1543 Slot(aSlot) 1544 { 1545 } 1546 1547 /** 1548 * Non-standard comparison operator. 1549 */ 1550 bool VmNameSlotKey::operator< (const VmNameSlotKey& that) const 1551 { 1552 if (VmName == that.VmName) 1553 return Slot < that.Slot; 1554 else 1555 return VmName < that.VmName; 1556 } 1557 1558 /** 1559 * Constructor. Needs to set sane defaults which stand the test of time. 1560 */ 1561 DHCPServer::DHCPServer() : 1562 fEnabled(false) 1563 { 1564 } 1565 1566 /** 1567 * Constructor. Needs to set sane defaults which stand the test of time. 1568 */ 1569 NATNetwork::NATNetwork() : 1570 fEnabled(true), 1571 fIPv6Enabled(false), 1572 fAdvertiseDefaultIPv6Route(false), 1573 fNeedDhcpServer(true), 1574 u32HostLoopback6Offset(0) 1575 { 1576 } 1577 1578 1360 1579 1361 1580 //////////////////////////////////////////////////////////////////////////////// … … 1447 1666 DhcpOpt_T OptName; 1448 1667 com::Utf8Str OptText; 1449 int32_t OptEnc = DhcpOpt Value::LEGACY;1668 int32_t OptEnc = DhcpOptEncoding_Legacy; 1450 1669 1451 1670 opt->getAttributeValue("name", (uint32_t&)OptName); … … 1457 1676 opt->getAttributeValue("encoding", OptEnc); 1458 1677 1459 map[OptName] = DhcpOptValue(OptText, (DhcpOpt Value::Encoding)OptEnc);1678 map[OptName] = DhcpOptValue(OptText, (DhcpOptEncoding_T)OptEnc); 1460 1679 } /* end of forall("Option") */ 1461 1680 … … 1767 1986 pelmOpt->setAttribute("name", itOpt->first); 1768 1987 pelmOpt->setAttribute("value", itOpt->second.text); 1769 if (itOpt->second.encoding != DhcpOpt Value::LEGACY)1988 if (itOpt->second.encoding != DhcpOptEncoding_Legacy) 1770 1989 pelmOpt->setAttribute("encoding", (int)itOpt->second.encoding); 1771 1990 } … … 1791 2010 pelmOpt->setAttribute("name", itOpt1->first); 1792 2011 pelmOpt->setAttribute("value", itOpt1->second.text); 1793 if (itOpt1->second.encoding != DhcpOpt Value::LEGACY)2012 if (itOpt1->second.encoding != DhcpOptEncoding_Legacy) 1794 2013 pelmOpt->setAttribute("encoding", (int)itOpt1->second.encoding); 1795 2014 } … … 1882 2101 1883 2102 /** 2103 * Constructor. Needs to set sane defaults which stand the test of time. 2104 */ 2105 VRDESettings::VRDESettings() : 2106 fEnabled(false), 2107 authType(AuthType_Null), 2108 ulAuthTimeout(5000), 2109 fAllowMultiConnection(false), 2110 fReuseSingleConnection(false) 2111 { 2112 } 2113 2114 /** 2115 * Check if all settings have default values. 2116 */ 2117 bool VRDESettings::areDefaultSettings() const 2118 { 2119 return !fEnabled 2120 && authType == AuthType_Null 2121 && (ulAuthTimeout == 5000 || ulAuthTimeout == 0) 2122 && strAuthLibrary.isEmpty() 2123 && !fAllowMultiConnection 2124 && !fReuseSingleConnection 2125 && strVrdeExtPack.isEmpty() 2126 && mapProperties.size() == 0; 2127 } 2128 2129 /** 1884 2130 * Comparison operator. This gets called from MachineConfigFile::operator==, 1885 2131 * which in turn gets called from Machine::saveSettings to figure out whether … … 1888 2134 bool VRDESettings::operator==(const VRDESettings& v) const 1889 2135 { 1890 return ( (this == &v) 1891 || ( (fEnabled == v.fEnabled) 1892 && (authType == v.authType) 1893 && (ulAuthTimeout == v.ulAuthTimeout) 1894 && (strAuthLibrary == v.strAuthLibrary) 1895 && (fAllowMultiConnection == v.fAllowMultiConnection) 1896 && (fReuseSingleConnection == v.fReuseSingleConnection) 1897 && (strVrdeExtPack == v.strVrdeExtPack) 1898 && (mapProperties == v.mapProperties) 1899 ) 1900 ); 2136 return (this == &v) 2137 || ( fEnabled == v.fEnabled 2138 && authType == v.authType 2139 && ulAuthTimeout == v.ulAuthTimeout 2140 && strAuthLibrary == v.strAuthLibrary 2141 && fAllowMultiConnection == v.fAllowMultiConnection 2142 && fReuseSingleConnection == v.fReuseSingleConnection 2143 && strVrdeExtPack == v.strVrdeExtPack 2144 && mapProperties == v.mapProperties); 2145 } 2146 2147 /** 2148 * Constructor. Needs to set sane defaults which stand the test of time. 2149 */ 2150 BIOSSettings::BIOSSettings() : 2151 fACPIEnabled(true), 2152 fIOAPICEnabled(false), 2153 fLogoFadeIn(true), 2154 fLogoFadeOut(true), 2155 ulLogoDisplayTime(0), 2156 biosBootMenuMode(BIOSBootMenuMode_MessageAndMenu), 2157 fPXEDebugEnabled(false), 2158 llTimeOffset(0) 2159 { 2160 } 2161 2162 /** 2163 * Check if all settings have default values. 2164 */ 2165 bool BIOSSettings::areDefaultSettings() const 2166 { 2167 return fACPIEnabled 2168 && !fIOAPICEnabled 2169 && fLogoFadeIn 2170 && fLogoFadeOut 2171 && ulLogoDisplayTime == 0 2172 && biosBootMenuMode == BIOSBootMenuMode_MessageAndMenu 2173 && !fPXEDebugEnabled 2174 && llTimeOffset == 0; 1901 2175 } 1902 2176 … … 1908 2182 bool BIOSSettings::operator==(const BIOSSettings &d) const 1909 2183 { 1910 return ( (this == &d) 1911 || ( fACPIEnabled == d.fACPIEnabled 1912 && fIOAPICEnabled == d.fIOAPICEnabled 1913 && fLogoFadeIn == d.fLogoFadeIn 1914 && fLogoFadeOut == d.fLogoFadeOut 1915 && ulLogoDisplayTime == d.ulLogoDisplayTime 1916 && strLogoImagePath == d.strLogoImagePath 1917 && biosBootMenuMode == d.biosBootMenuMode 1918 && fPXEDebugEnabled == d.fPXEDebugEnabled 1919 && llTimeOffset == d.llTimeOffset) 1920 ); 2184 return (this == &d) 2185 || ( fACPIEnabled == d.fACPIEnabled 2186 && fIOAPICEnabled == d.fIOAPICEnabled 2187 && fLogoFadeIn == d.fLogoFadeIn 2188 && fLogoFadeOut == d.fLogoFadeOut 2189 && ulLogoDisplayTime == d.ulLogoDisplayTime 2190 && strLogoImagePath == d.strLogoImagePath 2191 && biosBootMenuMode == d.biosBootMenuMode 2192 && fPXEDebugEnabled == d.fPXEDebugEnabled 2193 && llTimeOffset == d.llTimeOffset); 2194 } 2195 2196 /** 2197 * Constructor. Needs to set sane defaults which stand the test of time. 2198 */ 2199 USBController::USBController() : 2200 enmType(USBControllerType_Null) 2201 { 1921 2202 } 1922 2203 … … 1928 2209 bool USBController::operator==(const USBController &u) const 1929 2210 { 1930 return ( (this == &u) 1931 || ( (strName == u.strName) 1932 && (enmType == u.enmType) 1933 ) 1934 ); 2211 return (this == &u) 2212 || ( strName == u.strName 2213 && enmType == u.enmType); 2214 } 2215 2216 /** 2217 * Constructor. Needs to set sane defaults which stand the test of time. 2218 */ 2219 USB::USB() 2220 { 1935 2221 } 1936 2222 … … 1942 2228 bool USB::operator==(const USB &u) const 1943 2229 { 1944 return ( (this == &u) 1945 || ( (llUSBControllers == u.llUSBControllers) 1946 && (llDeviceFilters == u.llDeviceFilters) 1947 ) 1948 ); 2230 return (this == &u) 2231 || ( llUSBControllers == u.llUSBControllers 2232 && llDeviceFilters == u.llDeviceFilters); 2233 } 2234 2235 /** 2236 * Constructor. Needs to set sane defaults which stand the test of time. 2237 */ 2238 NAT::NAT() : 2239 u32Mtu(0), 2240 u32SockRcv(0), 2241 u32SockSnd(0), 2242 u32TcpRcv(0), 2243 u32TcpSnd(0), 2244 fDNSPassDomain(true), /* historically this value is true */ 2245 fDNSProxy(false), 2246 fDNSUseHostResolver(false), 2247 fAliasLog(false), 2248 fAliasProxyOnly(false), 2249 fAliasUseSamePorts(false) 2250 { 2251 } 2252 2253 /** 2254 * Check if all DNS settings have default values. 2255 */ 2256 bool NAT::areDNSDefaultSettings() const 2257 { 2258 return fDNSPassDomain && !fDNSProxy && !fDNSUseHostResolver; 2259 } 2260 2261 /** 2262 * Check if all Alias settings have default values. 2263 */ 2264 bool NAT::areAliasDefaultSettings() const 2265 { 2266 return !fAliasLog && !fAliasProxyOnly && !fAliasUseSamePorts; 2267 } 2268 2269 /** 2270 * Check if all TFTP settings have default values. 2271 */ 2272 bool NAT::areTFTPDefaultSettings() const 2273 { 2274 return strTFTPPrefix.isEmpty() 2275 && strTFTPBootFile.isEmpty() 2276 && strTFTPNextServer.isEmpty(); 2277 } 2278 2279 /** 2280 * Check if all settings have default values. 2281 */ 2282 bool NAT::areDefaultSettings() const 2283 { 2284 return strNetwork.isEmpty() 2285 && strBindIP.isEmpty() 2286 && u32Mtu == 0 2287 && u32SockRcv == 0 2288 && u32SockSnd == 0 2289 && u32TcpRcv == 0 2290 && u32TcpSnd == 0 2291 && areDNSDefaultSettings() 2292 && areAliasDefaultSettings() 2293 && areTFTPDefaultSettings() 2294 && mapRules.size() == 0; 1949 2295 } 1950 2296 … … 1954 2300 * machine settings have really changed and thus need to be written out to disk. 1955 2301 */ 1956 bool NetworkAdapter::operator==(const NetworkAdapter &n) const 1957 { 1958 return ( (this == &n) 1959 || ( (ulSlot == n.ulSlot) 1960 && (type == n.type) 1961 && (fEnabled == n.fEnabled) 1962 && (strMACAddress == n.strMACAddress) 1963 && (fCableConnected == n.fCableConnected) 1964 && (ulLineSpeed == n.ulLineSpeed) 1965 && (enmPromiscModePolicy == n.enmPromiscModePolicy) 1966 && (fTraceEnabled == n.fTraceEnabled) 1967 && (strTraceFile == n.strTraceFile) 1968 && (mode == n.mode) 1969 && (nat == n.nat) 1970 && (strBridgedName == n.strBridgedName) 1971 && (strHostOnlyName == n.strHostOnlyName) 1972 && (strInternalNetworkName == n.strInternalNetworkName) 1973 && (strGenericDriver == n.strGenericDriver) 1974 && (genericProperties == n.genericProperties) 1975 && (ulBootPriority == n.ulBootPriority) 1976 && (strBandwidthGroup == n.strBandwidthGroup) 1977 ) 1978 ); 2302 bool NAT::operator==(const NAT &n) const 2303 { 2304 return (this == &n) 2305 || ( strNetwork == n.strNetwork 2306 && strBindIP == n.strBindIP 2307 && u32Mtu == n.u32Mtu 2308 && u32SockRcv == n.u32SockRcv 2309 && u32SockSnd == n.u32SockSnd 2310 && u32TcpSnd == n.u32TcpSnd 2311 && u32TcpRcv == n.u32TcpRcv 2312 && strTFTPPrefix == n.strTFTPPrefix 2313 && strTFTPBootFile == n.strTFTPBootFile 2314 && strTFTPNextServer == n.strTFTPNextServer 2315 && fDNSPassDomain == n.fDNSPassDomain 2316 && fDNSProxy == n.fDNSProxy 2317 && fDNSUseHostResolver == n.fDNSUseHostResolver 2318 && fAliasLog == n.fAliasLog 2319 && fAliasProxyOnly == n.fAliasProxyOnly 2320 && fAliasUseSamePorts == n.fAliasUseSamePorts 2321 && mapRules == n.mapRules); 2322 } 2323 2324 /** 2325 * Constructor. Needs to set sane defaults which stand the test of time. 2326 */ 2327 NetworkAdapter::NetworkAdapter() : 2328 ulSlot(0), 2329 type(NetworkAdapterType_Am79C973), 2330 fEnabled(false), 2331 fCableConnected(true), 2332 ulLineSpeed(0), 2333 enmPromiscModePolicy(NetworkAdapterPromiscModePolicy_Deny), 2334 fTraceEnabled(false), 2335 mode(NetworkAttachmentType_Null), 2336 ulBootPriority(0) 2337 { 2338 } 2339 2340 /** 2341 * Check if all Generic Driver settings have default values. 2342 */ 2343 bool NetworkAdapter::areGenericDriverDefaultSettings() const 2344 { 2345 return strGenericDriver.isEmpty() 2346 && genericProperties.size() == 0; 2347 } 2348 2349 /** 2350 * Check if all settings have default values. 2351 */ 2352 bool NetworkAdapter::areDefaultSettings() const 2353 { 2354 return !fEnabled 2355 && strMACAddress.isEmpty() 2356 && fCableConnected 2357 && ulLineSpeed == 0 2358 && enmPromiscModePolicy == NetworkAdapterPromiscModePolicy_Deny 2359 && type == NetworkAdapterType_Am79C973 2360 && mode == NetworkAttachmentType_Null 2361 && nat.areDefaultSettings() 2362 && strBridgedName.isEmpty() 2363 && strInternalNetworkName.isEmpty() 2364 && strHostOnlyName.isEmpty() 2365 && areGenericDriverDefaultSettings() 2366 && strNATNetworkName.isEmpty(); 2367 } 2368 2369 /** 2370 * Special check if settings of the non-current attachment type have default values. 2371 */ 2372 bool NetworkAdapter::areDisabledDefaultSettings() const 2373 { 2374 return (mode != NetworkAttachmentType_NAT ? nat.areDefaultSettings() : true) 2375 && (mode != NetworkAttachmentType_Bridged ? strBridgedName.isEmpty() : true) 2376 && (mode != NetworkAttachmentType_Internal ? strInternalNetworkName.isEmpty() : true) 2377 && (mode != NetworkAttachmentType_HostOnly ? strHostOnlyName.isEmpty() : true) 2378 && (mode != NetworkAttachmentType_Generic ? areGenericDriverDefaultSettings() : true) 2379 && (mode != NetworkAttachmentType_NATNetwork ? strNATNetworkName.isEmpty() : true); 1979 2380 } 1980 2381 … … 1984 2385 * machine settings have really changed and thus need to be written out to disk. 1985 2386 */ 1986 bool SerialPort::operator==(const SerialPort &s) const 1987 { 1988 return ( (this == &s) 1989 || ( (ulSlot == s.ulSlot) 1990 && (fEnabled == s.fEnabled) 1991 && (ulIOBase == s.ulIOBase) 1992 && (ulIRQ == s.ulIRQ) 1993 && (portMode == s.portMode) 1994 && (strPath == s.strPath) 1995 && (fServer == s.fServer) 1996 ) 1997 ); 2387 bool NetworkAdapter::operator==(const NetworkAdapter &n) const 2388 { 2389 return (this == &n) 2390 || ( ulSlot == n.ulSlot 2391 && type == n.type 2392 && fEnabled == n.fEnabled 2393 && strMACAddress == n.strMACAddress 2394 && fCableConnected == n.fCableConnected 2395 && ulLineSpeed == n.ulLineSpeed 2396 && enmPromiscModePolicy == n.enmPromiscModePolicy 2397 && fTraceEnabled == n.fTraceEnabled 2398 && strTraceFile == n.strTraceFile 2399 && mode == n.mode 2400 && nat == n.nat 2401 && strBridgedName == n.strBridgedName 2402 && strHostOnlyName == n.strHostOnlyName 2403 && strInternalNetworkName == n.strInternalNetworkName 2404 && strGenericDriver == n.strGenericDriver 2405 && genericProperties == n.genericProperties 2406 && ulBootPriority == n.ulBootPriority 2407 && strBandwidthGroup == n.strBandwidthGroup); 2408 } 2409 2410 /** 2411 * Constructor. Needs to set sane defaults which stand the test of time. 2412 */ 2413 SerialPort::SerialPort() : 2414 ulSlot(0), 2415 fEnabled(false), 2416 ulIOBase(0x3f8), 2417 ulIRQ(4), 2418 portMode(PortMode_Disconnected), 2419 fServer(false) 2420 { 1998 2421 } 1999 2422 … … 2003 2426 * machine settings have really changed and thus need to be written out to disk. 2004 2427 */ 2005 bool ParallelPort::operator==(const ParallelPort &s) const 2006 { 2007 return ( (this == &s) 2008 || ( (ulSlot == s.ulSlot) 2009 && (fEnabled == s.fEnabled) 2010 && (ulIOBase == s.ulIOBase) 2011 && (ulIRQ == s.ulIRQ) 2012 && (strPath == s.strPath) 2013 ) 2014 ); 2428 bool SerialPort::operator==(const SerialPort &s) const 2429 { 2430 return (this == &s) 2431 || ( ulSlot == s.ulSlot 2432 && fEnabled == s.fEnabled 2433 && ulIOBase == s.ulIOBase 2434 && ulIRQ == s.ulIRQ 2435 && portMode == s.portMode 2436 && strPath == s.strPath 2437 && fServer == s.fServer); 2438 } 2439 2440 /** 2441 * Constructor. Needs to set sane defaults which stand the test of time. 2442 */ 2443 ParallelPort::ParallelPort() : 2444 ulSlot(0), 2445 fEnabled(false), 2446 ulIOBase(0x378), 2447 ulIRQ(7) 2448 { 2015 2449 } 2016 2450 … … 2020 2454 * machine settings have really changed and thus need to be written out to disk. 2021 2455 */ 2022 bool SharedFolder::operator==(const SharedFolder &g) const 2023 { 2024 return ( (this == &g) 2025 || ( (strName == g.strName) 2026 && (strHostPath == g.strHostPath) 2027 && (fWritable == g.fWritable) 2028 && (fAutoMount == g.fAutoMount) 2029 ) 2030 ); 2456 bool ParallelPort::operator==(const ParallelPort &s) const 2457 { 2458 return (this == &s) 2459 || ( ulSlot == s.ulSlot 2460 && fEnabled == s.fEnabled 2461 && ulIOBase == s.ulIOBase 2462 && ulIRQ == s.ulIRQ 2463 && strPath == s.strPath); 2464 } 2465 2466 /** 2467 * Constructor. Needs to set sane defaults which stand the test of time. 2468 */ 2469 AudioAdapter::AudioAdapter() : 2470 fEnabled(false), 2471 controllerType(AudioControllerType_AC97), 2472 codecType(AudioCodecType_STAC9700), 2473 driverType(AudioDriverType_Null) 2474 { 2475 } 2476 2477 /** 2478 * Check if all settings have default values. 2479 */ 2480 bool AudioAdapter::areDefaultSettings() const 2481 { 2482 return !fEnabled 2483 && controllerType == AudioControllerType_AC97 2484 && codecType == AudioCodecType_STAC9700 2485 && driverType == MachineConfigFile::getHostDefaultAudioDriver() 2486 && properties.size() == 0; 2031 2487 } 2032 2488 … … 2036 2492 * machine settings have really changed and thus need to be written out to disk. 2037 2493 */ 2494 bool AudioAdapter::operator==(const AudioAdapter &a) const 2495 { 2496 return (this == &a) 2497 || ( fEnabled == a.fEnabled 2498 && controllerType == a.controllerType 2499 && codecType == a.codecType 2500 && driverType == a.driverType 2501 && properties == a.properties); 2502 } 2503 2504 /** 2505 * Constructor. Needs to set sane defaults which stand the test of time. 2506 */ 2507 SharedFolder::SharedFolder() : 2508 fWritable(false), 2509 fAutoMount(false) 2510 { 2511 } 2512 2513 /** 2514 * Comparison operator. This gets called from MachineConfigFile::operator==, 2515 * which in turn gets called from Machine::saveSettings to figure out whether 2516 * machine settings have really changed and thus need to be written out to disk. 2517 */ 2518 bool SharedFolder::operator==(const SharedFolder &g) const 2519 { 2520 return (this == &g) 2521 || ( strName == g.strName 2522 && strHostPath == g.strHostPath 2523 && fWritable == g.fWritable 2524 && fAutoMount == g.fAutoMount); 2525 } 2526 2527 /** 2528 * Constructor. Needs to set sane defaults which stand the test of time. 2529 */ 2530 GuestProperty::GuestProperty() : 2531 timestamp(0) 2532 { 2533 } 2534 2535 /** 2536 * Comparison operator. This gets called from MachineConfigFile::operator==, 2537 * which in turn gets called from Machine::saveSettings to figure out whether 2538 * machine settings have really changed and thus need to be written out to disk. 2539 */ 2038 2540 bool GuestProperty::operator==(const GuestProperty &g) const 2039 2541 { 2040 return ( (this == &g) 2041 || ( (strName == g.strName) 2042 && (strValue == g.strValue) 2043 && (timestamp == g.timestamp) 2044 && (strFlags == g.strFlags) 2045 ) 2046 ); 2047 } 2048 2049 Hardware::Hardware() 2050 : strVersion("1"), 2051 fHardwareVirt(true), 2052 fNestedPaging(true), 2053 fVPID(true), 2054 fUnrestrictedExecution(true), 2055 fHardwareVirtForce(false), 2056 fTripleFaultReset(false), 2057 fPAE(false), 2058 enmLongMode(HC_ARCH_BITS == 64 ? Hardware::LongMode_Enabled : Hardware::LongMode_Disabled), 2059 cCPUs(1), 2060 fCpuHotPlug(false), 2061 fHPETEnabled(false), 2062 ulCpuExecutionCap(100), 2063 uCpuIdPortabilityLevel(0), 2064 strCpuProfile("host"), 2065 ulMemorySizeMB((uint32_t)-1), 2066 graphicsControllerType(GraphicsControllerType_VBoxVGA), 2067 ulVRAMSizeMB(8), 2068 cMonitors(1), 2069 fAccelerate3D(false), 2070 fAccelerate2DVideo(false), 2071 ulVideoCaptureHorzRes(1024), 2072 ulVideoCaptureVertRes(768), 2073 ulVideoCaptureRate(512), 2074 ulVideoCaptureFPS(25), 2075 ulVideoCaptureMaxTime(0), 2076 ulVideoCaptureMaxSize(0), 2077 fVideoCaptureEnabled(false), 2078 u64VideoCaptureScreens(UINT64_C(0xffffffffffffffff)), 2079 strVideoCaptureFile(""), 2080 firmwareType(FirmwareType_BIOS), 2081 pointingHIDType(PointingHIDType_PS2Mouse), 2082 keyboardHIDType(KeyboardHIDType_PS2Keyboard), 2083 chipsetType(ChipsetType_PIIX3), 2084 paravirtProvider(ParavirtProvider_Legacy), 2085 strParavirtDebug(""), 2086 fEmulatedUSBCardReader(false), 2087 clipboardMode(ClipboardMode_Disabled), 2088 dndMode(DnDMode_Disabled), 2089 ulMemoryBalloonSize(0), 2090 fPageFusionEnabled(false) 2542 return (this == &g) 2543 || ( strName == g.strName 2544 && strValue == g.strValue 2545 && timestamp == g.timestamp 2546 && strFlags == g.strFlags); 2547 } 2548 2549 /** 2550 * Constructor. Needs to set sane defaults which stand the test of time. 2551 */ 2552 CpuIdLeaf::CpuIdLeaf() : 2553 ulId(UINT32_MAX), 2554 ulEax(0), 2555 ulEbx(0), 2556 ulEcx(0), 2557 ulEdx(0) 2558 { 2559 } 2560 2561 /** 2562 * Comparison operator. This gets called from MachineConfigFile::operator==, 2563 * which in turn gets called from Machine::saveSettings to figure out whether 2564 * machine settings have really changed and thus need to be written out to disk. 2565 */ 2566 bool CpuIdLeaf::operator==(const CpuIdLeaf &c) const 2567 { 2568 return (this == &c) 2569 || ( ulId == c.ulId 2570 && ulEax == c.ulEax 2571 && ulEbx == c.ulEbx 2572 && ulEcx == c.ulEcx 2573 && ulEdx == c.ulEdx); 2574 } 2575 2576 /** 2577 * Constructor. Needs to set sane defaults which stand the test of time. 2578 */ 2579 Cpu::Cpu() : 2580 ulId(UINT32_MAX) 2581 { 2582 } 2583 2584 /** 2585 * Comparison operator. This gets called from MachineConfigFile::operator==, 2586 * which in turn gets called from Machine::saveSettings to figure out whether 2587 * machine settings have really changed and thus need to be written out to disk. 2588 */ 2589 bool Cpu::operator==(const Cpu &c) const 2590 { 2591 return (this == &c) 2592 || (ulId == c.ulId); 2593 } 2594 2595 /** 2596 * Constructor. Needs to set sane defaults which stand the test of time. 2597 */ 2598 BandwidthGroup::BandwidthGroup() : 2599 cMaxBytesPerSec(0), 2600 enmType(BandwidthGroupType_Null) 2601 { 2602 } 2603 2604 /** 2605 * Comparison operator. This gets called from MachineConfigFile::operator==, 2606 * which in turn gets called from Machine::saveSettings to figure out whether 2607 * machine settings have really changed and thus need to be written out to disk. 2608 */ 2609 bool BandwidthGroup::operator==(const BandwidthGroup &i) const 2610 { 2611 return (this == &i) 2612 || ( strName == i.strName 2613 && cMaxBytesPerSec == i.cMaxBytesPerSec 2614 && enmType == i.enmType); 2615 } 2616 2617 /** 2618 * IOSettings constructor. 2619 */ 2620 IOSettings::IOSettings() : 2621 fIOCacheEnabled(true), 2622 ulIOCacheSize(5) 2623 { 2624 } 2625 2626 /** 2627 * Check if all IO Cache settings have default values. 2628 */ 2629 bool IOSettings::areIOCacheDefaultSettings() const 2630 { 2631 return fIOCacheEnabled 2632 && ulIOCacheSize == 5; 2633 } 2634 2635 /** 2636 * Check if all settings have default values. 2637 */ 2638 bool IOSettings::areDefaultSettings() const 2639 { 2640 return areIOCacheDefaultSettings() 2641 && llBandwidthGroups.size() == 0; 2642 } 2643 2644 /** 2645 * Comparison operator. This gets called from MachineConfigFile::operator==, 2646 * which in turn gets called from Machine::saveSettings to figure out whether 2647 * machine settings have really changed and thus need to be written out to disk. 2648 */ 2649 bool IOSettings::operator==(const IOSettings &i) const 2650 { 2651 return (this == &i) 2652 || ( fIOCacheEnabled == i.fIOCacheEnabled 2653 && ulIOCacheSize == i.ulIOCacheSize 2654 && llBandwidthGroups == i.llBandwidthGroups); 2655 } 2656 2657 /** 2658 * Constructor. Needs to set sane defaults which stand the test of time. 2659 */ 2660 HostPCIDeviceAttachment::HostPCIDeviceAttachment() : 2661 uHostAddress(0), 2662 uGuestAddress(0) 2663 { 2664 } 2665 2666 /** 2667 * Comparison operator. This gets called from MachineConfigFile::operator==, 2668 * which in turn gets called from Machine::saveSettings to figure out whether 2669 * machine settings have really changed and thus need to be written out to disk. 2670 */ 2671 bool HostPCIDeviceAttachment::operator==(const HostPCIDeviceAttachment &a) const 2672 { 2673 return (this == &a) 2674 || ( uHostAddress == a.uHostAddress 2675 && uGuestAddress == a.uGuestAddress 2676 && strDeviceName == a.strDeviceName); 2677 } 2678 2679 2680 /** 2681 * Constructor. Needs to set sane defaults which stand the test of time. 2682 */ 2683 Hardware::Hardware() : 2684 strVersion("1"), 2685 fHardwareVirt(true), 2686 fNestedPaging(true), 2687 fVPID(true), 2688 fUnrestrictedExecution(true), 2689 fHardwareVirtForce(false), 2690 fTripleFaultReset(false), 2691 fPAE(false), 2692 enmLongMode(HC_ARCH_BITS == 64 ? Hardware::LongMode_Enabled : Hardware::LongMode_Disabled), 2693 cCPUs(1), 2694 fCpuHotPlug(false), 2695 fHPETEnabled(false), 2696 ulCpuExecutionCap(100), 2697 uCpuIdPortabilityLevel(0), 2698 strCpuProfile("host"), 2699 ulMemorySizeMB((uint32_t)-1), 2700 graphicsControllerType(GraphicsControllerType_VBoxVGA), 2701 ulVRAMSizeMB(8), 2702 cMonitors(1), 2703 fAccelerate3D(false), 2704 fAccelerate2DVideo(false), 2705 ulVideoCaptureHorzRes(1024), 2706 ulVideoCaptureVertRes(768), 2707 ulVideoCaptureRate(512), 2708 ulVideoCaptureFPS(25), 2709 ulVideoCaptureMaxTime(0), 2710 ulVideoCaptureMaxSize(0), 2711 fVideoCaptureEnabled(false), 2712 u64VideoCaptureScreens(UINT64_C(0xffffffffffffffff)), 2713 strVideoCaptureFile(""), 2714 firmwareType(FirmwareType_BIOS), 2715 pointingHIDType(PointingHIDType_PS2Mouse), 2716 keyboardHIDType(KeyboardHIDType_PS2Keyboard), 2717 chipsetType(ChipsetType_PIIX3), 2718 paravirtProvider(ParavirtProvider_Legacy), // default for old VMs, for new ones it's ParavirtProvider_Default 2719 strParavirtDebug(""), 2720 fEmulatedUSBCardReader(false), 2721 clipboardMode(ClipboardMode_Disabled), 2722 dndMode(DnDMode_Disabled), 2723 ulMemoryBalloonSize(0), 2724 fPageFusionEnabled(false) 2091 2725 { 2092 2726 mapBootOrder[0] = DeviceType_Floppy; … … 2115 2749 2116 2750 /** 2751 * Check if all Paravirt settings have default values. 2752 */ 2753 bool Hardware::areParavirtDefaultSettings() const 2754 { 2755 // Remember, this is the default for VMs created with 5.0, and older 2756 // VMs will keep ParavirtProvider_Legacy which must be saved. 2757 return paravirtProvider == ParavirtProvider_Default 2758 && strParavirtDebug.isEmpty(); 2759 } 2760 2761 /** 2762 * Check if all Boot Order settings have default values. 2763 */ 2764 bool Hardware::areBootOrderDefaultSettings() const 2765 { 2766 BootOrderMap::const_iterator it0 = mapBootOrder.find(0); 2767 BootOrderMap::const_iterator it1 = mapBootOrder.find(1); 2768 BootOrderMap::const_iterator it2 = mapBootOrder.find(2); 2769 BootOrderMap::const_iterator it3 = mapBootOrder.find(3); 2770 return ( mapBootOrder.size() == 3 2771 || ( mapBootOrder.size() == 4 2772 && (it3 != mapBootOrder.end() && it3->second == DeviceType_Null))) 2773 && (it0 != mapBootOrder.end() && it0->second == DeviceType_Floppy) 2774 && (it1 != mapBootOrder.end() && it1->second == DeviceType_DVD) 2775 && (it2 != mapBootOrder.end() && it2->second == DeviceType_HardDisk); 2776 } 2777 2778 /** 2779 * Check if all Display settings have default values. 2780 */ 2781 bool Hardware::areDisplayDefaultSettings() const 2782 { 2783 return graphicsControllerType == GraphicsControllerType_VBoxVGA 2784 && ulVRAMSizeMB == 8 2785 && cMonitors <= 1 2786 && !fAccelerate3D 2787 && !fAccelerate2DVideo; 2788 } 2789 2790 /** 2791 * Check if all Video Capture settings have default values. 2792 */ 2793 bool Hardware::areVideoCaptureDefaultSettings() const 2794 { 2795 return !fVideoCaptureEnabled 2796 && u64VideoCaptureScreens == UINT64_C(0xffffffffffffffff) 2797 && strVideoCaptureFile.isEmpty() 2798 && ulVideoCaptureHorzRes == 1024 2799 && ulVideoCaptureVertRes == 768 2800 && ulVideoCaptureRate == 512 2801 && ulVideoCaptureFPS == 25 2802 && ulVideoCaptureMaxTime == 0 2803 && ulVideoCaptureMaxSize == 0; 2804 } 2805 2806 /** 2807 * Check if all Network Adapter settings have default values. 2808 */ 2809 bool Hardware::areAllNetworkAdaptersDefaultSettings() const 2810 { 2811 for (NetworkAdaptersList::const_iterator it = llNetworkAdapters.begin(); 2812 it != llNetworkAdapters.end(); 2813 ++it) 2814 { 2815 if (!it->areDefaultSettings()) 2816 return false; 2817 } 2818 return true; 2819 } 2820 2821 /** 2117 2822 * Comparison operator. This gets called from MachineConfigFile::operator==, 2118 2823 * which in turn gets called from Machine::saveSettings to figure out whether … … 2121 2826 bool Hardware::operator==(const Hardware& h) const 2122 2827 { 2123 return ( (this == &h) 2124 || ( (strVersion == h.strVersion) 2125 && (uuid == h.uuid) 2126 && (fHardwareVirt == h.fHardwareVirt) 2127 && (fNestedPaging == h.fNestedPaging) 2128 && (fLargePages == h.fLargePages) 2129 && (fVPID == h.fVPID) 2130 && (fUnrestrictedExecution == h.fUnrestrictedExecution) 2131 && (fHardwareVirtForce == h.fHardwareVirtForce) 2132 && (fPAE == h.fPAE) 2133 && (enmLongMode == h.enmLongMode) 2134 && (fTripleFaultReset == h.fTripleFaultReset) 2135 && (cCPUs == h.cCPUs) 2136 && (fCpuHotPlug == h.fCpuHotPlug) 2137 && (ulCpuExecutionCap == h.ulCpuExecutionCap) 2138 && (uCpuIdPortabilityLevel == h.uCpuIdPortabilityLevel) 2139 && strCpuProfile == h.strCpuProfile 2140 && (fHPETEnabled == h.fHPETEnabled) 2141 && (llCpus == h.llCpus) 2142 && (llCpuIdLeafs == h.llCpuIdLeafs) 2143 && (ulMemorySizeMB == h.ulMemorySizeMB) 2144 && (mapBootOrder == h.mapBootOrder) 2145 && (graphicsControllerType == h.graphicsControllerType) 2146 && (ulVRAMSizeMB == h.ulVRAMSizeMB) 2147 && (cMonitors == h.cMonitors) 2148 && (fAccelerate3D == h.fAccelerate3D) 2149 && (fAccelerate2DVideo == h.fAccelerate2DVideo) 2150 && (fVideoCaptureEnabled == h.fVideoCaptureEnabled) 2151 && (u64VideoCaptureScreens == h.u64VideoCaptureScreens) 2152 && (strVideoCaptureFile == h.strVideoCaptureFile) 2153 && (ulVideoCaptureHorzRes == h.ulVideoCaptureHorzRes) 2154 && (ulVideoCaptureVertRes == h.ulVideoCaptureVertRes) 2155 && (ulVideoCaptureRate == h.ulVideoCaptureRate) 2156 && (ulVideoCaptureFPS == h.ulVideoCaptureFPS) 2157 && (ulVideoCaptureMaxTime == h.ulVideoCaptureMaxTime) 2158 && (ulVideoCaptureMaxSize == h.ulVideoCaptureMaxTime) 2159 && (firmwareType == h.firmwareType) 2160 && (pointingHIDType == h.pointingHIDType) 2161 && (keyboardHIDType == h.keyboardHIDType) 2162 && (chipsetType == h.chipsetType) 2163 && (paravirtProvider == h.paravirtProvider) 2164 && (strParavirtDebug == h.strParavirtDebug) 2165 && (fEmulatedUSBCardReader == h.fEmulatedUSBCardReader) 2166 && (vrdeSettings == h.vrdeSettings) 2167 && (biosSettings == h.biosSettings) 2168 && (usbSettings == h.usbSettings) 2169 && (llNetworkAdapters == h.llNetworkAdapters) 2170 && (llSerialPorts == h.llSerialPorts) 2171 && (llParallelPorts == h.llParallelPorts) 2172 && (audioAdapter == h.audioAdapter) 2173 && (llSharedFolders == h.llSharedFolders) 2174 && (clipboardMode == h.clipboardMode) 2175 && (dndMode == h.dndMode) 2176 && (ulMemoryBalloonSize == h.ulMemoryBalloonSize) 2177 && (fPageFusionEnabled == h.fPageFusionEnabled) 2178 && (llGuestProperties == h.llGuestProperties) 2179 && (ioSettings == h.ioSettings) 2180 && (pciAttachments == h.pciAttachments) 2181 && (strDefaultFrontend == h.strDefaultFrontend) 2182 ) 2183 ); 2828 return (this == &h) 2829 || ( strVersion == h.strVersion 2830 && uuid == h.uuid 2831 && fHardwareVirt == h.fHardwareVirt 2832 && fNestedPaging == h.fNestedPaging 2833 && fLargePages == h.fLargePages 2834 && fVPID == h.fVPID 2835 && fUnrestrictedExecution == h.fUnrestrictedExecution 2836 && fHardwareVirtForce == h.fHardwareVirtForce 2837 && fPAE == h.fPAE 2838 && enmLongMode == h.enmLongMode 2839 && fTripleFaultReset == h.fTripleFaultReset 2840 && cCPUs == h.cCPUs 2841 && fCpuHotPlug == h.fCpuHotPlug 2842 && ulCpuExecutionCap == h.ulCpuExecutionCap 2843 && uCpuIdPortabilityLevel == h.uCpuIdPortabilityLevel 2844 && strCpuProfile == h.strCpuProfile 2845 && fHPETEnabled == h.fHPETEnabled 2846 && llCpus == h.llCpus 2847 && llCpuIdLeafs == h.llCpuIdLeafs 2848 && ulMemorySizeMB == h.ulMemorySizeMB 2849 && mapBootOrder == h.mapBootOrder 2850 && graphicsControllerType == h.graphicsControllerType 2851 && ulVRAMSizeMB == h.ulVRAMSizeMB 2852 && cMonitors == h.cMonitors 2853 && fAccelerate3D == h.fAccelerate3D 2854 && fAccelerate2DVideo == h.fAccelerate2DVideo 2855 && fVideoCaptureEnabled == h.fVideoCaptureEnabled 2856 && u64VideoCaptureScreens == h.u64VideoCaptureScreens 2857 && strVideoCaptureFile == h.strVideoCaptureFile 2858 && ulVideoCaptureHorzRes == h.ulVideoCaptureHorzRes 2859 && ulVideoCaptureVertRes == h.ulVideoCaptureVertRes 2860 && ulVideoCaptureRate == h.ulVideoCaptureRate 2861 && ulVideoCaptureFPS == h.ulVideoCaptureFPS 2862 && ulVideoCaptureMaxTime == h.ulVideoCaptureMaxTime 2863 && ulVideoCaptureMaxSize == h.ulVideoCaptureMaxTime 2864 && firmwareType == h.firmwareType 2865 && pointingHIDType == h.pointingHIDType 2866 && keyboardHIDType == h.keyboardHIDType 2867 && chipsetType == h.chipsetType 2868 && paravirtProvider == h.paravirtProvider 2869 && strParavirtDebug == h.strParavirtDebug 2870 && fEmulatedUSBCardReader == h.fEmulatedUSBCardReader 2871 && vrdeSettings == h.vrdeSettings 2872 && biosSettings == h.biosSettings 2873 && usbSettings == h.usbSettings 2874 && llNetworkAdapters == h.llNetworkAdapters 2875 && llSerialPorts == h.llSerialPorts 2876 && llParallelPorts == h.llParallelPorts 2877 && audioAdapter == h.audioAdapter 2878 && storage == h.storage 2879 && llSharedFolders == h.llSharedFolders 2880 && clipboardMode == h.clipboardMode 2881 && dndMode == h.dndMode 2882 && ulMemoryBalloonSize == h.ulMemoryBalloonSize 2883 && fPageFusionEnabled == h.fPageFusionEnabled 2884 && llGuestProperties == h.llGuestProperties 2885 && ioSettings == h.ioSettings 2886 && pciAttachments == h.pciAttachments 2887 && strDefaultFrontend == h.strDefaultFrontend); 2888 } 2889 2890 /** 2891 * Constructor. Needs to set sane defaults which stand the test of time. 2892 */ 2893 AttachedDevice::AttachedDevice() : 2894 deviceType(DeviceType_Null), 2895 fPassThrough(false), 2896 fTempEject(false), 2897 fNonRotational(false), 2898 fDiscard(false), 2899 fHotPluggable(false), 2900 lPort(0), 2901 lDevice(0) 2902 { 2184 2903 } 2185 2904 … … 2191 2910 bool AttachedDevice::operator==(const AttachedDevice &a) const 2192 2911 { 2193 return ( (this == &a) 2194 || ( (deviceType == a.deviceType) 2195 && (fPassThrough == a.fPassThrough) 2196 && (fTempEject == a.fTempEject) 2197 && (fNonRotational == a.fNonRotational) 2198 && (fDiscard == a.fDiscard) 2199 && (fHotPluggable == a.fHotPluggable) 2200 && (lPort == a.lPort) 2201 && (lDevice == a.lDevice) 2202 && (uuid == a.uuid) 2203 && (strHostDriveSrc == a.strHostDriveSrc) 2204 && (strBwGroup == a.strBwGroup) 2205 ) 2206 ); 2912 return (this == &a) 2913 || ( deviceType == a.deviceType 2914 && fPassThrough == a.fPassThrough 2915 && fTempEject == a.fTempEject 2916 && fNonRotational == a.fNonRotational 2917 && fDiscard == a.fDiscard 2918 && fHotPluggable == a.fHotPluggable 2919 && lPort == a.lPort 2920 && lDevice == a.lDevice 2921 && uuid == a.uuid 2922 && strHostDriveSrc == a.strHostDriveSrc 2923 && strBwGroup == a.strBwGroup); 2924 } 2925 2926 /** 2927 * Constructor. Needs to set sane defaults which stand the test of time. 2928 */ 2929 StorageController::StorageController() : 2930 storageBus(StorageBus_IDE), 2931 controllerType(StorageControllerType_PIIX3), 2932 ulPortCount(2), 2933 ulInstance(0), 2934 fUseHostIOCache(true), 2935 fBootable(true) 2936 { 2207 2937 } 2208 2938 … … 2214 2944 bool StorageController::operator==(const StorageController &s) const 2215 2945 { 2216 return ( (this == &s) 2217 || ( (strName == s.strName) 2218 && (storageBus == s.storageBus) 2219 && (controllerType == s.controllerType) 2220 && (ulPortCount == s.ulPortCount) 2221 && (ulInstance == s.ulInstance) 2222 && (fUseHostIOCache == s.fUseHostIOCache) 2223 && (llAttachedDevices == s.llAttachedDevices) 2224 ) 2225 ); 2946 return (this == &s) 2947 || ( strName == s.strName 2948 && storageBus == s.storageBus 2949 && controllerType == s.controllerType 2950 && ulPortCount == s.ulPortCount 2951 && ulInstance == s.ulInstance 2952 && fUseHostIOCache == s.fUseHostIOCache 2953 && llAttachedDevices == s.llAttachedDevices); 2226 2954 } 2227 2955 … … 2233 2961 bool Storage::operator==(const Storage &s) const 2234 2962 { 2235 return ( (this == &s) 2236 || (llStorageControllers == s.llStorageControllers) // deep compare 2237 ); 2963 return (this == &s) 2964 || (llStorageControllers == s.llStorageControllers); // deep compare 2965 } 2966 2967 /** 2968 * Constructor. Needs to set sane defaults which stand the test of time. 2969 */ 2970 Debugging::Debugging() : 2971 fTracingEnabled(false), 2972 fAllowTracingToAccessVM(false), 2973 strTracingConfig() 2974 { 2975 } 2976 2977 /** 2978 * Check if all settings have default values. 2979 */ 2980 bool Debugging::areDefaultSettings() const 2981 { 2982 return !fTracingEnabled 2983 && !fAllowTracingToAccessVM 2984 && strTracingConfig.isEmpty(); 2238 2985 } 2239 2986 … … 2243 2990 * machine settings have really changed and thus need to be written out to disk. 2244 2991 */ 2992 bool Debugging::operator==(const Debugging &d) const 2993 { 2994 return (this == &d) 2995 || ( fTracingEnabled == d.fTracingEnabled 2996 && fAllowTracingToAccessVM == d.fAllowTracingToAccessVM 2997 && strTracingConfig == d.strTracingConfig); 2998 } 2999 3000 /** 3001 * Constructor. Needs to set sane defaults which stand the test of time. 3002 */ 3003 Autostart::Autostart() : 3004 fAutostartEnabled(false), 3005 uAutostartDelay(0), 3006 enmAutostopType(AutostopType_Disabled) 3007 { 3008 } 3009 3010 /** 3011 * Check if all settings have default values. 3012 */ 3013 bool Autostart::areDefaultSettings() const 3014 { 3015 return !fAutostartEnabled 3016 && !uAutostartDelay 3017 && enmAutostopType == AutostopType_Disabled; 3018 } 3019 3020 /** 3021 * Comparison operator. This gets called from MachineConfigFile::operator==, 3022 * which in turn gets called from Machine::saveSettings to figure out whether 3023 * machine settings have really changed and thus need to be written out to disk. 3024 */ 3025 bool Autostart::operator==(const Autostart &a) const 3026 { 3027 return (this == &a) 3028 || ( fAutostartEnabled == a.fAutostartEnabled 3029 && uAutostartDelay == a.uAutostartDelay 3030 && enmAutostopType == a.enmAutostopType); 3031 } 3032 3033 /** 3034 * Constructor. Needs to set sane defaults which stand the test of time. 3035 */ 3036 Snapshot::Snapshot() 3037 { 3038 RTTimeSpecSetNano(×tamp, 0); 3039 } 3040 3041 /** 3042 * Comparison operator. This gets called from MachineConfigFile::operator==, 3043 * which in turn gets called from Machine::saveSettings to figure out whether 3044 * machine settings have really changed and thus need to be written out to disk. 3045 */ 2245 3046 bool Snapshot::operator==(const Snapshot &s) const 2246 3047 { 2247 return ( (this == &s) 2248 || ( (uuid == s.uuid) 2249 && (strName == s.strName) 2250 && (strDescription == s.strDescription) 2251 && (RTTimeSpecIsEqual(×tamp, &s.timestamp)) 2252 && (strStateFile == s.strStateFile) 2253 && (hardware == s.hardware) // deep compare 2254 && (storage == s.storage) // deep compare 2255 && (llChildSnapshots == s.llChildSnapshots) // deep compare 2256 && debugging == s.debugging 2257 && autostart == s.autostart 2258 ) 2259 ); 2260 } 2261 2262 /** 2263 * IOSettings constructor. 2264 */ 2265 IOSettings::IOSettings() 2266 { 2267 fIOCacheEnabled = true; 2268 ulIOCacheSize = 5; 2269 } 3048 return (this == &s) 3049 || ( uuid == s.uuid 3050 && strName == s.strName 3051 && strDescription == s.strDescription 3052 && RTTimeSpecIsEqual(×tamp, &s.timestamp) 3053 && strStateFile == s.strStateFile 3054 && hardware == s.hardware // deep compare 3055 && llChildSnapshots == s.llChildSnapshots // deep compare 3056 && debugging == s.debugging 3057 && autostart == s.autostart); 3058 } 3059 3060 const struct Snapshot settings::Snapshot::Empty; /* default ctor is OK */ 3061 3062 /** 3063 * Constructor. Needs to set sane defaults which stand the test of time. 3064 */ 3065 MachineUserData::MachineUserData() : 3066 fDirectoryIncludesUUID(false), 3067 fNameSync(true), 3068 fTeleporterEnabled(false), 3069 uTeleporterPort(0), 3070 enmFaultToleranceState(FaultToleranceState_Inactive), 3071 uFaultTolerancePort(0), 3072 uFaultToleranceInterval(0), 3073 fRTCUseUTC(false), 3074 strVMPriority("") 3075 { 3076 llGroups.push_back("/"); 3077 } 3078 3079 /** 3080 * Comparison operator. This gets called from MachineConfigFile::operator==, 3081 * which in turn gets called from Machine::saveSettings to figure out whether 3082 * machine settings have really changed and thus need to be written out to disk. 3083 */ 3084 bool MachineUserData::operator==(const MachineUserData &c) const 3085 { 3086 return (this == &c) 3087 || ( strName == c.strName 3088 && fDirectoryIncludesUUID == c.fDirectoryIncludesUUID 3089 && fNameSync == c.fNameSync 3090 && strDescription == c.strDescription 3091 && llGroups == c.llGroups 3092 && strOsType == c.strOsType 3093 && strSnapshotFolder == c.strSnapshotFolder 3094 && fTeleporterEnabled == c.fTeleporterEnabled 3095 && uTeleporterPort == c.uTeleporterPort 3096 && strTeleporterAddress == c.strTeleporterAddress 3097 && strTeleporterPassword == c.strTeleporterPassword 3098 && enmFaultToleranceState == c.enmFaultToleranceState 3099 && uFaultTolerancePort == c.uFaultTolerancePort 3100 && uFaultToleranceInterval == c.uFaultToleranceInterval 3101 && strFaultToleranceAddress == c.strFaultToleranceAddress 3102 && strFaultTolerancePassword == c.strFaultTolerancePassword 3103 && fRTCUseUTC == c.fRTCUseUTC 3104 && ovIcon == c.ovIcon 3105 && strVMPriority == c.strVMPriority); 3106 } 3107 2270 3108 2271 3109 //////////////////////////////////////////////////////////////////////////////// … … 2355 3193 bool MachineConfigFile::operator==(const MachineConfigFile &c) const 2356 3194 { 2357 return ( (this == &c) 2358 || ( (uuid == c.uuid) 2359 && (machineUserData == c.machineUserData) 2360 && (strStateFile == c.strStateFile) 2361 && (uuidCurrentSnapshot == c.uuidCurrentSnapshot) 2362 // skip fCurrentStateModified! 2363 && (RTTimeSpecIsEqual(&timeLastStateChange, &c.timeLastStateChange)) 2364 && (fAborted == c.fAborted) 2365 && (hardwareMachine == c.hardwareMachine) // this one's deep 2366 && (storageMachine == c.storageMachine) // this one's deep 2367 && (mediaRegistry == c.mediaRegistry) // this one's deep 2368 // skip mapExtraDataItems! there is no old state available as it's always forced 2369 && (llFirstSnapshot == c.llFirstSnapshot) // this one's deep 2370 ) 2371 ); 3195 return (this == &c) 3196 || ( uuid == c.uuid 3197 && machineUserData == c.machineUserData 3198 && strStateFile == c.strStateFile 3199 && uuidCurrentSnapshot == c.uuidCurrentSnapshot 3200 // skip fCurrentStateModified! 3201 && RTTimeSpecIsEqual(&timeLastStateChange, &c.timeLastStateChange) 3202 && fAborted == c.fAborted 3203 && hardwareMachine == c.hardwareMachine // this one's deep 3204 && mediaRegistry == c.mediaRegistry // this one's deep 3205 // skip mapExtraDataItems! there is no old state available as it's always forced 3206 && llFirstSnapshot == c.llFirstSnapshot); // this one's deep 2372 3207 } 2373 3208 … … 2713 3548 AudioAdapter &aa) 2714 3549 { 2715 2716 3550 if (m->sv >= SettingsVersion_v1_15) 2717 3551 { … … 2731 3565 } 2732 3566 3567 // Special default handling: tag presence hints it should be enabled 3568 aa.fEnabled = true; 2733 3569 elmAudioAdapter.getAttributeValue("enabled", aa.fEnabled); 2734 3570 … … 2858 3694 */ 2859 3695 void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware, 2860 Hardware &hw, 2861 Storage &strg) 2862 { 3696 Hardware &hw) 3697 { 3698 if (m->sv >= SettingsVersion_v1_15) 3699 hw.paravirtProvider = ParavirtProvider_Default; 2863 3700 if (!elmHardware.getAttributeValue("version", hw.strVersion)) 2864 3701 { … … 3060 3897 } 3061 3898 3062 Utf8Str strDebug; 3063 if (pelmHwChild->getAttributeValue("debug", strDebug)) 3064 hw.strParavirtDebug = strDebug; 3899 pelmHwChild->getAttributeValue("debug", hw.strParavirtDebug); 3065 3900 } 3066 3901 else if (pelmHwChild->nameEquals("HPET")) … … 3282 4117 } 3283 4118 sctl.ulPortCount = 2; 3284 strg.llStorageControllers.push_back(sctl);4119 hw.storage.llStorageControllers.push_back(sctl); 3285 4120 } 3286 4121 } … … 3364 4199 readStorageControllerAttributes(*pelmHwChild, sctl); 3365 4200 3366 strg.llStorageControllers.push_back(sctl);4201 hw.storage.llStorageControllers.push_back(sctl); 3367 4202 } 3368 4203 } … … 3526 4361 } 3527 4362 } 4363 else if (pelmHwChild->nameEquals("StorageControllers")) 4364 readStorageControllers(*pelmHwChild, hw.storage); 3528 4365 } 3529 4366 … … 3996 4833 if (!(pelmHardware = elmSnapshot.findChildElement("Hardware"))) 3997 4834 throw ConfigFileError(this, &elmSnapshot, N_("Required Snapshot/@Hardware element is missing")); 3998 readHardware(*pelmHardware, snap.hardware , snap.storage);4835 readHardware(*pelmHardware, snap.hardware); 3999 4836 4000 4837 xml::NodesLoop nlSnapshotChildren(elmSnapshot); … … 4006 4843 else if ( m->sv < SettingsVersion_v1_7 4007 4844 && pelmSnapshotChild->nameEquals("HardDiskAttachments")) 4008 readHardDiskAttachments_pre1_7(*pelmSnapshotChild, snap. storage);4845 readHardDiskAttachments_pre1_7(*pelmSnapshotChild, snap.hardware.storage); 4009 4846 else if ( m->sv >= SettingsVersion_v1_7 4010 4847 && pelmSnapshotChild->nameEquals("StorageControllers")) 4011 readStorageControllers(*pelmSnapshotChild, snap. storage);4848 readStorageControllers(*pelmSnapshotChild, snap.hardware.storage); 4012 4849 else if (pelmSnapshotChild->nameEquals("Snapshots")) 4013 4850 { … … 4021 4858 // end of the list. XPCOM has very small stack, avoid 4022 4859 // big local variables and use the list element. 4023 snap.llChildSnapshots.push_back( g_SnapshotEmpty);4860 snap.llChildSnapshots.push_back(Snapshot::Empty); 4024 4861 bool found = readSnapshot(curSnapshotUuid, depth + 1, *pelmChildSnapshot, snap.llChildSnapshots.back()); 4025 4862 foundCurrentSnapshot = foundCurrentSnapshot || found; … … 4032 4869 // go through Hardware once more to repair the settings controller structures 4033 4870 // with data from old DVDDrive and FloppyDrive elements 4034 readDVDAndFloppies_pre1_9(*pelmHardware, snap. storage);4871 readDVDAndFloppies_pre1_9(*pelmHardware, snap.hardware.storage); 4035 4872 4036 4873 readDebugging(elmSnapshot.findChildElement("Debugging"), &snap.debugging); … … 4136 4973 elmMachine.getAttributeValue("processPriority", machineUserData.strVMPriority); 4137 4974 4138 elmMachine.getAttributeValue("icon", machineUserData.ovIcon); 4975 elmMachine.getAttributeValue("icon", str); 4976 parseBase64(machineUserData.ovIcon, str); 4139 4977 4140 4978 // parse Hardware before the other elements because other things depend on it … … 4142 4980 if (!(pelmHardware = elmMachine.findChildElement("Hardware"))) 4143 4981 throw ConfigFileError(this, &elmMachine, N_("Required Machine/Hardware element is missing")); 4144 readHardware(*pelmHardware, hardwareMachine , storageMachine);4982 readHardware(*pelmHardware, hardwareMachine); 4145 4983 4146 4984 xml::NodesLoop nlRootChildren(elmMachine); … … 4154 4992 && (pelmMachineChild->nameEquals("HardDiskAttachments")) 4155 4993 ) 4156 readHardDiskAttachments_pre1_7(*pelmMachineChild, storageMachine);4994 readHardDiskAttachments_pre1_7(*pelmMachineChild, hardwareMachine.storage); 4157 4995 else if ( (m->sv >= SettingsVersion_v1_7) 4158 4996 && (pelmMachineChild->nameEquals("StorageControllers")) 4159 4997 ) 4160 readStorageControllers(*pelmMachineChild, storageMachine);4998 readStorageControllers(*pelmMachineChild, hardwareMachine.storage); 4161 4999 else if (pelmMachineChild->nameEquals("Snapshot")) 4162 5000 { … … 4206 5044 // go through Hardware once more to repair the settings controller structures 4207 5045 // with data from old DVDDrive and FloppyDrive elements 4208 readDVDAndFloppies_pre1_9(*pelmHardware, storageMachine);5046 readDVDAndFloppies_pre1_9(*pelmHardware, hardwareMachine.storage); 4209 5047 } 4210 5048 else … … 4216 5054 * keys under that. Called for both the \<Machine\> node and for snapshots. 4217 5055 * @param elmParent 4218 * @param st 5056 * @param hw 5057 * @param fl 5058 * @param pllElementsWithUuidAttributes 4219 5059 */ 4220 5060 void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent, 4221 5061 const Hardware &hw, 4222 const Storage &strg) 5062 uint32_t fl, 5063 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes) 4223 5064 { 4224 5065 xml::ElementNode *pelmHardware = elmParent.createChild("Hardware"); 4225 5066 4226 if (m->sv >= SettingsVersion_v1_4) 5067 if ( m->sv >= SettingsVersion_v1_4 5068 && (m->sv < SettingsVersion_v1_7 ? hw.strVersion != "1" : hw.strVersion != "2")) 4227 5069 pelmHardware->setAttribute("version", hw.strVersion); 4228 5070 … … 4235 5077 xml::ElementNode *pelmCPU = pelmHardware->createChild("CPU"); 4236 5078 4237 xml::ElementNode *pelmHwVirtEx = pelmCPU->createChild("HardwareVirtEx"); 4238 pelmHwVirtEx->setAttribute("enabled", hw.fHardwareVirt); 4239 4240 pelmCPU->createChild("HardwareVirtExNestedPaging")->setAttribute("enabled", hw.fNestedPaging); 4241 pelmCPU->createChild("HardwareVirtExVPID")->setAttribute("enabled", hw.fVPID); 4242 pelmCPU->createChild("HardwareVirtExUX")->setAttribute("enabled", hw.fUnrestrictedExecution); 5079 if (!hw.fHardwareVirt) 5080 pelmCPU->createChild("HardwareVirtEx")->setAttribute("enabled", hw.fHardwareVirt); 5081 if (!hw.fNestedPaging) 5082 pelmCPU->createChild("HardwareVirtExNestedPaging")->setAttribute("enabled", hw.fNestedPaging); 5083 if (!hw.fVPID) 5084 pelmCPU->createChild("HardwareVirtExVPID")->setAttribute("enabled", hw.fVPID); 5085 if (!hw.fUnrestrictedExecution) 5086 pelmCPU->createChild("HardwareVirtExUX")->setAttribute("enabled", hw.fUnrestrictedExecution); 5087 // PAE has too crazy default handling, must always save this setting. 4243 5088 pelmCPU->createChild("PAE")->setAttribute("enabled", hw.fPAE); 4244 5089 if (m->sv >= SettingsVersion_v1_14 && hw.enmLongMode != Hardware::LongMode_Legacy) 5090 { 5091 // LongMode has too crazy default handling, must always save this setting. 4245 5092 pelmCPU->createChild("LongMode")->setAttribute("enabled", hw.enmLongMode == Hardware::LongMode_Enabled); 5093 } 4246 5094 4247 5095 if (hw.fTripleFaultReset) 4248 5096 pelmCPU->createChild("TripleFaultReset")->setAttribute("enabled", hw.fTripleFaultReset); 4249 pelmCPU->setAttribute("count", hw.cCPUs); 5097 if (hw.cCPUs > 1) 5098 pelmCPU->setAttribute("count", hw.cCPUs); 4250 5099 if (hw.ulCpuExecutionCap != 100) 4251 5100 pelmCPU->setAttribute("executionCap", hw.ulCpuExecutionCap); … … 4255 5104 pelmCPU->setAttribute("CpuProfile", hw.strCpuProfile); 4256 5105 4257 / * Always save this setting as we have changed the default in 4.0 (on for large memory 64-bit systems). */5106 // HardwareVirtExLargePages has too crazy default handling, must always save this setting. 4258 5107 pelmCPU->createChild("HardwareVirtExLargePages")->setAttribute("enabled", hw.fLargePages); 4259 5108 4260 5109 if (m->sv >= SettingsVersion_v1_9) 4261 pelmCPU->createChild("HardwareVirtForce")->setAttribute("enabled", hw.fHardwareVirtForce); 5110 { 5111 if (hw.fHardwareVirtForce) 5112 pelmCPU->createChild("HardwareVirtForce")->setAttribute("enabled", hw.fHardwareVirtForce); 5113 } 4262 5114 4263 5115 if (m->sv >= SettingsVersion_v1_10) 4264 5116 { 4265 pelmCPU->setAttribute("hotplug", hw.fCpuHotPlug); 5117 if (hw.fCpuHotPlug) 5118 pelmCPU->setAttribute("hotplug", hw.fCpuHotPlug); 4266 5119 4267 5120 xml::ElementNode *pelmCpuTree = NULL; … … 4302 5155 if (m->sv >= SettingsVersion_v1_10) 4303 5156 { 4304 pelmMemory->setAttribute("PageFusion", hw.fPageFusionEnabled); 5157 if (hw.fPageFusionEnabled) 5158 pelmMemory->setAttribute("PageFusion", hw.fPageFusionEnabled); 4305 5159 } 4306 5160 … … 4309 5163 ) 4310 5164 { 4311 xml::ElementNode *pelmFirmware = pelmHardware->createChild("Firmware");4312 const char *pcszFirmware;4313 4314 switch (hw.firmwareType)4315 {5165 xml::ElementNode *pelmFirmware = pelmHardware->createChild("Firmware"); 5166 const char *pcszFirmware; 5167 5168 switch (hw.firmwareType) 5169 { 4316 5170 case FirmwareType_EFI: pcszFirmware = "EFI"; break; 4317 5171 case FirmwareType_EFI32: pcszFirmware = "EFI32"; break; … … 4319 5173 case FirmwareType_EFIDUAL: pcszFirmware = "EFIDUAL"; break; 4320 5174 default: pcszFirmware = "None"; break; 4321 } 4322 pelmFirmware->setAttribute("type", pcszFirmware); 5175 } 5176 pelmFirmware->setAttribute("type", pcszFirmware); 5177 } 5178 5179 if ( m->sv >= SettingsVersion_v1_10 5180 && ( hw.pointingHIDType != PointingHIDType_PS2Mouse 5181 || hw.keyboardHIDType != KeyboardHIDType_PS2Keyboard)) 5182 { 5183 xml::ElementNode *pelmHID = pelmHardware->createChild("HID"); 5184 const char *pcszHID; 5185 5186 if (hw.pointingHIDType != PointingHIDType_PS2Mouse) 5187 { 5188 switch (hw.pointingHIDType) 5189 { 5190 case PointingHIDType_USBMouse: pcszHID = "USBMouse"; break; 5191 case PointingHIDType_USBTablet: pcszHID = "USBTablet"; break; 5192 case PointingHIDType_PS2Mouse: pcszHID = "PS2Mouse"; break; 5193 case PointingHIDType_ComboMouse: pcszHID = "ComboMouse"; break; 5194 case PointingHIDType_USBMultiTouch: pcszHID = "USBMultiTouch";break; 5195 case PointingHIDType_None: pcszHID = "None"; break; 5196 default: Assert(false); pcszHID = "PS2Mouse"; break; 5197 } 5198 pelmHID->setAttribute("Pointing", pcszHID); 5199 } 5200 5201 if (hw.keyboardHIDType != KeyboardHIDType_PS2Keyboard) 5202 { 5203 switch (hw.keyboardHIDType) 5204 { 5205 case KeyboardHIDType_USBKeyboard: pcszHID = "USBKeyboard"; break; 5206 case KeyboardHIDType_PS2Keyboard: pcszHID = "PS2Keyboard"; break; 5207 case KeyboardHIDType_ComboKeyboard: pcszHID = "ComboKeyboard"; break; 5208 case KeyboardHIDType_None: pcszHID = "None"; break; 5209 default: Assert(false); pcszHID = "PS2Keyboard"; break; 5210 } 5211 pelmHID->setAttribute("Keyboard", pcszHID); 5212 } 4323 5213 } 4324 5214 4325 5215 if ( (m->sv >= SettingsVersion_v1_10) 5216 && hw.fHPETEnabled 4326 5217 ) 4327 5218 { 4328 xml::ElementNode *pelmHID = pelmHardware->createChild("HID"); 4329 const char *pcszHID; 4330 4331 switch (hw.pointingHIDType) 4332 { 4333 case PointingHIDType_USBMouse: pcszHID = "USBMouse"; break; 4334 case PointingHIDType_USBTablet: pcszHID = "USBTablet"; break; 4335 case PointingHIDType_PS2Mouse: pcszHID = "PS2Mouse"; break; 4336 case PointingHIDType_ComboMouse: pcszHID = "ComboMouse"; break; 4337 case PointingHIDType_USBMultiTouch: pcszHID = "USBMultiTouch";break; 4338 case PointingHIDType_None: pcszHID = "None"; break; 4339 default: Assert(false); pcszHID = "PS2Mouse"; break; 4340 } 4341 pelmHID->setAttribute("Pointing", pcszHID); 4342 4343 switch (hw.keyboardHIDType) 4344 { 4345 case KeyboardHIDType_USBKeyboard: pcszHID = "USBKeyboard"; break; 4346 case KeyboardHIDType_PS2Keyboard: pcszHID = "PS2Keyboard"; break; 4347 case KeyboardHIDType_ComboKeyboard: pcszHID = "ComboKeyboard"; break; 4348 case KeyboardHIDType_None: pcszHID = "None"; break; 4349 default: Assert(false); pcszHID = "PS2Keyboard"; break; 4350 } 4351 pelmHID->setAttribute("Keyboard", pcszHID); 4352 } 4353 4354 if ( (m->sv >= SettingsVersion_v1_10) 4355 ) 4356 { 4357 xml::ElementNode *pelmHPET = pelmHardware->createChild("HPET"); 4358 pelmHPET->setAttribute("enabled", hw.fHPETEnabled); 5219 xml::ElementNode *pelmHPET = pelmHardware->createChild("HPET"); 5220 pelmHPET->setAttribute("enabled", hw.fHPETEnabled); 4359 5221 } 4360 5222 … … 4362 5224 ) 4363 5225 { 4364 xml::ElementNode *pelmChipset = pelmHardware->createChild("Chipset"); 4365 const char *pcszChipset; 4366 4367 switch (hw.chipsetType) 4368 { 4369 case ChipsetType_PIIX3: pcszChipset = "PIIX3"; break; 4370 case ChipsetType_ICH9: pcszChipset = "ICH9"; break; 4371 default: Assert(false); pcszChipset = "PIIX3"; break; 4372 } 4373 pelmChipset->setAttribute("type", pcszChipset); 5226 if (hw.chipsetType != ChipsetType_PIIX3) 5227 { 5228 xml::ElementNode *pelmChipset = pelmHardware->createChild("Chipset"); 5229 const char *pcszChipset; 5230 5231 switch (hw.chipsetType) 5232 { 5233 case ChipsetType_PIIX3: pcszChipset = "PIIX3"; break; 5234 case ChipsetType_ICH9: pcszChipset = "ICH9"; break; 5235 default: Assert(false); pcszChipset = "PIIX3"; break; 5236 } 5237 pelmChipset->setAttribute("type", pcszChipset); 5238 } 4374 5239 } 4375 5240 … … 4398 5263 } 4399 5264 4400 xml::ElementNode *pelmBoot = pelmHardware->createChild("Boot"); 4401 for (BootOrderMap::const_iterator it = hw.mapBootOrder.begin(); 4402 it != hw.mapBootOrder.end(); 4403 ++it) 4404 { 4405 uint32_t i = it->first; 4406 DeviceType_T type = it->second; 4407 const char *pcszDevice; 4408 4409 switch (type) 4410 { 4411 case DeviceType_Floppy: pcszDevice = "Floppy"; break; 4412 case DeviceType_DVD: pcszDevice = "DVD"; break; 4413 case DeviceType_HardDisk: pcszDevice = "HardDisk"; break; 4414 case DeviceType_Network: pcszDevice = "Network"; break; 4415 default: /*case DeviceType_Null:*/ pcszDevice = "None"; break; 4416 } 4417 4418 xml::ElementNode *pelmOrder = pelmBoot->createChild("Order"); 4419 pelmOrder->setAttribute("position", 4420 i + 1); // XML is 1-based but internal data is 0-based 4421 pelmOrder->setAttribute("device", pcszDevice); 4422 } 4423 4424 xml::ElementNode *pelmDisplay = pelmHardware->createChild("Display"); 4425 if (hw.graphicsControllerType != GraphicsControllerType_VBoxVGA) 4426 { 4427 const char *pcszGraphics; 4428 switch (hw.graphicsControllerType) 4429 { 4430 case GraphicsControllerType_VBoxVGA: pcszGraphics = "VBoxVGA"; break; 4431 case GraphicsControllerType_VMSVGA: pcszGraphics = "VMSVGA"; break; 4432 default: /*case GraphicsControllerType_Null:*/ pcszGraphics = "None"; break; 4433 } 4434 pelmDisplay->setAttribute("controller", pcszGraphics); 4435 } 4436 pelmDisplay->setAttribute("VRAMSize", hw.ulVRAMSizeMB); 4437 pelmDisplay->setAttribute("monitorCount", hw.cMonitors); 4438 pelmDisplay->setAttribute("accelerate3D", hw.fAccelerate3D); 4439 4440 if (m->sv >= SettingsVersion_v1_8) 4441 pelmDisplay->setAttribute("accelerate2DVideo", hw.fAccelerate2DVideo); 4442 xml::ElementNode *pelmVideoCapture = pelmHardware->createChild("VideoCapture"); 4443 4444 if (m->sv >= SettingsVersion_v1_14) 4445 { 4446 pelmVideoCapture->setAttribute("enabled", hw.fVideoCaptureEnabled); 4447 pelmVideoCapture->setAttribute("screens", hw.u64VideoCaptureScreens); 5265 if (!hw.areBootOrderDefaultSettings()) 5266 { 5267 xml::ElementNode *pelmBoot = pelmHardware->createChild("Boot"); 5268 for (BootOrderMap::const_iterator it = hw.mapBootOrder.begin(); 5269 it != hw.mapBootOrder.end(); 5270 ++it) 5271 { 5272 uint32_t i = it->first; 5273 DeviceType_T type = it->second; 5274 const char *pcszDevice; 5275 5276 switch (type) 5277 { 5278 case DeviceType_Floppy: pcszDevice = "Floppy"; break; 5279 case DeviceType_DVD: pcszDevice = "DVD"; break; 5280 case DeviceType_HardDisk: pcszDevice = "HardDisk"; break; 5281 case DeviceType_Network: pcszDevice = "Network"; break; 5282 default: /*case DeviceType_Null:*/ pcszDevice = "None"; break; 5283 } 5284 5285 xml::ElementNode *pelmOrder = pelmBoot->createChild("Order"); 5286 pelmOrder->setAttribute("position", 5287 i + 1); // XML is 1-based but internal data is 0-based 5288 pelmOrder->setAttribute("device", pcszDevice); 5289 } 5290 } 5291 5292 if (!hw.areDisplayDefaultSettings()) 5293 { 5294 xml::ElementNode *pelmDisplay = pelmHardware->createChild("Display"); 5295 if (hw.graphicsControllerType != GraphicsControllerType_VBoxVGA) 5296 { 5297 const char *pcszGraphics; 5298 switch (hw.graphicsControllerType) 5299 { 5300 case GraphicsControllerType_VBoxVGA: pcszGraphics = "VBoxVGA"; break; 5301 case GraphicsControllerType_VMSVGA: pcszGraphics = "VMSVGA"; break; 5302 default: /*case GraphicsControllerType_Null:*/ pcszGraphics = "None"; break; 5303 } 5304 pelmDisplay->setAttribute("controller", pcszGraphics); 5305 } 5306 if (hw.ulVRAMSizeMB != 8) 5307 pelmDisplay->setAttribute("VRAMSize", hw.ulVRAMSizeMB); 5308 if (hw.cMonitors > 1) 5309 pelmDisplay->setAttribute("monitorCount", hw.cMonitors); 5310 if (hw.fAccelerate3D) 5311 pelmDisplay->setAttribute("accelerate3D", hw.fAccelerate3D); 5312 5313 if (m->sv >= SettingsVersion_v1_8) 5314 { 5315 if (hw.fAccelerate2DVideo) 5316 pelmDisplay->setAttribute("accelerate2DVideo", hw.fAccelerate2DVideo); 5317 } 5318 } 5319 5320 if (m->sv >= SettingsVersion_v1_14 && !hw.areVideoCaptureDefaultSettings()) 5321 { 5322 xml::ElementNode *pelmVideoCapture = pelmHardware->createChild("VideoCapture"); 5323 if (hw.fVideoCaptureEnabled) 5324 pelmVideoCapture->setAttribute("enabled", hw.fVideoCaptureEnabled); 5325 if (hw.u64VideoCaptureScreens != UINT64_C(0xffffffffffffffff)) 5326 pelmVideoCapture->setAttribute("screens", hw.u64VideoCaptureScreens); 4448 5327 if (!hw.strVideoCaptureFile.isEmpty()) 4449 5328 pelmVideoCapture->setAttributePath("file", hw.strVideoCaptureFile); 4450 pelmVideoCapture->setAttribute("horzRes", hw.ulVideoCaptureHorzRes); 4451 pelmVideoCapture->setAttribute("vertRes", hw.ulVideoCaptureVertRes); 4452 pelmVideoCapture->setAttribute("rate", hw.ulVideoCaptureRate); 4453 pelmVideoCapture->setAttribute("fps", hw.ulVideoCaptureFPS); 4454 pelmVideoCapture->setAttribute("maxTime", hw.ulVideoCaptureMaxTime); 4455 pelmVideoCapture->setAttribute("maxSize", hw.ulVideoCaptureMaxSize); 4456 } 4457 4458 xml::ElementNode *pelmVRDE = pelmHardware->createChild("RemoteDisplay"); 4459 pelmVRDE->setAttribute("enabled", hw.vrdeSettings.fEnabled); 4460 if (m->sv < SettingsVersion_v1_11) 4461 { 4462 /* In VBox 4.0 these attributes are replaced with "Properties". */ 4463 Utf8Str strPort; 4464 StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.find("TCP/Ports"); 4465 if (it != hw.vrdeSettings.mapProperties.end()) 4466 strPort = it->second; 4467 if (!strPort.length()) 4468 strPort = "3389"; 4469 pelmVRDE->setAttribute("port", strPort); 4470 4471 Utf8Str strAddress; 4472 it = hw.vrdeSettings.mapProperties.find("TCP/Address"); 4473 if (it != hw.vrdeSettings.mapProperties.end()) 4474 strAddress = it->second; 4475 if (strAddress.length()) 4476 pelmVRDE->setAttribute("netAddress", strAddress); 4477 } 4478 const char *pcszAuthType; 4479 switch (hw.vrdeSettings.authType) 4480 { 4481 case AuthType_Guest: pcszAuthType = "Guest"; break; 4482 case AuthType_External: pcszAuthType = "External"; break; 4483 default: /*case AuthType_Null:*/ pcszAuthType = "Null"; break; 4484 } 4485 pelmVRDE->setAttribute("authType", pcszAuthType); 4486 4487 if (hw.vrdeSettings.ulAuthTimeout != 0) 4488 pelmVRDE->setAttribute("authTimeout", hw.vrdeSettings.ulAuthTimeout); 4489 if (hw.vrdeSettings.fAllowMultiConnection) 4490 pelmVRDE->setAttribute("allowMultiConnection", hw.vrdeSettings.fAllowMultiConnection); 4491 if (hw.vrdeSettings.fReuseSingleConnection) 4492 pelmVRDE->setAttribute("reuseSingleConnection", hw.vrdeSettings.fReuseSingleConnection); 4493 4494 if (m->sv == SettingsVersion_v1_10) 4495 { 4496 xml::ElementNode *pelmVideoChannel = pelmVRDE->createChild("VideoChannel"); 4497 4498 /* In 4.0 videochannel settings were replaced with properties, so look at properties. */ 4499 Utf8Str str; 4500 StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.find("VideoChannel/Enabled"); 4501 if (it != hw.vrdeSettings.mapProperties.end()) 4502 str = it->second; 4503 bool fVideoChannel = RTStrICmp(str.c_str(), "true") == 0 4504 || RTStrCmp(str.c_str(), "1") == 0; 4505 pelmVideoChannel->setAttribute("enabled", fVideoChannel); 4506 4507 it = hw.vrdeSettings.mapProperties.find("VideoChannel/Quality"); 4508 if (it != hw.vrdeSettings.mapProperties.end()) 4509 str = it->second; 4510 uint32_t ulVideoChannelQuality = RTStrToUInt32(str.c_str()); /* This returns 0 on invalid string which is ok. */ 4511 if (ulVideoChannelQuality == 0) 4512 ulVideoChannelQuality = 75; 4513 else 4514 ulVideoChannelQuality = RT_CLAMP(ulVideoChannelQuality, 10, 100); 4515 pelmVideoChannel->setAttribute("quality", ulVideoChannelQuality); 4516 } 4517 if (m->sv >= SettingsVersion_v1_11) 4518 { 4519 if (hw.vrdeSettings.strAuthLibrary.length()) 4520 pelmVRDE->setAttribute("authLibrary", hw.vrdeSettings.strAuthLibrary); 4521 if (hw.vrdeSettings.strVrdeExtPack.isNotEmpty()) 4522 pelmVRDE->setAttribute("VRDEExtPack", hw.vrdeSettings.strVrdeExtPack); 4523 if (hw.vrdeSettings.mapProperties.size() > 0) 4524 { 4525 xml::ElementNode *pelmProperties = pelmVRDE->createChild("VRDEProperties"); 4526 for (StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.begin(); 4527 it != hw.vrdeSettings.mapProperties.end(); 4528 ++it) 4529 { 4530 const Utf8Str &strName = it->first; 4531 const Utf8Str &strValue = it->second; 4532 xml::ElementNode *pelm = pelmProperties->createChild("Property"); 4533 pelm->setAttribute("name", strName); 4534 pelm->setAttribute("value", strValue); 4535 } 4536 } 4537 } 4538 4539 xml::ElementNode *pelmBIOS = pelmHardware->createChild("BIOS"); 4540 pelmBIOS->createChild("ACPI")->setAttribute("enabled", hw.biosSettings.fACPIEnabled); 4541 pelmBIOS->createChild("IOAPIC")->setAttribute("enabled", hw.biosSettings.fIOAPICEnabled); 4542 4543 xml::ElementNode *pelmLogo = pelmBIOS->createChild("Logo"); 4544 pelmLogo->setAttribute("fadeIn", hw.biosSettings.fLogoFadeIn); 4545 pelmLogo->setAttribute("fadeOut", hw.biosSettings.fLogoFadeOut); 4546 pelmLogo->setAttribute("displayTime", hw.biosSettings.ulLogoDisplayTime); 4547 if (hw.biosSettings.strLogoImagePath.length()) 4548 pelmLogo->setAttribute("imagePath", hw.biosSettings.strLogoImagePath); 4549 4550 const char *pcszBootMenu; 4551 switch (hw.biosSettings.biosBootMenuMode) 4552 { 4553 case BIOSBootMenuMode_Disabled: pcszBootMenu = "Disabled"; break; 4554 case BIOSBootMenuMode_MenuOnly: pcszBootMenu = "MenuOnly"; break; 4555 default: /*BIOSBootMenuMode_MessageAndMenu*/ pcszBootMenu = "MessageAndMenu"; break; 4556 } 4557 pelmBIOS->createChild("BootMenu")->setAttribute("mode", pcszBootMenu); 4558 pelmBIOS->createChild("TimeOffset")->setAttribute("value", hw.biosSettings.llTimeOffset); 4559 pelmBIOS->createChild("PXEDebug")->setAttribute("enabled", hw.biosSettings.fPXEDebugEnabled); 5329 if (hw.ulVideoCaptureHorzRes != 1024 || hw.ulVideoCaptureVertRes != 768) 5330 { 5331 pelmVideoCapture->setAttribute("horzRes", hw.ulVideoCaptureHorzRes); 5332 pelmVideoCapture->setAttribute("vertRes", hw.ulVideoCaptureVertRes); 5333 } 5334 if (hw.ulVideoCaptureRate != 512) 5335 pelmVideoCapture->setAttribute("rate", hw.ulVideoCaptureRate); 5336 if (hw.ulVideoCaptureFPS) 5337 pelmVideoCapture->setAttribute("fps", hw.ulVideoCaptureFPS); 5338 if (hw.ulVideoCaptureMaxTime) 5339 pelmVideoCapture->setAttribute("maxTime", hw.ulVideoCaptureMaxTime); 5340 if (hw.ulVideoCaptureMaxSize) 5341 pelmVideoCapture->setAttribute("maxSize", hw.ulVideoCaptureMaxSize); 5342 } 5343 5344 if (!hw.vrdeSettings.areDefaultSettings()) 5345 { 5346 xml::ElementNode *pelmVRDE = pelmHardware->createChild("RemoteDisplay"); 5347 if (hw.vrdeSettings.fEnabled) 5348 pelmVRDE->setAttribute("enabled", hw.vrdeSettings.fEnabled); 5349 if (m->sv < SettingsVersion_v1_11) 5350 { 5351 /* In VBox 4.0 these attributes are replaced with "Properties". */ 5352 Utf8Str strPort; 5353 StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.find("TCP/Ports"); 5354 if (it != hw.vrdeSettings.mapProperties.end()) 5355 strPort = it->second; 5356 if (!strPort.length()) 5357 strPort = "3389"; 5358 pelmVRDE->setAttribute("port", strPort); 5359 5360 Utf8Str strAddress; 5361 it = hw.vrdeSettings.mapProperties.find("TCP/Address"); 5362 if (it != hw.vrdeSettings.mapProperties.end()) 5363 strAddress = it->second; 5364 if (strAddress.length()) 5365 pelmVRDE->setAttribute("netAddress", strAddress); 5366 } 5367 if (hw.vrdeSettings.authType != AuthType_Null) 5368 { 5369 const char *pcszAuthType; 5370 switch (hw.vrdeSettings.authType) 5371 { 5372 case AuthType_Guest: pcszAuthType = "Guest"; break; 5373 case AuthType_External: pcszAuthType = "External"; break; 5374 default: /*case AuthType_Null:*/ pcszAuthType = "Null"; break; 5375 } 5376 pelmVRDE->setAttribute("authType", pcszAuthType); 5377 } 5378 5379 if (hw.vrdeSettings.ulAuthTimeout != 0 && hw.vrdeSettings.ulAuthTimeout != 5000) 5380 pelmVRDE->setAttribute("authTimeout", hw.vrdeSettings.ulAuthTimeout); 5381 if (hw.vrdeSettings.fAllowMultiConnection) 5382 pelmVRDE->setAttribute("allowMultiConnection", hw.vrdeSettings.fAllowMultiConnection); 5383 if (hw.vrdeSettings.fReuseSingleConnection) 5384 pelmVRDE->setAttribute("reuseSingleConnection", hw.vrdeSettings.fReuseSingleConnection); 5385 5386 if (m->sv == SettingsVersion_v1_10) 5387 { 5388 xml::ElementNode *pelmVideoChannel = pelmVRDE->createChild("VideoChannel"); 5389 5390 /* In 4.0 videochannel settings were replaced with properties, so look at properties. */ 5391 Utf8Str str; 5392 StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.find("VideoChannel/Enabled"); 5393 if (it != hw.vrdeSettings.mapProperties.end()) 5394 str = it->second; 5395 bool fVideoChannel = RTStrICmp(str.c_str(), "true") == 0 5396 || RTStrCmp(str.c_str(), "1") == 0; 5397 pelmVideoChannel->setAttribute("enabled", fVideoChannel); 5398 5399 it = hw.vrdeSettings.mapProperties.find("VideoChannel/Quality"); 5400 if (it != hw.vrdeSettings.mapProperties.end()) 5401 str = it->second; 5402 uint32_t ulVideoChannelQuality = RTStrToUInt32(str.c_str()); /* This returns 0 on invalid string which is ok. */ 5403 if (ulVideoChannelQuality == 0) 5404 ulVideoChannelQuality = 75; 5405 else 5406 ulVideoChannelQuality = RT_CLAMP(ulVideoChannelQuality, 10, 100); 5407 pelmVideoChannel->setAttribute("quality", ulVideoChannelQuality); 5408 } 5409 if (m->sv >= SettingsVersion_v1_11) 5410 { 5411 if (hw.vrdeSettings.strAuthLibrary.length()) 5412 pelmVRDE->setAttribute("authLibrary", hw.vrdeSettings.strAuthLibrary); 5413 if (hw.vrdeSettings.strVrdeExtPack.isNotEmpty()) 5414 pelmVRDE->setAttribute("VRDEExtPack", hw.vrdeSettings.strVrdeExtPack); 5415 if (hw.vrdeSettings.mapProperties.size() > 0) 5416 { 5417 xml::ElementNode *pelmProperties = pelmVRDE->createChild("VRDEProperties"); 5418 for (StringsMap::const_iterator it = hw.vrdeSettings.mapProperties.begin(); 5419 it != hw.vrdeSettings.mapProperties.end(); 5420 ++it) 5421 { 5422 const Utf8Str &strName = it->first; 5423 const Utf8Str &strValue = it->second; 5424 xml::ElementNode *pelm = pelmProperties->createChild("Property"); 5425 pelm->setAttribute("name", strName); 5426 pelm->setAttribute("value", strValue); 5427 } 5428 } 5429 } 5430 } 5431 5432 if (!hw.biosSettings.areDefaultSettings()) 5433 { 5434 xml::ElementNode *pelmBIOS = pelmHardware->createChild("BIOS"); 5435 if (!hw.biosSettings.fACPIEnabled) 5436 pelmBIOS->createChild("ACPI")->setAttribute("enabled", hw.biosSettings.fACPIEnabled); 5437 if (hw.biosSettings.fIOAPICEnabled) 5438 pelmBIOS->createChild("IOAPIC")->setAttribute("enabled", hw.biosSettings.fIOAPICEnabled); 5439 5440 if ( !hw.biosSettings.fLogoFadeIn 5441 || !hw.biosSettings.fLogoFadeOut 5442 || hw.biosSettings.ulLogoDisplayTime 5443 || !hw.biosSettings.strLogoImagePath.isEmpty()) 5444 { 5445 xml::ElementNode *pelmLogo = pelmBIOS->createChild("Logo"); 5446 pelmLogo->setAttribute("fadeIn", hw.biosSettings.fLogoFadeIn); 5447 pelmLogo->setAttribute("fadeOut", hw.biosSettings.fLogoFadeOut); 5448 pelmLogo->setAttribute("displayTime", hw.biosSettings.ulLogoDisplayTime); 5449 if (!hw.biosSettings.strLogoImagePath.isEmpty()) 5450 pelmLogo->setAttribute("imagePath", hw.biosSettings.strLogoImagePath); 5451 } 5452 5453 if (hw.biosSettings.biosBootMenuMode != BIOSBootMenuMode_MessageAndMenu) 5454 { 5455 const char *pcszBootMenu; 5456 switch (hw.biosSettings.biosBootMenuMode) 5457 { 5458 case BIOSBootMenuMode_Disabled: pcszBootMenu = "Disabled"; break; 5459 case BIOSBootMenuMode_MenuOnly: pcszBootMenu = "MenuOnly"; break; 5460 default: /*BIOSBootMenuMode_MessageAndMenu*/ pcszBootMenu = "MessageAndMenu"; break; 5461 } 5462 pelmBIOS->createChild("BootMenu")->setAttribute("mode", pcszBootMenu); 5463 } 5464 if (hw.biosSettings.llTimeOffset) 5465 pelmBIOS->createChild("TimeOffset")->setAttribute("value", hw.biosSettings.llTimeOffset); 5466 if (hw.biosSettings.fPXEDebugEnabled) 5467 pelmBIOS->createChild("PXEDebug")->setAttribute("enabled", hw.biosSettings.fPXEDebugEnabled); 5468 } 4560 5469 4561 5470 if (m->sv < SettingsVersion_v1_9) … … 4569 5478 xml::ElementNode *pelmFloppy = pelmHardware->createChild("FloppyDrive"); 4570 5479 4571 for (StorageControllersList::const_iterator it = strg.llStorageControllers.begin();4572 it != strg.llStorageControllers.end();5480 for (StorageControllersList::const_iterator it = hw.storage.llStorageControllers.begin(); 5481 it != hw.storage.llStorageControllers.end(); 4573 5482 ++it) 4574 5483 { … … 4658 5567 else 4659 5568 { 4660 xml::ElementNode *pelmUSB = pelmHardware->createChild("USB"); 4661 xml::ElementNode *pelmCtrls = pelmUSB->createChild("Controllers"); 4662 4663 for (USBControllerList::const_iterator it = hardwareMachine.usbSettings.llUSBControllers.begin(); 4664 it != hardwareMachine.usbSettings.llUSBControllers.end(); 5569 if ( hardwareMachine.usbSettings.llUSBControllers.size() 5570 || hardwareMachine.usbSettings.llDeviceFilters.size()) 5571 { 5572 xml::ElementNode *pelmUSB = pelmHardware->createChild("USB"); 5573 if (hardwareMachine.usbSettings.llUSBControllers.size()) 5574 { 5575 xml::ElementNode *pelmCtrls = pelmUSB->createChild("Controllers"); 5576 5577 for (USBControllerList::const_iterator it = hardwareMachine.usbSettings.llUSBControllers.begin(); 5578 it != hardwareMachine.usbSettings.llUSBControllers.end(); 5579 ++it) 5580 { 5581 const USBController &ctrl = *it; 5582 com::Utf8Str strType; 5583 xml::ElementNode *pelmCtrl = pelmCtrls->createChild("Controller"); 5584 5585 switch (ctrl.enmType) 5586 { 5587 case USBControllerType_OHCI: 5588 strType = "OHCI"; 5589 break; 5590 case USBControllerType_EHCI: 5591 strType = "EHCI"; 5592 break; 5593 case USBControllerType_XHCI: 5594 strType = "XHCI"; 5595 break; 5596 default: 5597 AssertMsgFailed(("Unknown USB controller type %d\n", ctrl.enmType)); 5598 } 5599 5600 pelmCtrl->setAttribute("name", ctrl.strName); 5601 pelmCtrl->setAttribute("type", strType); 5602 } 5603 } 5604 5605 if (hardwareMachine.usbSettings.llDeviceFilters.size()) 5606 { 5607 xml::ElementNode *pelmFilters = pelmUSB->createChild("DeviceFilters"); 5608 buildUSBDeviceFilters(*pelmFilters, hw.usbSettings.llDeviceFilters, false /* fHostMode */); 5609 } 5610 } 5611 } 5612 5613 if ( hw.llNetworkAdapters.size() 5614 && !hw.areAllNetworkAdaptersDefaultSettings()) 5615 { 5616 xml::ElementNode *pelmNetwork = pelmHardware->createChild("Network"); 5617 for (NetworkAdaptersList::const_iterator it = hw.llNetworkAdapters.begin(); 5618 it != hw.llNetworkAdapters.end(); 4665 5619 ++it) 4666 5620 { 4667 const USBController &ctrl = *it; 4668 com::Utf8Str strType; 4669 xml::ElementNode *pelmCtrl = pelmCtrls->createChild("Controller"); 4670 4671 switch (ctrl.enmType) 4672 { 4673 case USBControllerType_OHCI: 4674 strType = "OHCI"; 5621 const NetworkAdapter &nic = *it; 5622 5623 if (!nic.areDefaultSettings()) 5624 { 5625 xml::ElementNode *pelmAdapter = pelmNetwork->createChild("Adapter"); 5626 pelmAdapter->setAttribute("slot", nic.ulSlot); 5627 if (nic.fEnabled) 5628 pelmAdapter->setAttribute("enabled", nic.fEnabled); 5629 if (!nic.strMACAddress.isEmpty()) 5630 pelmAdapter->setAttribute("MACAddress", nic.strMACAddress); 5631 if (!nic.fCableConnected) 5632 pelmAdapter->setAttribute("cable", nic.fCableConnected); 5633 if (nic.ulLineSpeed) 5634 pelmAdapter->setAttribute("speed", nic.ulLineSpeed); 5635 if (nic.ulBootPriority != 0) 5636 pelmAdapter->setAttribute("bootPriority", nic.ulBootPriority); 5637 if (nic.fTraceEnabled) 5638 { 5639 pelmAdapter->setAttribute("trace", nic.fTraceEnabled); 5640 pelmAdapter->setAttribute("tracefile", nic.strTraceFile); 5641 } 5642 if (nic.strBandwidthGroup.isNotEmpty()) 5643 pelmAdapter->setAttribute("bandwidthGroup", nic.strBandwidthGroup); 5644 5645 const char *pszPolicy; 5646 switch (nic.enmPromiscModePolicy) 5647 { 5648 case NetworkAdapterPromiscModePolicy_Deny: pszPolicy = NULL; break; 5649 case NetworkAdapterPromiscModePolicy_AllowNetwork: pszPolicy = "AllowNetwork"; break; 5650 case NetworkAdapterPromiscModePolicy_AllowAll: pszPolicy = "AllowAll"; break; 5651 default: pszPolicy = NULL; AssertFailed(); break; 5652 } 5653 if (pszPolicy) 5654 pelmAdapter->setAttribute("promiscuousModePolicy", pszPolicy); 5655 5656 if (nic.type != NetworkAdapterType_Am79C973) 5657 { 5658 const char *pcszType; 5659 switch (nic.type) 5660 { 5661 case NetworkAdapterType_Am79C973: pcszType = "Am79C973"; break; 5662 case NetworkAdapterType_I82540EM: pcszType = "82540EM"; break; 5663 case NetworkAdapterType_I82543GC: pcszType = "82543GC"; break; 5664 case NetworkAdapterType_I82545EM: pcszType = "82545EM"; break; 5665 case NetworkAdapterType_Virtio: pcszType = "virtio"; break; 5666 default: /*case NetworkAdapterType_Am79C970A:*/ pcszType = "Am79C970A"; break; 5667 } 5668 pelmAdapter->setAttribute("type", pcszType); 5669 } 5670 5671 xml::ElementNode *pelmNAT; 5672 if (m->sv < SettingsVersion_v1_10) 5673 { 5674 switch (nic.mode) 5675 { 5676 case NetworkAttachmentType_NAT: 5677 pelmNAT = pelmAdapter->createChild("NAT"); 5678 if (nic.nat.strNetwork.length()) 5679 pelmNAT->setAttribute("network", nic.nat.strNetwork); 5680 break; 5681 5682 case NetworkAttachmentType_Bridged: 5683 pelmAdapter->createChild("BridgedInterface")->setAttribute("name", nic.strBridgedName); 5684 break; 5685 5686 case NetworkAttachmentType_Internal: 5687 pelmAdapter->createChild("InternalNetwork")->setAttribute("name", nic.strInternalNetworkName); 5688 break; 5689 5690 case NetworkAttachmentType_HostOnly: 5691 pelmAdapter->createChild("HostOnlyInterface")->setAttribute("name", nic.strHostOnlyName); 5692 break; 5693 5694 default: /*case NetworkAttachmentType_Null:*/ 5695 break; 5696 } 5697 } 5698 else 5699 { 5700 /* m->sv >= SettingsVersion_v1_10 */ 5701 if (!nic.areDisabledDefaultSettings()) 5702 { 5703 xml::ElementNode *pelmDisabledNode = pelmAdapter->createChild("DisabledModes"); 5704 if (nic.mode != NetworkAttachmentType_NAT) 5705 buildNetworkXML(NetworkAttachmentType_NAT, *pelmDisabledNode, nic); 5706 if (nic.mode != NetworkAttachmentType_Bridged) 5707 buildNetworkXML(NetworkAttachmentType_Bridged, *pelmDisabledNode, nic); 5708 if (nic.mode != NetworkAttachmentType_Internal) 5709 buildNetworkXML(NetworkAttachmentType_Internal, *pelmDisabledNode, nic); 5710 if (nic.mode != NetworkAttachmentType_HostOnly) 5711 buildNetworkXML(NetworkAttachmentType_HostOnly, *pelmDisabledNode, nic); 5712 if (nic.mode != NetworkAttachmentType_Generic) 5713 buildNetworkXML(NetworkAttachmentType_Generic, *pelmDisabledNode, nic); 5714 if (nic.mode != NetworkAttachmentType_NATNetwork) 5715 buildNetworkXML(NetworkAttachmentType_NATNetwork, *pelmDisabledNode, nic); 5716 } 5717 buildNetworkXML(nic.mode, *pelmAdapter, nic); 5718 } 5719 } 5720 } 5721 } 5722 5723 if (hw.llSerialPorts.size()) 5724 { 5725 xml::ElementNode *pelmPorts = pelmHardware->createChild("UART"); 5726 for (SerialPortsList::const_iterator it = hw.llSerialPorts.begin(); 5727 it != hw.llSerialPorts.end(); 5728 ++it) 5729 { 5730 const SerialPort &port = *it; 5731 xml::ElementNode *pelmPort = pelmPorts->createChild("Port"); 5732 pelmPort->setAttribute("slot", port.ulSlot); 5733 pelmPort->setAttribute("enabled", port.fEnabled); 5734 pelmPort->setAttributeHex("IOBase", port.ulIOBase); 5735 pelmPort->setAttribute("IRQ", port.ulIRQ); 5736 5737 const char *pcszHostMode; 5738 switch (port.portMode) 5739 { 5740 case PortMode_HostPipe: pcszHostMode = "HostPipe"; break; 5741 case PortMode_HostDevice: pcszHostMode = "HostDevice"; break; 5742 case PortMode_TCP: pcszHostMode = "TCP"; break; 5743 case PortMode_RawFile: pcszHostMode = "RawFile"; break; 5744 default: /*case PortMode_Disconnected:*/ pcszHostMode = "Disconnected"; break; 5745 } 5746 switch (port.portMode) 5747 { 5748 case PortMode_TCP: 5749 case PortMode_HostPipe: 5750 pelmPort->setAttribute("server", port.fServer); 5751 /* no break */ 5752 case PortMode_HostDevice: 5753 case PortMode_RawFile: 5754 pelmPort->setAttribute("path", port.strPath); 4675 5755 break; 4676 case USBControllerType_EHCI: 4677 strType = "EHCI";5756 5757 default: 4678 5758 break; 4679 case USBControllerType_XHCI: 4680 strType = "XHCI"; 5759 } 5760 pelmPort->setAttribute("hostMode", pcszHostMode); 5761 } 5762 } 5763 5764 if (hw.llParallelPorts.size()) 5765 { 5766 xml::ElementNode *pelmPorts = pelmHardware->createChild("LPT"); 5767 for (ParallelPortsList::const_iterator it = hw.llParallelPorts.begin(); 5768 it != hw.llParallelPorts.end(); 5769 ++it) 5770 { 5771 const ParallelPort &port = *it; 5772 xml::ElementNode *pelmPort = pelmPorts->createChild("Port"); 5773 pelmPort->setAttribute("slot", port.ulSlot); 5774 pelmPort->setAttribute("enabled", port.fEnabled); 5775 pelmPort->setAttributeHex("IOBase", port.ulIOBase); 5776 pelmPort->setAttribute("IRQ", port.ulIRQ); 5777 if (port.strPath.length()) 5778 pelmPort->setAttribute("path", port.strPath); 5779 } 5780 } 5781 5782 if (!hw.audioAdapter.areDefaultSettings()) 5783 { 5784 xml::ElementNode *pelmAudio = pelmHardware->createChild("AudioAdapter"); 5785 if (hw.audioAdapter.controllerType != AudioControllerType_AC97) 5786 { 5787 const char *pcszController; 5788 switch (hw.audioAdapter.controllerType) 5789 { 5790 case AudioControllerType_SB16: 5791 pcszController = "SB16"; 4681 5792 break; 5793 case AudioControllerType_HDA: 5794 if (m->sv >= SettingsVersion_v1_11) 5795 { 5796 pcszController = "HDA"; 5797 break; 5798 } 5799 /* fall through */ 5800 case AudioControllerType_AC97: 4682 5801 default: 4683 AssertMsgFailed(("Unknown USB controller type %d\n", ctrl.enmType)); 4684 } 4685 4686 pelmCtrl->setAttribute("name", ctrl.strName); 4687 pelmCtrl->setAttribute("type", strType); 4688 } 4689 4690 xml::ElementNode *pelmFilters = pelmUSB->createChild("DeviceFilters"); 4691 buildUSBDeviceFilters(*pelmFilters, hw.usbSettings.llDeviceFilters, false /* fHostMode */); 4692 } 4693 4694 xml::ElementNode *pelmNetwork = pelmHardware->createChild("Network"); 4695 for (NetworkAdaptersList::const_iterator it = hw.llNetworkAdapters.begin(); 4696 it != hw.llNetworkAdapters.end(); 4697 ++it) 4698 { 4699 const NetworkAdapter &nic = *it; 4700 4701 xml::ElementNode *pelmAdapter = pelmNetwork->createChild("Adapter"); 4702 pelmAdapter->setAttribute("slot", nic.ulSlot); 4703 pelmAdapter->setAttribute("enabled", nic.fEnabled); 4704 pelmAdapter->setAttribute("MACAddress", nic.strMACAddress); 4705 pelmAdapter->setAttribute("cable", nic.fCableConnected); 4706 pelmAdapter->setAttribute("speed", nic.ulLineSpeed); 4707 if (nic.ulBootPriority != 0) 4708 { 4709 pelmAdapter->setAttribute("bootPriority", nic.ulBootPriority); 4710 } 4711 if (nic.fTraceEnabled) 4712 { 4713 pelmAdapter->setAttribute("trace", nic.fTraceEnabled); 4714 pelmAdapter->setAttribute("tracefile", nic.strTraceFile); 4715 } 4716 if (nic.strBandwidthGroup.isNotEmpty()) 4717 pelmAdapter->setAttribute("bandwidthGroup", nic.strBandwidthGroup); 4718 4719 const char *pszPolicy; 4720 switch (nic.enmPromiscModePolicy) 4721 { 4722 case NetworkAdapterPromiscModePolicy_Deny: pszPolicy = NULL; break; 4723 case NetworkAdapterPromiscModePolicy_AllowNetwork: pszPolicy = "AllowNetwork"; break; 4724 case NetworkAdapterPromiscModePolicy_AllowAll: pszPolicy = "AllowAll"; break; 4725 default: pszPolicy = NULL; AssertFailed(); break; 4726 } 4727 if (pszPolicy) 4728 pelmAdapter->setAttribute("promiscuousModePolicy", pszPolicy); 4729 4730 const char *pcszType; 4731 switch (nic.type) 4732 { 4733 case NetworkAdapterType_Am79C973: pcszType = "Am79C973"; break; 4734 case NetworkAdapterType_I82540EM: pcszType = "82540EM"; break; 4735 case NetworkAdapterType_I82543GC: pcszType = "82543GC"; break; 4736 case NetworkAdapterType_I82545EM: pcszType = "82545EM"; break; 4737 case NetworkAdapterType_Virtio: pcszType = "virtio"; break; 4738 default: /*case NetworkAdapterType_Am79C970A:*/ pcszType = "Am79C970A"; break; 4739 } 4740 pelmAdapter->setAttribute("type", pcszType); 4741 4742 xml::ElementNode *pelmNAT; 4743 if (m->sv < SettingsVersion_v1_10) 4744 { 4745 switch (nic.mode) 4746 { 4747 case NetworkAttachmentType_NAT: 4748 pelmNAT = pelmAdapter->createChild("NAT"); 4749 if (nic.nat.strNetwork.length()) 4750 pelmNAT->setAttribute("network", nic.nat.strNetwork); 5802 pcszController = "AC97"; 4751 5803 break; 4752 4753 case NetworkAttachmentType_Bridged: 4754 pelmAdapter->createChild("BridgedInterface")->setAttribute("name", nic.strBridgedName); 4755 break; 4756 4757 case NetworkAttachmentType_Internal: 4758 pelmAdapter->createChild("InternalNetwork")->setAttribute("name", nic.strInternalNetworkName); 4759 break; 4760 4761 case NetworkAttachmentType_HostOnly: 4762 pelmAdapter->createChild("HostOnlyInterface")->setAttribute("name", nic.strHostOnlyName); 4763 break; 4764 4765 default: /*case NetworkAttachmentType_Null:*/ 4766 break; 4767 } 4768 } 4769 else 4770 { 4771 /* m->sv >= SettingsVersion_v1_10 */ 4772 xml::ElementNode *pelmDisabledNode = NULL; 4773 pelmDisabledNode = pelmAdapter->createChild("DisabledModes"); 4774 if (nic.mode != NetworkAttachmentType_NAT) 4775 buildNetworkXML(NetworkAttachmentType_NAT, *pelmDisabledNode, false, nic); 4776 if (nic.mode != NetworkAttachmentType_Bridged) 4777 buildNetworkXML(NetworkAttachmentType_Bridged, *pelmDisabledNode, false, nic); 4778 if (nic.mode != NetworkAttachmentType_Internal) 4779 buildNetworkXML(NetworkAttachmentType_Internal, *pelmDisabledNode, false, nic); 4780 if (nic.mode != NetworkAttachmentType_HostOnly) 4781 buildNetworkXML(NetworkAttachmentType_HostOnly, *pelmDisabledNode, false, nic); 4782 if (nic.mode != NetworkAttachmentType_Generic) 4783 buildNetworkXML(NetworkAttachmentType_Generic, *pelmDisabledNode, false, nic); 4784 if (nic.mode != NetworkAttachmentType_NATNetwork) 4785 buildNetworkXML(NetworkAttachmentType_NATNetwork, *pelmDisabledNode, false, nic); 4786 buildNetworkXML(nic.mode, *pelmAdapter, true, nic); 4787 } 4788 } 4789 4790 xml::ElementNode *pelmPorts = pelmHardware->createChild("UART"); 4791 for (SerialPortsList::const_iterator it = hw.llSerialPorts.begin(); 4792 it != hw.llSerialPorts.end(); 4793 ++it) 4794 { 4795 const SerialPort &port = *it; 4796 xml::ElementNode *pelmPort = pelmPorts->createChild("Port"); 4797 pelmPort->setAttribute("slot", port.ulSlot); 4798 pelmPort->setAttribute("enabled", port.fEnabled); 4799 pelmPort->setAttributeHex("IOBase", port.ulIOBase); 4800 pelmPort->setAttribute("IRQ", port.ulIRQ); 4801 4802 const char *pcszHostMode; 4803 switch (port.portMode) 4804 { 4805 case PortMode_HostPipe: pcszHostMode = "HostPipe"; break; 4806 case PortMode_HostDevice: pcszHostMode = "HostDevice"; break; 4807 case PortMode_TCP: pcszHostMode = "TCP"; break; 4808 case PortMode_RawFile: pcszHostMode = "RawFile"; break; 4809 default: /*case PortMode_Disconnected:*/ pcszHostMode = "Disconnected"; break; 4810 } 4811 switch (port.portMode) 4812 { 4813 case PortMode_TCP: 4814 case PortMode_HostPipe: 4815 pelmPort->setAttribute("server", port.fServer); 4816 /* no break */ 4817 case PortMode_HostDevice: 4818 case PortMode_RawFile: 4819 pelmPort->setAttribute("path", port.strPath); 5804 } 5805 pelmAudio->setAttribute("controller", pcszController); 5806 } 5807 5808 const char *pcszCodec; 5809 switch (hw.audioAdapter.codecType) 5810 { 5811 /* Only write out the setting for non-default AC'97 codec 5812 * and leave the rest alone. 5813 */ 5814 #if 0 5815 case AudioCodecType_SB16: 5816 pcszCodec = "SB16"; 4820 5817 break; 4821 5818 case AudioCodecType_STAC9221: 5819 pcszCodec = "STAC9221"; 5820 break; 5821 case AudioCodecType_STAC9700: 5822 pcszCodec = "STAC9700"; 5823 break; 5824 #endif 5825 case AudioCodecType_AD1980: 5826 pcszCodec = "AD1980"; 5827 break; 4822 5828 default: 4823 break; 4824 } 4825 pelmPort->setAttribute("hostMode", pcszHostMode); 4826 } 4827 4828 pelmPorts = pelmHardware->createChild("LPT"); 4829 for (ParallelPortsList::const_iterator it = hw.llParallelPorts.begin(); 4830 it != hw.llParallelPorts.end(); 4831 ++it) 4832 { 4833 const ParallelPort &port = *it; 4834 xml::ElementNode *pelmPort = pelmPorts->createChild("Port"); 4835 pelmPort->setAttribute("slot", port.ulSlot); 4836 pelmPort->setAttribute("enabled", port.fEnabled); 4837 pelmPort->setAttributeHex("IOBase", port.ulIOBase); 4838 pelmPort->setAttribute("IRQ", port.ulIRQ); 4839 if (port.strPath.length()) 4840 pelmPort->setAttribute("path", port.strPath); 4841 } 4842 4843 xml::ElementNode *pelmAudio = pelmHardware->createChild("AudioAdapter"); 4844 const char *pcszController; 4845 switch (hw.audioAdapter.controllerType) 4846 { 4847 case AudioControllerType_SB16: 4848 pcszController = "SB16"; 4849 break; 4850 case AudioControllerType_HDA: 4851 if (m->sv >= SettingsVersion_v1_11) 4852 { 4853 pcszController = "HDA"; 4854 break; 4855 } 4856 /* fall through */ 4857 case AudioControllerType_AC97: 4858 default: 4859 pcszController = "AC97"; 4860 break; 4861 } 4862 pelmAudio->setAttribute("controller", pcszController); 4863 4864 const char *pcszCodec; 4865 switch (hw.audioAdapter.codecType) 4866 { 4867 /* Only write out the setting for non-default AC'97 codec 4868 * and leave the rest alone. 4869 */ 4870 #if 0 4871 case AudioCodecType_SB16: 4872 pcszCodec = "SB16"; 4873 break; 4874 case AudioCodecType_STAC9221: 4875 pcszCodec = "STAC9221"; 4876 break; 4877 case AudioCodecType_STAC9700: 4878 pcszCodec = "STAC9700"; 4879 break; 4880 #endif 4881 case AudioCodecType_AD1980: 4882 pcszCodec = "AD1980"; 4883 break; 4884 default: 4885 /* Don't write out anything if unknown. */ 4886 pcszCodec = NULL; 4887 } 4888 if (pcszCodec) 4889 pelmAudio->setAttribute("codec", pcszCodec); 4890 4891 if (m->sv >= SettingsVersion_v1_10) 5829 /* Don't write out anything if unknown. */ 5830 pcszCodec = NULL; 5831 } 5832 if (pcszCodec) 5833 pelmAudio->setAttribute("codec", pcszCodec); 5834 5835 const char *pcszDriver; 5836 switch (hw.audioAdapter.driverType) 5837 { 5838 case AudioDriverType_WinMM: pcszDriver = "WinMM"; break; 5839 case AudioDriverType_DirectSound: pcszDriver = "DirectSound"; break; 5840 case AudioDriverType_SolAudio: pcszDriver = "SolAudio"; break; 5841 case AudioDriverType_ALSA: pcszDriver = "ALSA"; break; 5842 case AudioDriverType_Pulse: pcszDriver = "Pulse"; break; 5843 case AudioDriverType_OSS: pcszDriver = "OSS"; break; 5844 case AudioDriverType_CoreAudio: pcszDriver = "CoreAudio"; break; 5845 case AudioDriverType_MMPM: pcszDriver = "MMPM"; break; 5846 default: /*case AudioDriverType_Null:*/ pcszDriver = "Null"; break; 5847 } 5848 pelmAudio->setAttribute("driver", pcszDriver); 5849 5850 if (hw.audioAdapter.fEnabled) 5851 pelmAudio->setAttribute("enabled", hw.audioAdapter.fEnabled); 5852 5853 if (m->sv >= SettingsVersion_v1_15 && hw.audioAdapter.properties.size() > 0) 5854 { 5855 for (StringsMap::const_iterator it = hw.audioAdapter.properties.begin(); 5856 it != hw.audioAdapter.properties.end(); 5857 ++it) 5858 { 5859 const Utf8Str &strName = it->first; 5860 const Utf8Str &strValue = it->second; 5861 xml::ElementNode *pelm = pelmAudio->createChild("Property"); 5862 pelm->setAttribute("name", strName); 5863 pelm->setAttribute("value", strValue); 5864 } 5865 } 5866 } 5867 5868 if (m->sv >= SettingsVersion_v1_10 && machineUserData.fRTCUseUTC) 4892 5869 { 4893 5870 xml::ElementNode *pelmRTC = pelmHardware->createChild("RTC"); … … 4895 5872 } 4896 5873 4897 const char *pcszDriver; 4898 switch (hw.audioAdapter.driverType) 4899 { 4900 case AudioDriverType_WinMM: pcszDriver = "WinMM"; break; 4901 case AudioDriverType_DirectSound: pcszDriver = "DirectSound"; break; 4902 case AudioDriverType_SolAudio: pcszDriver = "SolAudio"; break; 4903 case AudioDriverType_ALSA: pcszDriver = "ALSA"; break; 4904 case AudioDriverType_Pulse: pcszDriver = "Pulse"; break; 4905 case AudioDriverType_OSS: pcszDriver = "OSS"; break; 4906 case AudioDriverType_CoreAudio: pcszDriver = "CoreAudio"; break; 4907 case AudioDriverType_MMPM: pcszDriver = "MMPM"; break; 4908 default: /*case AudioDriverType_Null:*/ pcszDriver = "Null"; break; 4909 } 4910 pelmAudio->setAttribute("driver", pcszDriver); 4911 4912 pelmAudio->setAttribute("enabled", hw.audioAdapter.fEnabled); 4913 4914 if (m->sv >= SettingsVersion_v1_15 && hw.audioAdapter.properties.size() > 0) 4915 { 4916 for (StringsMap::const_iterator it = hw.audioAdapter.properties.begin(); 4917 it != hw.audioAdapter.properties.end(); 5874 if (hw.llSharedFolders.size()) 5875 { 5876 xml::ElementNode *pelmSharedFolders = pelmHardware->createChild("SharedFolders"); 5877 for (SharedFoldersList::const_iterator it = hw.llSharedFolders.begin(); 5878 it != hw.llSharedFolders.end(); 4918 5879 ++it) 4919 5880 { 4920 const Utf8Str &strName = it->first; 4921 const Utf8Str &strValue = it->second; 4922 xml::ElementNode *pelm = pelmAudio->createChild("Property"); 4923 pelm->setAttribute("name", strName); 4924 pelm->setAttribute("value", strValue); 4925 } 4926 } 4927 4928 xml::ElementNode *pelmSharedFolders = pelmHardware->createChild("SharedFolders"); 4929 for (SharedFoldersList::const_iterator it = hw.llSharedFolders.begin(); 4930 it != hw.llSharedFolders.end(); 4931 ++it) 4932 { 4933 const SharedFolder &sf = *it; 4934 xml::ElementNode *pelmThis = pelmSharedFolders->createChild("SharedFolder"); 4935 pelmThis->setAttribute("name", sf.strName); 4936 pelmThis->setAttribute("hostPath", sf.strHostPath); 4937 pelmThis->setAttribute("writable", sf.fWritable); 4938 pelmThis->setAttribute("autoMount", sf.fAutoMount); 4939 } 4940 4941 xml::ElementNode *pelmClip = pelmHardware->createChild("Clipboard"); 4942 const char *pcszClip; 4943 switch (hw.clipboardMode) 4944 { 4945 default: /*case ClipboardMode_Disabled:*/ pcszClip = "Disabled"; break; 4946 case ClipboardMode_HostToGuest: pcszClip = "HostToGuest"; break; 4947 case ClipboardMode_GuestToHost: pcszClip = "GuestToHost"; break; 4948 case ClipboardMode_Bidirectional: pcszClip = "Bidirectional"; break; 4949 } 4950 pelmClip->setAttribute("mode", pcszClip); 4951 4952 xml::ElementNode *pelmDragAndDrop = pelmHardware->createChild("DragAndDrop"); 4953 const char *pcszDragAndDrop; 4954 switch (hw.dndMode) 4955 { 4956 default: /*case DnDMode_Disabled:*/ pcszDragAndDrop = "Disabled"; break; 4957 case DnDMode_HostToGuest: pcszDragAndDrop = "HostToGuest"; break; 4958 case DnDMode_GuestToHost: pcszDragAndDrop = "GuestToHost"; break; 4959 case DnDMode_Bidirectional: pcszDragAndDrop = "Bidirectional"; break; 4960 } 4961 pelmDragAndDrop->setAttribute("mode", pcszDragAndDrop); 4962 4963 if (m->sv >= SettingsVersion_v1_10) 5881 const SharedFolder &sf = *it; 5882 xml::ElementNode *pelmThis = pelmSharedFolders->createChild("SharedFolder"); 5883 pelmThis->setAttribute("name", sf.strName); 5884 pelmThis->setAttribute("hostPath", sf.strHostPath); 5885 pelmThis->setAttribute("writable", sf.fWritable); 5886 pelmThis->setAttribute("autoMount", sf.fAutoMount); 5887 } 5888 } 5889 5890 if (hw.clipboardMode != ClipboardMode_Disabled) 5891 { 5892 xml::ElementNode *pelmClip = pelmHardware->createChild("Clipboard"); 5893 const char *pcszClip; 5894 switch (hw.clipboardMode) 5895 { 5896 default: /*case ClipboardMode_Disabled:*/ pcszClip = "Disabled"; break; 5897 case ClipboardMode_HostToGuest: pcszClip = "HostToGuest"; break; 5898 case ClipboardMode_GuestToHost: pcszClip = "GuestToHost"; break; 5899 case ClipboardMode_Bidirectional: pcszClip = "Bidirectional"; break; 5900 } 5901 pelmClip->setAttribute("mode", pcszClip); 5902 } 5903 5904 if (hw.dndMode != DnDMode_Disabled) 5905 { 5906 xml::ElementNode *pelmDragAndDrop = pelmHardware->createChild("DragAndDrop"); 5907 const char *pcszDragAndDrop; 5908 switch (hw.dndMode) 5909 { 5910 default: /*case DnDMode_Disabled:*/ pcszDragAndDrop = "Disabled"; break; 5911 case DnDMode_HostToGuest: pcszDragAndDrop = "HostToGuest"; break; 5912 case DnDMode_GuestToHost: pcszDragAndDrop = "GuestToHost"; break; 5913 case DnDMode_Bidirectional: pcszDragAndDrop = "Bidirectional"; break; 5914 } 5915 pelmDragAndDrop->setAttribute("mode", pcszDragAndDrop); 5916 } 5917 5918 if ( m->sv >= SettingsVersion_v1_10 5919 && !hw.ioSettings.areDefaultSettings()) 4964 5920 { 4965 5921 xml::ElementNode *pelmIO = pelmHardware->createChild("IO"); 4966 5922 xml::ElementNode *pelmIOCache; 4967 5923 4968 pelmIOCache = pelmIO->createChild("IoCache"); 4969 pelmIOCache->setAttribute("enabled", hw.ioSettings.fIOCacheEnabled); 4970 pelmIOCache->setAttribute("size", hw.ioSettings.ulIOCacheSize); 4971 4972 if (m->sv >= SettingsVersion_v1_11) 5924 if (!hw.ioSettings.areDefaultSettings()) 5925 { 5926 pelmIOCache = pelmIO->createChild("IoCache"); 5927 if (!hw.ioSettings.fIOCacheEnabled) 5928 pelmIOCache->setAttribute("enabled", hw.ioSettings.fIOCacheEnabled); 5929 if (hw.ioSettings.ulIOCacheSize != 5) 5930 pelmIOCache->setAttribute("size", hw.ioSettings.ulIOCacheSize); 5931 } 5932 5933 if ( m->sv >= SettingsVersion_v1_11 5934 && hw.ioSettings.llBandwidthGroups.size()) 4973 5935 { 4974 5936 xml::ElementNode *pelmBandwidthGroups = pelmIO->createChild("BandwidthGroups"); … … 4995 5957 } 4996 5958 4997 if (m->sv >= SettingsVersion_v1_12) 5959 if ( m->sv >= SettingsVersion_v1_12 5960 && hw.pciAttachments.size()) 4998 5961 { 4999 5962 xml::ElementNode *pelmPCI = pelmHardware->createChild("HostPci"); … … 5014 5977 } 5015 5978 5016 if (m->sv >= SettingsVersion_v1_12) 5979 if ( m->sv >= SettingsVersion_v1_12 5980 && hw.fEmulatedUSBCardReader) 5017 5981 { 5018 5982 xml::ElementNode *pelmEmulatedUSB = pelmHardware->createChild("EmulatedUSB"); … … 5030 5994 } 5031 5995 5032 xml::ElementNode *pelmGuest = pelmHardware->createChild("Guest"); 5033 pelmGuest->setAttribute("memoryBalloonSize", hw.ulMemoryBalloonSize); 5034 5035 xml::ElementNode *pelmGuestProps = pelmHardware->createChild("GuestProperties"); 5036 for (GuestPropertiesList::const_iterator it = hw.llGuestProperties.begin(); 5037 it != hw.llGuestProperties.end(); 5038 ++it) 5039 { 5040 const GuestProperty &prop = *it; 5041 xml::ElementNode *pelmProp = pelmGuestProps->createChild("GuestProperty"); 5042 pelmProp->setAttribute("name", prop.strName); 5043 pelmProp->setAttribute("value", prop.strValue); 5044 pelmProp->setAttribute("timestamp", prop.timestamp); 5045 pelmProp->setAttribute("flags", prop.strFlags); 5046 } 5996 if (hw.ulMemoryBalloonSize) 5997 { 5998 xml::ElementNode *pelmGuest = pelmHardware->createChild("Guest"); 5999 pelmGuest->setAttribute("memoryBalloonSize", hw.ulMemoryBalloonSize); 6000 } 6001 6002 if (hw.llGuestProperties.size()) 6003 { 6004 xml::ElementNode *pelmGuestProps = pelmHardware->createChild("GuestProperties"); 6005 for (GuestPropertiesList::const_iterator it = hw.llGuestProperties.begin(); 6006 it != hw.llGuestProperties.end(); 6007 ++it) 6008 { 6009 const GuestProperty &prop = *it; 6010 xml::ElementNode *pelmProp = pelmGuestProps->createChild("GuestProperty"); 6011 pelmProp->setAttribute("name", prop.strName); 6012 pelmProp->setAttribute("value", prop.strValue); 6013 pelmProp->setAttribute("timestamp", prop.timestamp); 6014 pelmProp->setAttribute("flags", prop.strFlags); 6015 } 6016 } 6017 6018 /** @todo In the future (6.0?) place the storage controllers under <Hardware>, because 6019 * this is where it always should've been. What else than hardware are they? */ 6020 xml::ElementNode &elmStorageParent = (m->sv > SettingsVersion_Future) ? *pelmHardware : elmParent; 6021 buildStorageControllersXML(elmStorageParent, 6022 hardwareMachine.storage, 6023 !!(fl & BuildMachineXML_SkipRemovableMedia), 6024 pllElementsWithUuidAttributes); 5047 6025 } 5048 6026 … … 5056 6034 void MachineConfigFile::buildNetworkXML(NetworkAttachmentType_T mode, 5057 6035 xml::ElementNode &elmParent, 5058 bool fEnabled,5059 6036 const NetworkAdapter &nic) 5060 6037 { … … 5062 6039 { 5063 6040 case NetworkAttachmentType_NAT: 5064 xml::ElementNode *pelmNAT; 5065 pelmNAT = elmParent.createChild("NAT"); 5066 5067 if (nic.nat.strNetwork.length()) 5068 pelmNAT->setAttribute("network", nic.nat.strNetwork); 5069 if (nic.nat.strBindIP.length()) 5070 pelmNAT->setAttribute("hostip", nic.nat.strBindIP); 5071 if (nic.nat.u32Mtu) 5072 pelmNAT->setAttribute("mtu", nic.nat.u32Mtu); 5073 if (nic.nat.u32SockRcv) 5074 pelmNAT->setAttribute("sockrcv", nic.nat.u32SockRcv); 5075 if (nic.nat.u32SockSnd) 5076 pelmNAT->setAttribute("socksnd", nic.nat.u32SockSnd); 5077 if (nic.nat.u32TcpRcv) 5078 pelmNAT->setAttribute("tcprcv", nic.nat.u32TcpRcv); 5079 if (nic.nat.u32TcpSnd) 5080 pelmNAT->setAttribute("tcpsnd", nic.nat.u32TcpSnd); 5081 xml::ElementNode *pelmDNS; 5082 pelmDNS = pelmNAT->createChild("DNS"); 5083 pelmDNS->setAttribute("pass-domain", nic.nat.fDNSPassDomain); 5084 pelmDNS->setAttribute("use-proxy", nic.nat.fDNSProxy); 5085 pelmDNS->setAttribute("use-host-resolver", nic.nat.fDNSUseHostResolver); 5086 5087 xml::ElementNode *pelmAlias; 5088 pelmAlias = pelmNAT->createChild("Alias"); 5089 pelmAlias->setAttribute("logging", nic.nat.fAliasLog); 5090 pelmAlias->setAttribute("proxy-only", nic.nat.fAliasProxyOnly); 5091 pelmAlias->setAttribute("use-same-ports", nic.nat.fAliasUseSamePorts); 5092 5093 if ( nic.nat.strTFTPPrefix.length() 5094 || nic.nat.strTFTPBootFile.length() 5095 || nic.nat.strTFTPNextServer.length()) 5096 { 5097 xml::ElementNode *pelmTFTP; 5098 pelmTFTP = pelmNAT->createChild("TFTP"); 5099 if (nic.nat.strTFTPPrefix.length()) 5100 pelmTFTP->setAttribute("prefix", nic.nat.strTFTPPrefix); 5101 if (nic.nat.strTFTPBootFile.length()) 5102 pelmTFTP->setAttribute("boot-file", nic.nat.strTFTPBootFile); 5103 if (nic.nat.strTFTPNextServer.length()) 5104 pelmTFTP->setAttribute("next-server", nic.nat.strTFTPNextServer); 5105 } 5106 buildNATForwardRulesMap(*pelmNAT, nic.nat.mapRules); 6041 if (!nic.nat.areDefaultSettings()) 6042 { 6043 xml::ElementNode *pelmNAT = elmParent.createChild("NAT"); 6044 6045 if (nic.nat.strNetwork.length()) 6046 pelmNAT->setAttribute("network", nic.nat.strNetwork); 6047 if (nic.nat.strBindIP.length()) 6048 pelmNAT->setAttribute("hostip", nic.nat.strBindIP); 6049 if (nic.nat.u32Mtu) 6050 pelmNAT->setAttribute("mtu", nic.nat.u32Mtu); 6051 if (nic.nat.u32SockRcv) 6052 pelmNAT->setAttribute("sockrcv", nic.nat.u32SockRcv); 6053 if (nic.nat.u32SockSnd) 6054 pelmNAT->setAttribute("socksnd", nic.nat.u32SockSnd); 6055 if (nic.nat.u32TcpRcv) 6056 pelmNAT->setAttribute("tcprcv", nic.nat.u32TcpRcv); 6057 if (nic.nat.u32TcpSnd) 6058 pelmNAT->setAttribute("tcpsnd", nic.nat.u32TcpSnd); 6059 if (!nic.nat.areDNSDefaultSettings()) 6060 { 6061 xml::ElementNode *pelmDNS = pelmNAT->createChild("DNS"); 6062 if (!nic.nat.fDNSPassDomain) 6063 pelmDNS->setAttribute("pass-domain", nic.nat.fDNSPassDomain); 6064 if (nic.nat.fDNSProxy) 6065 pelmDNS->setAttribute("use-proxy", nic.nat.fDNSProxy); 6066 if (nic.nat.fDNSUseHostResolver) 6067 pelmDNS->setAttribute("use-host-resolver", nic.nat.fDNSUseHostResolver); 6068 } 6069 6070 if (!nic.nat.areAliasDefaultSettings()) 6071 { 6072 xml::ElementNode *pelmAlias = pelmNAT->createChild("Alias"); 6073 if (nic.nat.fAliasLog) 6074 pelmAlias->setAttribute("logging", nic.nat.fAliasLog); 6075 if (nic.nat.fAliasProxyOnly) 6076 pelmAlias->setAttribute("proxy-only", nic.nat.fAliasProxyOnly); 6077 if (nic.nat.fAliasUseSamePorts) 6078 pelmAlias->setAttribute("use-same-ports", nic.nat.fAliasUseSamePorts); 6079 } 6080 6081 if (!nic.nat.areTFTPDefaultSettings()) 6082 { 6083 xml::ElementNode *pelmTFTP; 6084 pelmTFTP = pelmNAT->createChild("TFTP"); 6085 if (nic.nat.strTFTPPrefix.length()) 6086 pelmTFTP->setAttribute("prefix", nic.nat.strTFTPPrefix); 6087 if (nic.nat.strTFTPBootFile.length()) 6088 pelmTFTP->setAttribute("boot-file", nic.nat.strTFTPBootFile); 6089 if (nic.nat.strTFTPNextServer.length()) 6090 pelmTFTP->setAttribute("next-server", nic.nat.strTFTPNextServer); 6091 } 6092 buildNATForwardRulesMap(*pelmNAT, nic.nat.mapRules); 6093 } 5107 6094 break; 5108 6095 5109 6096 case NetworkAttachmentType_Bridged: 5110 if ( fEnabled ||!nic.strBridgedName.isEmpty())6097 if (!nic.strBridgedName.isEmpty()) 5111 6098 elmParent.createChild("BridgedInterface")->setAttribute("name", nic.strBridgedName); 5112 6099 break; 5113 6100 5114 6101 case NetworkAttachmentType_Internal: 5115 if ( fEnabled ||!nic.strInternalNetworkName.isEmpty())6102 if (!nic.strInternalNetworkName.isEmpty()) 5116 6103 elmParent.createChild("InternalNetwork")->setAttribute("name", nic.strInternalNetworkName); 5117 6104 break; 5118 6105 5119 6106 case NetworkAttachmentType_HostOnly: 5120 if ( fEnabled ||!nic.strHostOnlyName.isEmpty())6107 if (!nic.strHostOnlyName.isEmpty()) 5121 6108 elmParent.createChild("HostOnlyInterface")->setAttribute("name", nic.strHostOnlyName); 5122 6109 break; 5123 6110 5124 6111 case NetworkAttachmentType_Generic: 5125 if ( fEnabled || !nic.strGenericDriver.isEmpty() || nic.genericProperties.size())6112 if (!nic.areGenericDriverDefaultSettings()) 5126 6113 { 5127 6114 xml::ElementNode *pelmMode = elmParent.createChild("GenericInterface"); … … 5139 6126 5140 6127 case NetworkAttachmentType_NATNetwork: 5141 if ( fEnabled ||!nic.strNATNetworkName.isEmpty())6128 if (!nic.strNATNetworkName.isEmpty()) 5142 6129 elmParent.createChild("NATNetwork")->setAttribute("name", nic.strNATNetworkName); 5143 6130 break; … … 5167 6154 std::list<xml::ElementNode*> *pllElementsWithUuidAttributes) 5168 6155 { 6156 if (!st.llStorageControllers.size()) 6157 return; 5169 6158 xml::ElementNode *pelmStorageControllers = elmParent.createChild("StorageControllers"); 5170 6159 … … 5407 6396 pelmSnapshot->createChild("Description")->addContent(snap.strDescription); 5408 6397 5409 buildHardwareXML(*pelmSnapshot, snap.hardware, snap.storage); 5410 buildStorageControllersXML(*pelmSnapshot, 5411 snap.storage, 5412 false /* fSkipRemovableMedia */, 5413 NULL); /* pllElementsWithUuidAttributes */ 5414 // we only skip removable media for OVF, but we never get here for OVF 5415 // since snapshots never get written then 6398 // We only skip removable media for OVF, but OVF never includes snapshots. 6399 buildHardwareXML(*pelmSnapshot, snap.hardware, 0 /* fl */, NULL /* pllElementsWithUuidAttributes */); 5416 6400 buildDebuggingXML(pelmSnapshot, &snap.debugging); 5417 6401 buildAutostartXML(pelmSnapshot, &snap.autostart); … … 5513 6497 // Please keep the icon last so that one doesn't have to check if there 5514 6498 // is anything in the line after this very long attribute in the XML. 5515 if (machineUserData.ovIcon.length()) 5516 elmMachine.setAttribute("icon", machineUserData.ovIcon); 6499 if (machineUserData.ovIcon.size()) 6500 { 6501 Utf8Str strIcon; 6502 toBase64(strIcon, machineUserData.ovIcon); 6503 elmMachine.setAttribute("icon", strIcon); 6504 } 5517 6505 if ( m->sv >= SettingsVersion_v1_9 5518 6506 && ( machineUserData.fTeleporterEnabled … … 5569 6557 buildSnapshotXML(1, elmMachine, llFirstSnapshot.front()); 5570 6558 5571 buildHardwareXML(elmMachine, hardwareMachine, storageMachine); 5572 buildStorageControllersXML(elmMachine, 5573 storageMachine, 5574 !!(fl & BuildMachineXML_SkipRemovableMedia), 5575 pllElementsWithUuidAttributes); 6559 buildHardwareXML(elmMachine, hardwareMachine, fl, pllElementsWithUuidAttributes); 5576 6560 buildDebuggingXML(&elmMachine, &debugging); 5577 6561 buildAutostartXML(&elmMachine, &autostart); … … 5704 6688 } 5705 6689 5706 for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();5707 it != storageMachine.llStorageControllers.end();6690 for (StorageControllersList::const_iterator it = hardwareMachine.storage.llStorageControllers.begin(); 6691 it != hardwareMachine.storage.llStorageControllers.end(); 5708 6692 ++it) 5709 6693 { … … 5741 6725 * Also check if there are USB storage controllers. 5742 6726 */ 5743 for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();5744 it != storageMachine.llStorageControllers.end();6727 for (StorageControllersList::const_iterator it = hardwareMachine.storage.llStorageControllers.begin(); 6728 it != hardwareMachine.storage.llStorageControllers.end(); 5745 6729 ++it) 5746 6730 { … … 5808 6792 || hardwareMachine.graphicsControllerType != GraphicsControllerType_VBoxVGA 5809 6793 || hardwareMachine.enmLongMode != Hardware::LongMode_Legacy 5810 || machineUserData.ovIcon. length() > 06794 || machineUserData.ovIcon.size() > 0 5811 6795 || hardwareMachine.fVideoCaptureEnabled) 5812 6796 { … … 5912 6896 if ( netit->enmPromiscModePolicy != NetworkAdapterPromiscModePolicy_Deny 5913 6897 || netit->mode == NetworkAttachmentType_Generic 5914 || !netit->strGenericDriver.isEmpty() 5915 || netit->genericProperties.size() 6898 || !netit->areGenericDriverDefaultSettings() 5916 6899 ) 5917 6900 { … … 6010 6993 6011 6994 // need to run thru all the storage controllers and attached devices to figure this out 6012 for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();6013 it != storageMachine.llStorageControllers.end();6995 for (StorageControllersList::const_iterator it = hardwareMachine.storage.llStorageControllers.begin(); 6996 it != hardwareMachine.storage.llStorageControllers.end(); 6014 6997 ++it) 6015 6998 { -
trunk/src/VBox/Main/xml/VirtualBox-settings.xsd
r59927 r61009 20 20 <xsd:schema 21 21 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 22 xmlns="http://www. innotek.de/VirtualBox-settings"23 xmlns:vb="http://www. innotek.de/VirtualBox-settings"24 targetNamespace="http://www. innotek.de/VirtualBox-settings"22 xmlns="http://www.virtualbox.org/" 23 xmlns:vb="http://www.virtualbox.org/" 24 targetNamespace="http://www.virtualbox.org/" 25 25 elementFormDefault="qualified" 26 26 > … … 29 29 <xsd:documentation xml:lang="en"> 30 30 Oracle VM VirtualBox Settings Schema (common definitions). 31 Copyright (c) 2004-201 3Oracle Corporation31 Copyright (c) 2004-2016 Oracle Corporation 32 32 </xsd:documentation> 33 33 </xsd:annotation> … … 251 251 --> 252 252 <xsd:complexType name="TDHCPServer"> 253 <xsd:sequence> 254 <xsd:element name="Options" minOccurs="0"> 255 <xsd:complexType> 256 <xsd:sequence> 257 <xsd:element name="Option" type="TDHCPOption" minOccurs="0" maxOccurs="unbounded"/> 258 </xsd:sequence> 259 </xsd:complexType> 260 </xsd:element> 261 </xsd:sequence> 253 262 <xsd:attribute name="networkName" type="xsd:string" use="required"/> 254 263 <xsd:attribute name="lowerIP" type="xsd:string" use="required"/> … … 257 266 <xsd:attribute name="networkMask" type="xsd:string" use="required"/> 258 267 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> 268 </xsd:complexType> 269 270 <xsd:complexType name="TDHCPOption"> 271 <xsd:attribute name="name" type="xsd:string" use="required"/> 272 <xsd:attribute name="value" type="xsd:string" use="required"/> 273 <xsd:attribute name="encoding" type="xsd:integer" default="0"/> 274 </xsd:complexType> 275 276 <xsd:complexType name="TNATNetwork"> 277 <xsd:sequence> 278 <xsd:element name="PortForwarding4" minOccurs="0"> 279 <xsd:complexType> 280 <xsd:sequence> 281 <xsd:element name="Forwarding" type="TNATPortForwarding" minOccurs="0" maxOccurs="unbounded"/> 282 </xsd:sequence> 283 </xsd:complexType> 284 </xsd:element> 285 <xsd:element name="PortForwarding6" minOccurs="0"> 286 <xsd:complexType> 287 <xsd:sequence> 288 <xsd:element name="Forwarding" type="TNATPortForwarding" minOccurs="0" maxOccurs="unbounded"/> 289 </xsd:sequence> 290 </xsd:complexType> 291 </xsd:element> 292 <xsd:element name="Mappings" minOccurs="0"> 293 <xsd:complexType> 294 <xsd:sequence> 295 <xsd:element name="Loopback4" type="TNATLoopback4" minOccurs="0" maxOccurs="unbounded"/> 296 </xsd:sequence> 297 </xsd:complexType> 298 </xsd:element> 299 </xsd:sequence> 300 <xsd:attribute name="networkName" type="xsd:string" use="required"/> 301 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> 302 <xsd:attribute name="network" type="xsd:string" use="required"/> 303 <xsd:attribute name="ipv6" type="xsd:boolean" use="required"/> 304 <xsd:attribute name="ipv6prefix" type="xsd:string" use="required"/> 305 <xsd:attribute name="advertiseDefaultIPv6Route" type="xsd:boolean" use="required"/> 306 <xsd:attribute name="needDhcp" type="xsd:boolean" use="required"/> 307 <xsd:attribute name="loopback6" type="xsd:integer" default="0"/> 308 </xsd:complexType> 309 310 <xsd:complexType name="TNATLoopback4"> 311 <xsd:attribute name="address" type="xsd:string" use="required"/> 312 <xsd:attribute name="offset" type="xsd:integer" use="required"/> 313 </xsd:complexType> 314 315 <xsd:complexType name="TNATPortForwarding"> 316 <xsd:attribute name="name" type="xsd:string" use="required"/> 317 <xsd:attribute name="proto" type="xsd:integer" use="required"/> 318 <xsd:attribute name="hostip" type="xsd:string" default=""/> 319 <xsd:attribute name="hostport" type="xsd:integer" use="required"/> 320 <xsd:attribute name="guestip" type="xsd:string" use="required"/> 321 <xsd:attribute name="guestport" type="xsd:integer" use="required"/> 259 322 </xsd:complexType> 260 323 … … 400 463 </xsd:complexType> 401 464 </xsd:element> 402 <xsd:element name="MediaRegistry" type="TMediaRegistry" />403 <xsd:element name="NetserviceRegistry" minOccurs="0" maxOccurs="1">465 <xsd:element name="MediaRegistry" type="TMediaRegistry" minOccurs="0"/> 466 <xsd:element name="NetserviceRegistry" minOccurs="0"> 404 467 <xsd:complexType> 405 468 <xsd:all> … … 408 471 <xsd:sequence> 409 472 <xsd:element name="DHCPServer" type="TDHCPServer" minOccurs="0" maxOccurs="unbounded"/> 473 </xsd:sequence> 474 </xsd:complexType> 475 </xsd:element> 476 <xsd:element name="NATNetworks" minOccurs="0"> 477 <xsd:complexType> 478 <xsd:sequence> 479 <xsd:element name="NATNetwork" type="TNATNetwork" minOccurs="0" maxOccurs="unbounded"/> 410 480 </xsd:sequence> 411 481 </xsd:complexType> … … 527 597 528 598 <xsd:complexType name="TDisplay"> 529 <xsd:attribute name="VRAMSize" use="required">599 <xsd:attribute name="VRAMSize" default="8"> 530 600 <xsd:simpleType> 531 601 <xsd:restriction base="xsd:unsignedInt"> 532 <xsd:minInclusive value=" 1"/>602 <xsd:minInclusive value="0"/> 533 603 <xsd:maxInclusive value="256"/> 534 604 </xsd:restriction> … … 602 672 <xsd:complexType name="TBIOS"> 603 673 <xsd:all> 604 <xsd:element name="ACPI" >674 <xsd:element name="ACPI" minOccurs="0"> 605 675 <xsd:complexType> 606 676 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> … … 795 865 796 866 <xsd:complexType name="TAudioAdapter"> 797 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/>867 <xsd:attribute name="enabled" type="xsd:boolean" default="false"/> 798 868 <xsd:attribute name="controller" default="AC97"> 799 869 <xsd:simpleType> … … 919 989 <xsd:complexContent> 920 990 <xsd:extension base="TNetworkConfig"> 921 <xsd:attribute name="type" type="TNetworkAdapterType" default="Am79C97 0A"/>991 <xsd:attribute name="type" type="TNetworkAdapterType" default="Am79C973"/> 922 992 <xsd:attribute name="slot" type="xsd:unsignedInt" use="required"/> 923 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/>993 <xsd:attribute name="enabled" type="xsd:boolean" default="false"/> 924 994 <xsd:attribute name="MACAddress"> 925 995 <xsd:simpleType> … … 929 999 </xsd:simpleType> 930 1000 </xsd:attribute> 931 <xsd:attribute name="cable" type="xsd:boolean" use="required"/>1001 <xsd:attribute name="cable" type="xsd:boolean" default="true"/> 932 1002 <xsd:attribute name="speed" type="xsd:unsignedInt" default="1000000"/> 933 1003 <xsd:attribute name="bootPriority" type="xsd:unsignedInt"/> … … 1253 1323 <xsd:element name="Chipset" type="TChipset" minOccurs="0"/> 1254 1324 <xsd:element name="Paravirt" type="TParavirt" minOccurs="0"/> 1255 <xsd:element name="Boot" type="TBoot" >1325 <xsd:element name="Boot" type="TBoot" minOccurs="0"> 1256 1326 <xsd:unique name="THardware-Boot-Order"> 1257 1327 <xsd:selector xpath="vb:Order"/> … … 1259 1329 </xsd:unique> 1260 1330 </xsd:element> 1261 <xsd:element name="Display" type="TDisplay" />1331 <xsd:element name="Display" type="TDisplay" minOccurs="0"/> 1262 1332 <xsd:element name="VideoRecording" type="TVideoRecording" minOccurs="0"/> 1263 1333 <xsd:element name="VideoCapture" type="TVideoCapture" minOccurs="0"/> 1264 1334 <xsd:element name="RemoteDisplay" type="TRemoteDisplay" minOccurs="0"/> 1265 <xsd:element name="BIOS" type="TBIOS" />1335 <xsd:element name="BIOS" type="TBIOS" minOccurs="0"/> 1266 1336 <xsd:element name="DVDDrive" type="TDVDDrive" minOccurs="0"/> 1267 1337 <xsd:element name="FloppyDrive" type="TFloppyDrive" minOccurs="0"/> … … 1269 1339 <xsd:element name="USB" type="TUSB" minOccurs="0"/> 1270 1340 <xsd:element name="SATAController" type="TSATAController" minOccurs="0"/> <!-- deprecated --> 1271 <xsd:element name="Network" type="TNetwork" >1341 <xsd:element name="Network" type="TNetwork" minOccurs="0"> 1272 1342 <xsd:unique name="THardware-Network-Adapter"> 1273 1343 <xsd:selector xpath="vb:Adapter"/> … … 1299 1369 </xsd:unique> 1300 1370 </xsd:element> 1301 <xsd:element name="AudioAdapter" type="TAudioAdapter" />1371 <xsd:element name="AudioAdapter" type="TAudioAdapter" minOccurs="0"/> 1302 1372 <xsd:element name="RTC" type="TRTC" minOccurs="0"/> 1303 <xsd:element name="SharedFolders" type="TSharedFolders" >1373 <xsd:element name="SharedFolders" type="TSharedFolders" minOccurs="0"> 1304 1374 <xsd:unique name="THardware-SharedFolders-SharedFolder"> 1305 1375 <xsd:selector xpath="vb:SharedFolder"/> … … 1307 1377 </xsd:unique> 1308 1378 </xsd:element> 1309 <xsd:element name="Clipboard" type="TClipboard" />1379 <xsd:element name="Clipboard" type="TClipboard" minOccurs="0"/> 1310 1380 <xsd:element name="DragAndDrop" type="TDragAndDrop" minOccurs="0"/> 1311 1381 <xsd:element name="IO" type="TIO" minOccurs="0"/> 1312 1382 <xsd:element name="HostPci" type="THostPci" minOccurs="0"/> 1313 1383 <xsd:element name="EmulatedUSB" type="TEmulatedUSB" minOccurs="0"/> 1314 <xsd:element name="Guest" type="TGuest" />1384 <xsd:element name="Guest" type="TGuest" minOccurs="0"/> 1315 1385 <xsd:element name="GuestProperties" type="TGuestProperties" minOccurs="0"> 1316 1386 <xsd:unique name="THardware-GuestProperties-GuestProperty"> … … 1319 1389 </xsd:unique> 1320 1390 </xsd:element> 1391 <xsd:element name="StorageControllers" type="TStorageControllers" minOccurs="0"/> 1321 1392 </xsd:all> 1322 1393 <xsd:attribute name="version" type="xsd:string" default="2"/> … … 1363 1434 <xsd:element name="Description" type="xsd:string" minOccurs="0"/> 1364 1435 <xsd:element name="Hardware" type="THardware"/> 1365 <xsd:element name="StorageControllers" type="TStorageControllers" />1436 <xsd:element name="StorageControllers" type="TStorageControllers" minOccurs="0"/> 1366 1437 <xsd:element name="Snapshots" minOccurs="0"> 1367 1438 <xsd:complexType>
Note:
See TracChangeset
for help on using the changeset viewer.

