VirtualBox

source: vbox/trunk/src/VBox/Main/include/Global.h@ 91470

最後變更 在這個檔案從91470是 91470,由 vboxsync 提交於 3 年 前

Main/GuestOSTypeImpl,Global,Machine: New Windows 11 guest OS type, and also a new recommended CPU count field for every guest OS.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 6.7 KB
 
1/* $Id: Global.h 91470 2021-09-29 19:55:51Z vboxsync $ */
2/** @file
3 * VirtualBox COM API - Global Declarations and Definitions.
4 */
5
6/*
7 * Copyright (C) 2008-2020 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 MAIN_INCLUDED_Global_h
19#define MAIN_INCLUDED_Global_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* interface definitions */
25#include "VBox/com/VirtualBox.h"
26
27#include <VBox/ostypes.h>
28
29#include <iprt/types.h>
30
31#define VBOXOSHINT_NONE 0
32#define VBOXOSHINT_64BIT RT_BIT(0)
33#define VBOXOSHINT_HWVIRTEX RT_BIT(1)
34#define VBOXOSHINT_IOAPIC RT_BIT(2)
35#define VBOXOSHINT_EFI RT_BIT(3)
36#define VBOXOSHINT_PAE RT_BIT(4)
37#define VBOXOSHINT_USBHID RT_BIT(5)
38#define VBOXOSHINT_HPET RT_BIT(6)
39#define VBOXOSHINT_USBTABLET RT_BIT(7)
40#define VBOXOSHINT_RTCUTC RT_BIT(8)
41#define VBOXOSHINT_ACCEL2D RT_BIT(9)
42#define VBOXOSHINT_ACCEL3D RT_BIT(10)
43#define VBOXOSHINT_FLOPPY RT_BIT(11)
44#define VBOXOSHINT_NOUSB RT_BIT(12)
45#define VBOXOSHINT_TFRESET RT_BIT(13)
46#define VBOXOSHINT_USB3 RT_BIT(14)
47#define VBOXOSHINT_X2APIC RT_BIT(15)
48
49/** The VBoxVRDP kludge extension pack name.
50 *
51 * This is not a valid extension pack name (dashes are not allowed), and
52 * hence will not conflict with real extension packs.
53 */
54#define VBOXVRDP_KLUDGE_EXTPACK_NAME "Built-in-VBoxVRDP"
55
56/**
57 * Contains global static definitions that can be referenced by all COM classes
58 * regardless of the apartment.
59 */
60class Global
61{
62public:
63
64 /** Represents OS Type <-> string mappings. */
65 struct OSType
66 {
67 const char *familyId; /* utf-8 */
68 const char *familyDescription; /* utf-8 */
69 const char *id; /* utf-8, VM config file value */
70 const char *description; /* utf-8 */
71 const VBOXOSTYPE osType;
72 const uint32_t osHint;
73 const uint32_t recommendedCPUCount;
74 const uint32_t recommendedRAM;
75 const uint32_t recommendedVRAM;
76 const uint64_t recommendedHDD;
77 const GraphicsControllerType_T graphicsControllerType;
78 const NetworkAdapterType_T networkAdapterType;
79 const uint32_t numSerialEnabled;
80 const StorageControllerType_T dvdStorageControllerType;
81 const StorageBus_T dvdStorageBusType;
82 const StorageControllerType_T hdStorageControllerType;
83 const StorageBus_T hdStorageBusType;
84 const ChipsetType_T chipsetType;
85 const IommuType_T iommuType;
86 const AudioControllerType_T audioControllerType;
87 const AudioCodecType_T audioCodecType;
88 };
89
90 static const OSType sOSTypes[];
91 static size_t cOSTypes;
92
93 /**
94 * Maps VBOXOSTYPE to the OS type which is used in VM configs.
95 */
96 static const char *OSTypeId(VBOXOSTYPE aOSType);
97
98 /**
99 * Maps an OS type ID string to index into sOSTypes.
100 * @returns index on success, UINT32_MAX if not found.
101 */
102 static uint32_t getOSTypeIndexFromId(const char *pszId);
103
104 /**
105 * Get the network adapter limit for each chipset type.
106 */
107 static uint32_t getMaxNetworkAdapters(ChipsetType_T aChipsetType);
108
109 /**
110 * Returns @c true if the given machine state is an online state. This is a
111 * recommended way to detect if the VM is online (being executed in a
112 * dedicated process) or not. Note that some online states are also
113 * transitional states (see #IsTransient()).
114 */
115 static bool IsOnline(MachineState_T aState)
116 {
117 return aState >= MachineState_FirstOnline &&
118 aState <= MachineState_LastOnline;
119 }
120
121 /**
122 * Returns @c true if the given machine state is a transient state. This is
123 * a recommended way to detect if the VM is performing some potentially
124 * lengthy operation (such as starting, stopping, saving, deleting
125 * snapshot, etc.). Note some (but not all) transitional states are also
126 * online states (see #IsOnline()).
127 */
128 static bool IsTransient(MachineState_T aState)
129 {
130 return aState >= MachineState_FirstTransient &&
131 aState <= MachineState_LastTransient;
132 }
133
134 /**
135 * Shortcut to <tt>IsOnline(aState) || IsTransient(aState)</tt>. When it returns
136 * @c false, the VM is turned off (no VM process) and not busy with
137 * another exclusive operation.
138 */
139 static bool IsOnlineOrTransient(MachineState_T aState)
140 {
141 return IsOnline(aState) || IsTransient(aState);
142 }
143
144 /**
145 * Stringify a machine state.
146 *
147 * @returns Pointer to a read only string.
148 * @param aState Valid machine state.
149 */
150 static const char *stringifyMachineState(MachineState_T aState);
151
152 /**
153 * Stringify a session state.
154 *
155 * @returns Pointer to a read only string.
156 * @param aState Valid session state.
157 */
158 static const char *stringifySessionState(SessionState_T aState);
159
160 /**
161 * Stringify a device type.
162 *
163 * @returns Pointer to a read only string.
164 * @param aType The device type.
165 */
166 static const char *stringifyDeviceType(DeviceType_T aType);
167
168 /**
169 * Stringify a reason.
170 *
171 * @returns Pointer to a read only string.
172 * @param aReason The reason code.
173 */
174 static const char *stringifyReason(Reason_T aReason);
175
176 /**
177 * Try convert a COM status code to a VirtualBox status code (VBox/err.h).
178 *
179 * @returns VBox status code.
180 * @param aComStatus COM status code.
181 */
182 static int vboxStatusCodeFromCOM(HRESULT aComStatus);
183
184 /**
185 * Try convert a VirtualBox status code (VBox/err.h) to a COM status code.
186 *
187 * This is mainly intended for dealing with vboxStatusCodeFromCOM() return
188 * values. If used on anything else, it won't be able to cope with most of the
189 * input!
190 *
191 * @returns COM status code.
192 * @param aVBoxStatus VBox status code.
193 */
194 static HRESULT vboxStatusCodeToCOM(int aVBoxStatus);
195};
196
197#endif /* !MAIN_INCLUDED_Global_h */
198/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette