ApplianceImplPrivate.h revision b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03a
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync/** @file
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync *
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * VirtualBox Appliance private data definitions
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync/*
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * Copyright (C) 2006-2010 Oracle Corporation
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync *
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * available from http://www.virtualbox.org. This file is free software;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * you can redistribute it and/or modify it under the terms of the GNU
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * General Public License (GPL) as published by the Free Software
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync#ifndef ____H_APPLIANCEIMPLPRIVATE
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync#define ____H_APPLIANCEIMPLPRIVATE
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncclass VirtualSystemDescription;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync#include "ovfreader.h"
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync// Appliance data definition
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync/* Describe a location for the import/export. The location could be a file on a
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync * local hard disk or a remote target based on the supported inet protocols. */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct Appliance::LocationInfo
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync LocationInfo()
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync : storageType(VFSType_File) {}
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync VFSType_T storageType; /* Which type of storage should be handled */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Utf8Str strPath; /* File path for the import/export */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Utf8Str strHostname; /* Hostname on remote storage locations (could be empty) */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Utf8Str strUsername; /* Username on remote storage locations (could be empty) */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Utf8Str strPassword; /* Password on remote storage locations (could be empty) */
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync// opaque private instance data of Appliance class
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct Appliance::Data
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync enum ApplianceState { ApplianceIdle, ApplianceImporting, ApplianceExporting };
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Data()
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync : state(ApplianceIdle),
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync pReader(NULL)
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync {
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync }
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync ~Data()
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync {
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync if (pReader)
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync {
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync delete pReader;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync pReader = NULL;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync }
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync }
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ApplianceState state;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync LocationInfo locInfo; // location info for the currently processed OVF
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ovf::OVFReader *pReader;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync std::list< ComObjPtr<VirtualSystemDescription> >
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync virtualSystemDescriptions;
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync std::list<Utf8Str> llWarnings;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync Utf8Str strManifestFile; // on import, contains path of manifest file if it exists
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ULONG ulWeightForXmlOperation;
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ULONG ulWeightForManifestOperation;
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ULONG ulTotalDisksMB;
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync ULONG cDisks;
b2a9ade0eaa3c7b26c02cc05f83c352cafb9e03avboxsync Utf8Str strOVFSHA1Digest;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct Appliance::XMLStack
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync std::map<Utf8Str, const VirtualSystemDescriptionEntry*> mapDisks;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync std::map<Utf8Str, bool> mapNetworks;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct Appliance::TaskOVF
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync enum TaskType
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync {
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Read,
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync Import,
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Write
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync };
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync TaskOVF(Appliance *aThat,
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync TaskType aType,
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync LocationInfo aLocInfo,
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync ComObjPtr<Progress> &aProgress)
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync : pAppliance(aThat),
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync taskType(aType),
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync locInfo(aLocInfo),
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync pProgress(aProgress),
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync enFormat(unspecified),
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync rc(S_OK)
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync {}
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync static int updateProgress(unsigned uPercent, void *pvUser);
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync int startThread();
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync Appliance *pAppliance;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync TaskType taskType;
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync const LocationInfo locInfo;
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync ComObjPtr<Progress> pProgress;
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync OVFFormat enFormat;
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync HRESULT rc;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct MyHardDiskAttachment
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Bstr bstrUuid;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync ComPtr<IMachine> pMachine;
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync Bstr controllerType;
15760030457c4d8548d42a9d543646b27eae7040vboxsync int32_t lControllerPort; // 0-29 for SATA
15760030457c4d8548d42a9d543646b27eae7040vboxsync int32_t lDevice; // IDE: 0 or 1, otherwise 0 always
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync// VirtualSystemDescription data definition
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsyncstruct VirtualSystemDescription::Data
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync{
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync std::list<VirtualSystemDescriptionEntry>
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync llDescriptions; // item descriptions
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync ComPtr<Machine> pMachine; // VirtualBox machine this description was exported from (export only)
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync settings::MachineConfigFile
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync *pConfig; // machine config created from <vbox:Machine> element if found (import only)
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync};
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync// Internal helpers
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync//
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync////////////////////////////////////////////////////////////////////////////////
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsyncvoid convertCIMOSType2VBoxOSType(Utf8Str &strType, ovf::CIMOSType_T c, const Utf8Str &cStr);
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsyncovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVbox);
0c9573129c50b7f9f4ea54e61417c2ed06bb8ebavboxsync
468c2bcb36eb9a032f5dd0fcb34db10bd58e9996vboxsync#endif // ____H_APPLIANCEIMPLPRIVATE