1 | /* $Id: VirtualBoxClientListImpl.h 76066 2018-12-07 22:17:39Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Main - VBoxSDS - VirtualBoxClientList.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2017-2018 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_VIRTUALBOXCLIENTLISTIMPL
|
---|
19 | #define ____H_VIRTUALBOXCLIENTLISTIMPL
|
---|
20 |
|
---|
21 | #include <vector>
|
---|
22 | #include <set>
|
---|
23 | #include <memory>
|
---|
24 | #include <iprt/thread.h>
|
---|
25 | #include <iprt/semaphore.h>
|
---|
26 |
|
---|
27 | #include "VirtualBoxBase.h"
|
---|
28 | #include "VirtualBoxClientListWrap.h"
|
---|
29 |
|
---|
30 | typedef std::set<LONG> TClientSet;
|
---|
31 |
|
---|
32 | class CClientListWatcher;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * The IVirtualBoxClientList implementation.
|
---|
36 | *
|
---|
37 | * This class provides COM interface to track and get list of
|
---|
38 | * API client processes.
|
---|
39 | */
|
---|
40 | class ATL_NO_VTABLE VirtualBoxClientList
|
---|
41 | : public VirtualBoxClientListWrap
|
---|
42 | #ifdef RT_OS_WINDOWS
|
---|
43 | , public ATL::CComCoClass<VirtualBoxClientList, &CLSID_VirtualBoxClientList>
|
---|
44 | #endif
|
---|
45 | {
|
---|
46 | private:
|
---|
47 | /** Lock protecting m_ClientSet.*/
|
---|
48 | RTCRITSECTRW m_MapCritSect;
|
---|
49 | TClientSet m_ClientSet;
|
---|
50 |
|
---|
51 | public:
|
---|
52 | DECLARE_CLASSFACTORY_SINGLETON(VirtualBoxClientList) /**< r=bird: It is _NOT_ a singleton. */
|
---|
53 | DECLARE_NOT_AGGREGATABLE(VirtualBoxClientList)
|
---|
54 | VirtualBoxClientList() : m_pWatcher(NULL) {}
|
---|
55 | virtual ~VirtualBoxClientList() {}
|
---|
56 |
|
---|
57 | HRESULT FinalConstruct();
|
---|
58 | void FinalRelease();
|
---|
59 |
|
---|
60 | private:
|
---|
61 | // VirtualBoxClientList methods
|
---|
62 | HRESULT registerClient(LONG aPid);
|
---|
63 | HRESULT getClients(std::vector<LONG> &aEnvironment);
|
---|
64 |
|
---|
65 | // Private members
|
---|
66 | // polling of unexpectedly finished api client processes
|
---|
67 | CClientListWatcher *m_pWatcher;
|
---|
68 | };
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | #endif // !____H_VIRTUALBOXCLIENTLISTIMPL
|
---|
73 |
|
---|