1 | /* $Id: AdditionsFacilityImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Additions facility class.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_AdditionsFacilityImpl_h
|
---|
29 | #define MAIN_INCLUDED_AdditionsFacilityImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <iprt/time.h>
|
---|
35 | #include "AdditionsFacilityWrap.h"
|
---|
36 |
|
---|
37 | class Guest;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * A Guest Additions facility.
|
---|
41 | */
|
---|
42 | class ATL_NO_VTABLE AdditionsFacility :
|
---|
43 | public AdditionsFacilityWrap
|
---|
44 | {
|
---|
45 | public:
|
---|
46 |
|
---|
47 | DECLARE_COMMON_CLASS_METHODS(AdditionsFacility)
|
---|
48 |
|
---|
49 | /** @name Initializer & uninitializer methods
|
---|
50 | * @{ */
|
---|
51 | HRESULT init(Guest *a_pParent, AdditionsFacilityType_T a_enmFacility, AdditionsFacilityStatus_T a_enmStatus,
|
---|
52 | uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
53 | void uninit();
|
---|
54 | HRESULT FinalConstruct();
|
---|
55 | void FinalRelease();
|
---|
56 | /** @} */
|
---|
57 |
|
---|
58 | public:
|
---|
59 | /** @name public internal methods
|
---|
60 | * @{ */
|
---|
61 | LONG64 i_getLastUpdated() const;
|
---|
62 | #if 0 /* unused */
|
---|
63 | AdditionsFacilityType_T i_getType() const;
|
---|
64 | AdditionsFacilityClass_T i_getClass() const;
|
---|
65 | const char *i_getName() const;
|
---|
66 | #endif
|
---|
67 | AdditionsFacilityStatus_T i_getStatus() const;
|
---|
68 | bool i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
69 | /** @} */
|
---|
70 |
|
---|
71 | private:
|
---|
72 |
|
---|
73 | /** @name Wrapped IAdditionsFacility properties
|
---|
74 | * @{ */
|
---|
75 | HRESULT getClassType(AdditionsFacilityClass_T *aClassType);
|
---|
76 | HRESULT getLastUpdated(LONG64 *aLastUpdated);
|
---|
77 | HRESULT getName(com::Utf8Str &aName);
|
---|
78 | HRESULT getStatus(AdditionsFacilityStatus_T *aStatus);
|
---|
79 | HRESULT getType(AdditionsFacilityType_T *aType);
|
---|
80 | /** @} */
|
---|
81 |
|
---|
82 | struct Data
|
---|
83 | {
|
---|
84 | /** Last update timestamp. */
|
---|
85 | RTTIMESPEC mTimestamp;
|
---|
86 | /** The facilitie's current status. */
|
---|
87 | AdditionsFacilityStatus_T mStatus;
|
---|
88 | /** Flags. */
|
---|
89 | uint32_t mfFlags;
|
---|
90 | /** The facilitie's ID/type (static). */
|
---|
91 | AdditionsFacilityType_T mType;
|
---|
92 | /** Index into s_aFacilityInfo. */
|
---|
93 | size_t midxInfo;
|
---|
94 | } mData;
|
---|
95 |
|
---|
96 | /** Facility <-> string mappings. */
|
---|
97 | struct FacilityInfo
|
---|
98 | {
|
---|
99 | /** The facilitie's name. */
|
---|
100 | const char *mName; /* utf-8 */
|
---|
101 | /** The facilitie's type. */
|
---|
102 | AdditionsFacilityType_T mType;
|
---|
103 | /** The facilitie's class. */
|
---|
104 | AdditionsFacilityClass_T mClass;
|
---|
105 | };
|
---|
106 | static const FacilityInfo s_aFacilityInfo[8];
|
---|
107 | };
|
---|
108 |
|
---|
109 | #endif /* !MAIN_INCLUDED_AdditionsFacilityImpl_h */
|
---|
110 |
|
---|