VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/VBoxClient.h@ 52231

Last change on this file since 52231 was 52231, checked in by vboxsync, 11 years ago

Additions/x11/VBoxClient: make fatal error notification application-global.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
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.215389.xyz. 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 <VBox/log.h>
22#include <iprt/cpp/utils.h>
23#include <iprt/string.h>
24
25/** Exit with a fatal error. */
26#define FatalError(format) \
27do { \
28 char *pszMessage = RTStrAPrintf2 format; \
29 LogRel(format); \
30 doFatalError(pszMessage); \
31} while(0)
32
33/** Exit with a fatal error. */
34extern void doFatalError(char *pszMessage);
35
36/** Namespace for VBoxClient-specific things */
37namespace VBoxClient {
38
39/** A simple class describing a service. VBoxClient will run exactly one
40 * service per invocation. */
41class Service : public RTCNonCopyable
42{
43public:
44 /** Get the services default path to pidfile, relative to $HOME */
45 /** @todo Should this also have a component relative to the X server number?
46 */
47 virtual const char *getPidFilePath() = 0;
48 /** Special initialisation, if needed. @a pause and @a resume are
49 * guaranteed not to be called until after this returns. */
50 virtual int init() { return VINF_SUCCESS; }
51 /** Run the service main loop */
52 virtual int run(bool fDaemonised = false) = 0;
53 /** Pause the service loop. This must be safe to call on a different thread
54 * and potentially before @a run is or after it exits.
55 * This is called by the VT monitoring thread to allow the service to disable
56 * itself when the X server is switched out. If the monitoring functionality
57 * is available then @a pause or @a resume will be called as soon as it starts
58 * up. */
59 virtual int pause() { return VINF_SUCCESS; }
60 /** Resume after pausing. The same applies here as for @a pause. */
61 virtual int resume() { return VINF_SUCCESS; }
62 /** Clean up any global resources before we shut down hard. The last calls
63 * to @a pause and @a resume are guaranteed to finish before this is called.
64 */
65 virtual void cleanup() = 0;
66 /** Virtual destructor. Not used */
67 virtual ~Service() {}
68};
69
70extern Service *GetClipboardService();
71extern Service *GetSeamlessService();
72extern Service *GetDisplayService();
73extern Service *GetHostVersionService();
74#ifdef VBOX_WITH_DRAG_AND_DROP
75extern Service *GetDragAndDropService();
76#endif /* VBOX_WITH_DRAG_AND_DROP */
77
78extern void CleanUp();
79
80} /* namespace VBoxClient */
81
82#endif /* !___vboxclient_vboxclient_h */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette