settings.h revision c606fa3531314e32f0ae90495618aeae47418477
/** @file
* Settings file data structures.
*
* These structures are created by the settings file loader and filled with values
* copied from the raw XML data. This was all new with VirtualBox 3.1 and allows us
* to finally make the XML reader version-independent and read VirtualBox XML files
* from earlier and even newer (future) versions without requiring complicated,
* tedious and error-prone XSLT conversions.
*
* It is this file that defines all structures that map VirtualBox global and
* machine settings to XML files. These structures are used by the rest of Main,
* even though this header file does not require anything else in Main.
*
* Note: Headers in Main code have been tweaked to only declare the structures
* defined here so that this header need only be included from code files that
* actually use these structures.
*/
/*
* Copyright (C) 2007-2010 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___VBox_settings_h
#define ___VBox_settings_h
#include "VBox/com/VirtualBox.h"
#include <list>
#include <map>
{
}
{
////////////////////////////////////////////////////////////////////////////////
//
// Helper classes
//
////////////////////////////////////////////////////////////////////////////////
// ExtraDataItem (used by both VirtualBox.xml and machines XML)
struct USBDeviceFilter;
/**
* Common base class for both MainConfigFile and MachineConfigFile
* which contains some common logic for both.
*/
{
bool fileExists();
void copyBaseFrom(const ConfigFileBase &b);
~ConfigFileBase();
void createStubDocument();
const USBDeviceFiltersList &ll,
bool fHostMode);
void clearDocument();
struct Data;
Data *m;
};
////////////////////////////////////////////////////////////////////////////////
//
// Structures shared between Machine XML and VirtualBox.xml
//
////////////////////////////////////////////////////////////////////////////////
/**
* USB device filter definition. This struct is used both in MainConfigFile
* (for global USB filters) and MachineConfigFile (for machine filters).
*
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct USBDeviceFilter
{
: fActive(false),
{}
bool operator==(const USBDeviceFilter&u) const;
bool fActive;
};
////////////////////////////////////////////////////////////////////////////////
//
// VirtualBox.xml structures
//
////////////////////////////////////////////////////////////////////////////////
struct Host
{
};
struct SystemProperties
{
: ulLogHistoryCount(3)
{}
};
struct Medium;
struct Medium
{
// the following are for hard disks only:
bool fAutoReset; // optional, only for diffs, default is false
};
struct MachineRegistryEntry
{
};
struct DHCPServer
{
bool fEnabled;
};
{
const Medium &m,
};
////////////////////////////////////////////////////////////////////////////////
//
// Machine XML structures
//
////////////////////////////////////////////////////////////////////////////////
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct VRDPSettings
{
: fEnabled(true),
ulAuthTimeout(5000),
fAllowMultiConnection(false),
fReuseSingleConnection(false)
{}
bool operator==(const VRDPSettings& v) const;
bool fEnabled;
bool fAllowMultiConnection,
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct BIOSSettings
{
: fACPIEnabled(true),
fIOAPICEnabled(false),
fLogoFadeIn(true),
fLogoFadeOut(false),
fPXEDebugEnabled(false),
llTimeOffset(0)
{}
bool operator==(const BIOSSettings &d) const;
bool fACPIEnabled,
bool fPXEDebugEnabled;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct USBController
{
: fEnabled(false),
fEnabledEHCI(false)
{}
bool operator==(const USBController &u) const;
bool fEnabled;
bool fEnabledEHCI;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct NetworkAdapter
{
: ulSlot(0),
fEnabled(false),
fCableConnected(false),
ulLineSpeed(0),
fTraceEnabled(false),
{}
bool operator==(const NetworkAdapter &n) const;
bool fEnabled;
bool fCableConnected;
bool fTraceEnabled;
// with bridged: host interface or empty;
// otherwise: network name (required)
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct SerialPort
{
: ulSlot(0),
fEnabled(false),
ulIOBase(4),
ulIRQ(0x3f8),
fServer(false)
{}
bool operator==(const SerialPort &n) const;
bool fEnabled;
bool fServer;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct ParallelPort
{
: ulSlot(0),
fEnabled(false),
ulIOBase(0x378),
ulIRQ(4)
{}
bool operator==(const ParallelPort &d) const;
bool fEnabled;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct AudioAdapter
{
: fEnabled(true),
{}
bool operator==(const AudioAdapter &a) const
{
return (this == &a)
&& (controllerType == a.controllerType)
&& (driverType == a.driverType)
);
}
bool fEnabled;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct SharedFolder
{
: fWritable(false)
{}
bool operator==(const SharedFolder &a) const;
bool fWritable;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct GuestProperty
{
: timestamp(0)
{};
bool operator==(const GuestProperty &g) const;
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct CpuIdLeaf
{
: ulId(UINT32_MAX),
ulEax(0),
ulEbx(0),
ulEcx(0),
ulEdx(0)
{}
{
return ( (this == &c)
)
);
}
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct Cpu
{
Cpu()
: ulId(UINT32_MAX)
{}
{
}
};
/**
* Representation of Machine hardware; this is used in the MachineConfigFile.hardwareMachine
* field.
*
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct Hardware
{
Hardware();
bool fHardwareVirt,
fPAE;
bool fCpuHotPlug; // requires settings version 1.11 (VirtualBox 3.2)
bool fAccelerate3D,
fAccelerate2DVideo; // requires settings version 1.8 (VirtualBox 3.1)
// technically these two have no business in the hardware section, but for some
// clever reason <Hardware> is where they are in the XML....
};
/**
* A device attached to a storage controller. This can either be a
* hard disk or a DVD drive or a floppy drive and also specifies
* which medium is "in" the drive; as a result, this is a combination
* of the Main IMedium and IMediumAttachment interfaces.
*
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct AttachedDevice
{
fPassThrough(false),
lPort(0),
lDevice(0)
{}
bool operator==(const AttachedDevice &a) const;
// DVDs can be in pass-through mode:
bool fPassThrough;
// if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI),
// this is its UUID; it depends on deviceType which media registry this then needs to
// be looked up in. If no image file (only permitted for DVDs and floppies), then the UUID is NULL
// for DVDs and floppies, the attachment can also be a host device:
};
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct StorageController
{
ulPortCount(2),
ulInstance(0),
{}
bool operator==(const StorageController &s) const;
// only for when controllerType == StorageControllerType_IntelAhci:
};
/**
* We wrap the storage controllers list into an extra struct so we can
* use an undefined struct without needing std::list<> in all the headers.
*
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct Storage
{
};
struct Snapshot;
/**
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by MachineConfigFile::operator==(), or otherwise
* your settings might never get saved.
*/
struct Snapshot
{
strDescription; // optional
};
/**
* MachineConfigFile represents an XML machine configuration. All the machine settings
* that go out to the XML (or are read from it) are in here.
*
* NOTE: If you add any fields in here, you must update a) the constructor and b)
* the operator== which is used by Machine::saveSettings(), or otherwise your settings
* might never get saved.
*/
{
bool operator==(const MachineConfigFile &m) const;
void readStorageControllerAttributes(const xml::ElementNode &elmStorageController, StorageController &sctl);
void bumpSettingsVersionIfNeeded();
bool fNameSync;
bool fTeleporterEnabled;
bool fRTCUseUTC;
bool fCurrentStateModified; // optional, default is true
bool fAborted; // optional, default is false
};
} // namespace settings
#endif /* ___VBox_settings_h */