VirtualBox

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

Last change on this file since 34575 was 34244, checked in by vboxsync, 14 years ago

Main,Config.kmk,VBoxManage,ExtPacks: Moved the VRDE bits from IVirtualBox to the extension packs; changed ISystemProperties and IVRDEServer to talk about VRDE extension packs instead of VRDE libraries.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 KB
Line 
1/* $Id: Global.h 34244 2010-11-22 14:31:02Z vboxsync $ */
2/** @file
3 * VirtualBox COM API - Global Declarations and Definitions.
4 */
5
6/*
7 * Copyright (C) 2008-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.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_GLOBAL
19#define ____H_GLOBAL
20
21/* generated header */
22#include "SchemaDefs.h"
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
42/** The VBoxVRDP kludge extension pack name.
43 *
44 * This is not a valid extension pack name (dashes are not allowed), and
45 * hence will not conflict with real extension packs.
46 */
47#define VBOXVRDP_KLUDGE_EXTPACK_NAME "Built-in-VBoxVRDP"
48
49/**
50 * Contains global static definitions that can be referenced by all COM classes
51 * regardless of the apartment.
52 */
53class Global
54{
55public:
56
57 /** Represents OS Type <-> string mappings. */
58 struct OSType
59 {
60 const char *familyId; /* utf-8 */
61 const char *familyDescription; /* utf-8 */
62 const char *id; /* utf-8 */
63 const char *description; /* utf-8 */
64 const VBOXOSTYPE osType;
65 const uint32_t osHint;
66 const uint32_t recommendedRAM;
67 const uint32_t recommendedVRAM;
68 const uint64_t recommendedHDD;
69 const NetworkAdapterType_T networkAdapterType;
70 const uint32_t numSerialEnabled;
71 const StorageControllerType_T dvdStorageControllerType;
72 const StorageBus_T dvdStorageBusType;
73 const StorageControllerType_T hdStorageControllerType;
74 const StorageBus_T hdStorageBusType;
75 const ChipsetType_T chipsetType;
76 const AudioControllerType_T audioControllerType;
77 };
78
79 static const OSType sOSTypes[SchemaDefs::OSTypeId_COUNT];
80
81 static const char *OSTypeId(VBOXOSTYPE aOSType);
82
83 /**
84 * Returns @c true if the given machine state is an online state. This is a
85 * recommended way to detect if the VM is online (being executed in a
86 * dedicated process) or not. Note that some online states are also
87 * transitional states (see #IsTransitional()).
88 *
89 * @remarks Saving may actually be an offline state according to the
90 * documentation (offline snapshot).
91 */
92 static bool IsOnline(MachineState_T aState)
93 {
94#if 0
95 return aState >= MachineState_FirstOnline &&
96 aState <= MachineState_LastOnline;
97#else
98 switch (aState)
99 {
100 case MachineState_Running:
101 case MachineState_Paused:
102 case MachineState_Teleporting:
103 case MachineState_LiveSnapshotting:
104 case MachineState_Stuck:
105 case MachineState_Starting:
106 case MachineState_Stopping:
107 case MachineState_Saving:
108 case MachineState_Restoring:
109 case MachineState_TeleportingPausedVM:
110 case MachineState_TeleportingIn:
111 return true;
112 default:
113 return false;
114 }
115#endif
116 }
117
118 /**
119 * Returns @c true if the given machine state is a transient state. This is
120 * a recommended way to detect if the VM is performing some potentially
121 * lengthy operation (such as starting, stopping, saving, deleting
122 * snapshot, etc.). Note some (but not all) transitional states are also
123 * online states (see #IsOnline()).
124 */
125 static bool IsTransient(MachineState_T aState)
126 {
127#if 0
128 return aState >= MachineState_FirstTransient &&
129 aState <= MachineState_LastTransient;
130#else
131 switch (aState)
132 {
133 case MachineState_Teleporting:
134 case MachineState_LiveSnapshotting:
135 case MachineState_Starting:
136 case MachineState_Stopping:
137 case MachineState_Saving:
138 case MachineState_Restoring:
139 case MachineState_TeleportingPausedVM:
140 case MachineState_TeleportingIn:
141 case MachineState_RestoringSnapshot:
142 case MachineState_DeletingSnapshot:
143 case MachineState_SettingUp:
144 return true;
145 default:
146 return false;
147 }
148#endif
149 }
150
151 /**
152 * Shortcut to <tt>IsOnline(aState) || IsTransient(aState)</tt>. When it returns
153 * @false, the VM is turned off (no VM process) and not busy with
154 * another exclusive operation.
155 */
156 static bool IsOnlineOrTransient(MachineState_T aState)
157 {
158 return IsOnline(aState) || IsTransient(aState);
159 }
160
161 /**
162 * Stringify a machine state.
163 *
164 * @returns Pointer to a read only string.
165 * @param aState Valid machine state.
166 */
167 static const char *stringifyMachineState(MachineState_T aState);
168
169 /**
170 * Stringify a session state.
171 *
172 * @returns Pointer to a read only string.
173 * @param aState Valid session state.
174 */
175 static const char *stringifySessionState(SessionState_T aState);
176
177 /**
178 * Stringify a device type.
179 *
180 * @returns Pointer to a read only string.
181 * @param aType The device type.
182 */
183 static const char *stringifyDeviceType(DeviceType_T aType);
184
185 /**
186 * Try convert a COM status code to a VirtualBox status code (VBox/err.h).
187 *
188 * @returns VBox status code.
189 * @param aComStatus COM status code.
190 */
191 static int vboxStatusCodeFromCOM(HRESULT aComStatus);
192
193 /**
194 * Try convert a VirtualBox status code (VBox/err.h) to a COM status code.
195 *
196 * This is mainly intended for dealing with vboxStatusCodeFromCOM() return
197 * values. If used on anything else, it won't be able to cope with most of the
198 * input!
199 *
200 * @returns COM status code.
201 * @param aVBoxStatus VBox status code.
202 */
203 static HRESULT vboxStatusCodeToCOM(int aVBoxStatus);
204};
205
206#endif /* !____H_GLOBAL */
207/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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