1 | /** @file
|
---|
2 | * VBox Global COM Class definition
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2017-2018 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ____H_VIRTUALBOXCLIENTLISTIMPL
|
---|
18 | #define ____H_VIRTUALBOXCLIENTLISTIMPL
|
---|
19 |
|
---|
20 | #include <vector>
|
---|
21 | #include <set>
|
---|
22 | #include <memory>
|
---|
23 | #include <iprt/thread.h>
|
---|
24 | #include <iprt/semaphore.h>
|
---|
25 |
|
---|
26 | #include "VirtualBoxBase.h"
|
---|
27 | #include "VirtualBoxClientListWrap.h"
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The IVirtualBoxClientList implementation.
|
---|
31 | *
|
---|
32 | * This class provides COM interface to track and get list of
|
---|
33 | * API client processes.
|
---|
34 | *
|
---|
35 | */
|
---|
36 |
|
---|
37 | typedef std::set<LONG> TClientSet;
|
---|
38 |
|
---|
39 | class CClientListWatcher;
|
---|
40 |
|
---|
41 | class ATL_NO_VTABLE VirtualBoxClientList
|
---|
42 | : public VirtualBoxClientListWrap
|
---|
43 | #ifdef RT_OS_WINDOWS
|
---|
44 | , public ATL::CComCoClass<VirtualBoxClientList, &CLSID_VirtualBoxClientList>
|
---|
45 | #endif
|
---|
46 | {
|
---|
47 | private:
|
---|
48 | /** Lock protecting m_ClientSet.*/
|
---|
49 | RTCRITSECTRW m_MapCritSect;
|
---|
50 | TClientSet m_ClientSet;
|
---|
51 |
|
---|
52 | public:
|
---|
53 | DECLARE_CLASSFACTORY_SINGLETON(VirtualBoxClientList)
|
---|
54 | DECLARE_NOT_AGGREGATABLE(VirtualBoxClientList)
|
---|
55 | VirtualBoxClientList() : m_pWatcher(NULL) {}
|
---|
56 | virtual ~VirtualBoxClientList() {}
|
---|
57 |
|
---|
58 | HRESULT FinalConstruct();
|
---|
59 | void FinalRelease();
|
---|
60 |
|
---|
61 | private:
|
---|
62 | // VirtualBoxClientList methods
|
---|
63 | HRESULT registerClient(LONG aPid);
|
---|
64 | HRESULT getClients(std::vector<LONG> &aEnvironment);
|
---|
65 |
|
---|
66 | // Private members
|
---|
67 | // polling of unexpectedly finished api client processes
|
---|
68 | CClientListWatcher* m_pWatcher;
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 |
|
---|
73 | #endif // !____H_VIRTUALBOXCLIENTLISTIMPL
|
---|