1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox Appliance private data definitions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.alldomusa.eu.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ____H_APPLIANCEIMPLPRIVATE
|
---|
19 | #define ____H_APPLIANCEIMPLPRIVATE
|
---|
20 |
|
---|
21 | class VirtualSystemDescription;
|
---|
22 |
|
---|
23 | #include "ovfreader.h"
|
---|
24 |
|
---|
25 | ////////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // Appliance data definition
|
---|
28 | //
|
---|
29 | ////////////////////////////////////////////////////////////////////////////////
|
---|
30 |
|
---|
31 | /* Describe a location for the import/export. The location could be a file on a
|
---|
32 | * local hard disk or a remote target based on the supported inet protocols. */
|
---|
33 | struct Appliance::LocationInfo
|
---|
34 | {
|
---|
35 | LocationInfo()
|
---|
36 | : storageType(VFSType_File) {}
|
---|
37 | VFSType_T storageType; /* Which type of storage should be handled */
|
---|
38 | Utf8Str strPath; /* File path for the import/export */
|
---|
39 | Utf8Str strHostname; /* Hostname on remote storage locations (could be empty) */
|
---|
40 | Utf8Str strUsername; /* Username on remote storage locations (could be empty) */
|
---|
41 | Utf8Str strPassword; /* Password on remote storage locations (could be empty) */
|
---|
42 | };
|
---|
43 |
|
---|
44 | // opaque private instance data of Appliance class
|
---|
45 | struct Appliance::Data
|
---|
46 | {
|
---|
47 | enum ApplianceState { ApplianceIdle, ApplianceImporting, ApplianceExporting };
|
---|
48 |
|
---|
49 | Data()
|
---|
50 | : state(ApplianceIdle),
|
---|
51 | pReader(NULL)
|
---|
52 | {
|
---|
53 | }
|
---|
54 |
|
---|
55 | ~Data()
|
---|
56 | {
|
---|
57 | if (pReader)
|
---|
58 | {
|
---|
59 | delete pReader;
|
---|
60 | pReader = NULL;
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 | ApplianceState state;
|
---|
65 |
|
---|
66 | LocationInfo locInfo; // location info for the currently processed OVF
|
---|
67 |
|
---|
68 | ovf::OVFReader *pReader;
|
---|
69 |
|
---|
70 | std::list< ComObjPtr<VirtualSystemDescription> >
|
---|
71 | virtualSystemDescriptions;
|
---|
72 |
|
---|
73 | std::list<Utf8Str> llWarnings;
|
---|
74 |
|
---|
75 | Utf8Str strManifestFile; // on import, contains path of manifest file if it exists
|
---|
76 |
|
---|
77 | ULONG ulWeightForXmlOperation;
|
---|
78 | ULONG ulWeightForManifestOperation;
|
---|
79 | ULONG ulTotalDisksMB;
|
---|
80 | ULONG cDisks;
|
---|
81 | Utf8Str strOVFSHA1Digest;
|
---|
82 | };
|
---|
83 |
|
---|
84 | struct Appliance::XMLStack
|
---|
85 | {
|
---|
86 | std::map<Utf8Str, const VirtualSystemDescriptionEntry*> mapDisks;
|
---|
87 | std::map<Utf8Str, bool> mapNetworks;
|
---|
88 | };
|
---|
89 |
|
---|
90 | struct Appliance::TaskOVF
|
---|
91 | {
|
---|
92 | enum TaskType
|
---|
93 | {
|
---|
94 | Read,
|
---|
95 | Import,
|
---|
96 | Write
|
---|
97 | };
|
---|
98 |
|
---|
99 | TaskOVF(Appliance *aThat,
|
---|
100 | TaskType aType,
|
---|
101 | LocationInfo aLocInfo,
|
---|
102 | ComObjPtr<Progress> &aProgress)
|
---|
103 | : pAppliance(aThat),
|
---|
104 | taskType(aType),
|
---|
105 | locInfo(aLocInfo),
|
---|
106 | pProgress(aProgress),
|
---|
107 | enFormat(unspecified),
|
---|
108 | rc(S_OK)
|
---|
109 | {}
|
---|
110 |
|
---|
111 | static int updateProgress(unsigned uPercent, void *pvUser);
|
---|
112 |
|
---|
113 | int startThread();
|
---|
114 |
|
---|
115 | Appliance *pAppliance;
|
---|
116 | TaskType taskType;
|
---|
117 | const LocationInfo locInfo;
|
---|
118 | ComObjPtr<Progress> pProgress;
|
---|
119 |
|
---|
120 | OVFFormat enFormat;
|
---|
121 |
|
---|
122 | HRESULT rc;
|
---|
123 | };
|
---|
124 |
|
---|
125 | struct MyHardDiskAttachment
|
---|
126 | {
|
---|
127 | Bstr bstrUuid;
|
---|
128 | ComPtr<IMachine> pMachine;
|
---|
129 | Bstr controllerType;
|
---|
130 | int32_t lControllerPort; // 0-29 for SATA
|
---|
131 | int32_t lDevice; // IDE: 0 or 1, otherwise 0 always
|
---|
132 | };
|
---|
133 |
|
---|
134 | ////////////////////////////////////////////////////////////////////////////////
|
---|
135 | //
|
---|
136 | // VirtualSystemDescription data definition
|
---|
137 | //
|
---|
138 | ////////////////////////////////////////////////////////////////////////////////
|
---|
139 |
|
---|
140 | struct VirtualSystemDescription::Data
|
---|
141 | {
|
---|
142 | std::list<VirtualSystemDescriptionEntry>
|
---|
143 | llDescriptions; // item descriptions
|
---|
144 |
|
---|
145 | ComPtr<Machine> pMachine; // VirtualBox machine this description was exported from (export only)
|
---|
146 |
|
---|
147 | settings::MachineConfigFile
|
---|
148 | *pConfig; // machine config created from <vbox:Machine> element if found (import only)
|
---|
149 | };
|
---|
150 |
|
---|
151 | ////////////////////////////////////////////////////////////////////////////////
|
---|
152 | //
|
---|
153 | // Internal helpers
|
---|
154 | //
|
---|
155 | ////////////////////////////////////////////////////////////////////////////////
|
---|
156 |
|
---|
157 | void convertCIMOSType2VBoxOSType(Utf8Str &strType, ovf::CIMOSType_T c, const Utf8Str &cStr);
|
---|
158 |
|
---|
159 | ovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVbox);
|
---|
160 |
|
---|
161 | #endif // ____H_APPLIANCEIMPLPRIVATE
|
---|