1 | /* $Id: AdditionsFacilityImpl.h 84564 2020-05-27 14:10:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Additions facility class.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2020 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 MAIN_INCLUDED_AdditionsFacilityImpl_h
|
---|
19 | #define MAIN_INCLUDED_AdditionsFacilityImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <iprt/time.h>
|
---|
25 | #include "AdditionsFacilityWrap.h"
|
---|
26 |
|
---|
27 | class Guest;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * A Guest Additions facility.
|
---|
31 | */
|
---|
32 | class ATL_NO_VTABLE AdditionsFacility :
|
---|
33 | public AdditionsFacilityWrap
|
---|
34 | {
|
---|
35 | public:
|
---|
36 |
|
---|
37 | DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
|
---|
38 |
|
---|
39 | /** @name Initializer & uninitializer methods
|
---|
40 | * @{ */
|
---|
41 | HRESULT init(Guest *a_pParent, AdditionsFacilityType_T a_enmFacility, AdditionsFacilityStatus_T a_enmStatus,
|
---|
42 | uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
43 | void uninit();
|
---|
44 | HRESULT FinalConstruct();
|
---|
45 | void FinalRelease();
|
---|
46 | /** @} */
|
---|
47 |
|
---|
48 | public:
|
---|
49 | /** @name public internal methods
|
---|
50 | * @{ */
|
---|
51 | LONG64 i_getLastUpdated() const;
|
---|
52 | #if 0 /* unused */
|
---|
53 | AdditionsFacilityType_T i_getType() const;
|
---|
54 | AdditionsFacilityClass_T i_getClass() const;
|
---|
55 | const char *i_getName() const;
|
---|
56 | #endif
|
---|
57 | AdditionsFacilityStatus_T i_getStatus() const;
|
---|
58 | bool i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
59 | /** @} */
|
---|
60 |
|
---|
61 | private:
|
---|
62 |
|
---|
63 | /** @name Wrapped IAdditionsFacility properties
|
---|
64 | * @{ */
|
---|
65 | HRESULT getClassType(AdditionsFacilityClass_T *aClassType);
|
---|
66 | HRESULT getLastUpdated(LONG64 *aLastUpdated);
|
---|
67 | HRESULT getName(com::Utf8Str &aName);
|
---|
68 | HRESULT getStatus(AdditionsFacilityStatus_T *aStatus);
|
---|
69 | HRESULT getType(AdditionsFacilityType_T *aType);
|
---|
70 | /** @} */
|
---|
71 |
|
---|
72 | struct Data
|
---|
73 | {
|
---|
74 | /** Last update timestamp. */
|
---|
75 | RTTIMESPEC mTimestamp;
|
---|
76 | /** The facilitie's current status. */
|
---|
77 | AdditionsFacilityStatus_T mStatus;
|
---|
78 | /** Flags. */
|
---|
79 | uint32_t mfFlags;
|
---|
80 | /** The facilitie's ID/type (static). */
|
---|
81 | AdditionsFacilityType_T mType;
|
---|
82 | /** Index into s_aFacilityInfo. */
|
---|
83 | size_t midxInfo;
|
---|
84 | } mData;
|
---|
85 |
|
---|
86 | /** Facility <-> string mappings. */
|
---|
87 | struct FacilityInfo
|
---|
88 | {
|
---|
89 | /** The facilitie's name. */
|
---|
90 | const char *mName; /* utf-8 */
|
---|
91 | /** The facilitie's type. */
|
---|
92 | AdditionsFacilityType_T mType;
|
---|
93 | /** The facilitie's class. */
|
---|
94 | AdditionsFacilityClass_T mClass;
|
---|
95 | };
|
---|
96 | static const FacilityInfo s_aFacilityInfo[8];
|
---|
97 | };
|
---|
98 |
|
---|
99 | #endif /* !MAIN_INCLUDED_AdditionsFacilityImpl_h */
|
---|
100 |
|
---|