1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox additions user session daemon.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2011 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 ___vboxclient_vboxclient_h
|
---|
19 | # define ___vboxclient_vboxclient_h
|
---|
20 |
|
---|
21 | #include <iprt/cpp/utils.h>
|
---|
22 |
|
---|
23 | /** Namespace for VBoxClient-specific things */
|
---|
24 | namespace VBoxClient {
|
---|
25 |
|
---|
26 | /** A simple class describing a service. VBoxClient will run exactly one
|
---|
27 | * service per invocation. */
|
---|
28 | class Service : public RTCNonCopyable
|
---|
29 | {
|
---|
30 | public:
|
---|
31 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
32 | /** @todo Should this also have a component relative to the X server number?
|
---|
33 | */
|
---|
34 | virtual const char *getPidFilePath() = 0;
|
---|
35 | /** Special initialisation, if needed. @a pause and @a resume are
|
---|
36 | * guaranteed not to be called until after this returns. */
|
---|
37 | virtual int init() { return VINF_SUCCESS; }
|
---|
38 | /** Run the service main loop */
|
---|
39 | virtual int run(bool fDaemonised = false) = 0;
|
---|
40 | /** Pause the service loop. This must be safe to call on a different thread
|
---|
41 | * and potentially before @a run is or after it exits.
|
---|
42 | * This is called by the VT monitoring thread to allow the service to disable
|
---|
43 | * itself when the X server is switched out. If the monitoring functionality
|
---|
44 | * is available then @a pause or @a resume will be called as soon as it starts
|
---|
45 | * up. */
|
---|
46 | virtual int pause() { return VINF_SUCCESS; }
|
---|
47 | /** Resume after pausing. The same applies here as for @a pause. */
|
---|
48 | virtual int resume() { return VINF_SUCCESS; }
|
---|
49 | /** Clean up any global resources before we shut down hard. The last calls
|
---|
50 | * to @a pause and @a resume are guaranteed to finish before this is called.
|
---|
51 | */
|
---|
52 | virtual void cleanup() = 0;
|
---|
53 | /** Virtual destructor. Not used */
|
---|
54 | virtual ~Service() {}
|
---|
55 | };
|
---|
56 |
|
---|
57 | extern Service *GetClipboardService();
|
---|
58 | extern Service *GetSeamlessService();
|
---|
59 | extern Service *GetDisplayService();
|
---|
60 | extern Service *GetHostVersionService();
|
---|
61 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
62 | extern Service *GetDragAndDropService();
|
---|
63 | #endif /* VBOX_WITH_DRAG_AND_DROP */
|
---|
64 |
|
---|
65 | extern void CleanUp();
|
---|
66 |
|
---|
67 | } /* namespace VBoxClient */
|
---|
68 |
|
---|
69 | #endif /* !___vboxclient_vboxclient_h */
|
---|