1 | /* $Id: VBoxClient.h 100246 2023-06-22 10:55:10Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VirtualBox additions user session daemon.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifndef GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
30 | #define GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
31 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
32 | # pragma once
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #include <VBox/log.h>
|
---|
36 | #include <iprt/cpp/utils.h>
|
---|
37 | #include <iprt/string.h>
|
---|
38 |
|
---|
39 | #include <VBox/GuestHost/DisplayServerType.h>
|
---|
40 |
|
---|
41 | int VBClShowNotify(const char *pszHeader, const char *pszBody);
|
---|
42 |
|
---|
43 | void VBClLogInfo(const char *pszFormat, ...);
|
---|
44 | void VBClLogError(const char *pszFormat, ...);
|
---|
45 | void VBClLogFatalError(const char *pszFormat, ...);
|
---|
46 | void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
|
---|
47 |
|
---|
48 | int VBClLogCreate(const char *pszLogFile);
|
---|
49 | int VBClLogCreateEx(const char *pszLogFile, bool fPrintHeader);
|
---|
50 | int VBClLogModify(const char *pszDest, unsigned uVerbosity);
|
---|
51 | void VBClLogSetLogPrefix(const char *pszPrefix);
|
---|
52 | void VBClLogDestroy(void);
|
---|
53 |
|
---|
54 | /** Call clean-up for the current service and exit. */
|
---|
55 | extern void VBClShutdown(bool fExit = true);
|
---|
56 |
|
---|
57 | extern VBGHDISPLAYSERVERTYPE VBClGetDisplayServerType(void);
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * A service descriptor.
|
---|
61 | */
|
---|
62 | typedef struct
|
---|
63 | {
|
---|
64 | /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
|
---|
65 | const char *pszName;
|
---|
66 | /** The longer service name. */
|
---|
67 | const char *pszDesc;
|
---|
68 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
69 | /** @todo Should this also have a component relative to the X server number?
|
---|
70 | */
|
---|
71 | const char *pszPidFilePathTemplate;
|
---|
72 | /** The usage options stuff for the --help screen. */
|
---|
73 | const char *pszUsage;
|
---|
74 | /** The option descriptions for the --help screen. */
|
---|
75 | const char *pszOptions;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Tries to parse the given command line option.
|
---|
79 | *
|
---|
80 | * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
|
---|
81 | * @param ppszShort If not NULL it points to the short option iterator. a short argument.
|
---|
82 | * If NULL examine argv[*pi].
|
---|
83 | * @param argc The argument count.
|
---|
84 | * @param argv The argument vector.
|
---|
85 | * @param pi The argument vector index. Update if any value(s) are eaten.
|
---|
86 | */
|
---|
87 | DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Called before parsing arguments.
|
---|
91 | * @returns VBox status code, or
|
---|
92 | * VERR_NOT_AVAILABLE if service is supported on this platform in general but not available at the moment.
|
---|
93 | * VERR_NOT_SUPPORTED if service is not supported on this platform. */
|
---|
94 | DECLCALLBACKMEMBER(int, pfnInit,(void));
|
---|
95 |
|
---|
96 | /** Called from the worker thread.
|
---|
97 | *
|
---|
98 | * @returns VBox status code.
|
---|
99 | * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
|
---|
100 | * @param pfShutdown Pointer to a per service termination flag to check
|
---|
101 | * before and after blocking.
|
---|
102 | */
|
---|
103 | DECLCALLBACKMEMBER(int, pfnWorker,(bool volatile *pfShutdown));
|
---|
104 |
|
---|
105 | /**
|
---|
106 | * Asks the service to stop.
|
---|
107 | *
|
---|
108 | * @remarks Will be called from the signal handler.
|
---|
109 | */
|
---|
110 | DECLCALLBACKMEMBER(void, pfnStop,(void));
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Does termination cleanups.
|
---|
114 | *
|
---|
115 | * @remarks This will be called even if pfnInit hasn't been called or pfnStop failed!
|
---|
116 | */
|
---|
117 | DECLCALLBACKMEMBER(int, pfnTerm,(void));
|
---|
118 | } VBCLSERVICE;
|
---|
119 | /** Pointer to a VBCLSERVICE. */
|
---|
120 | typedef VBCLSERVICE *PVBCLSERVICE;
|
---|
121 | /** Pointer to a const VBCLSERVICE. */
|
---|
122 | typedef VBCLSERVICE const *PCVBCLSERVICE;
|
---|
123 |
|
---|
124 | RT_C_DECLS_BEGIN
|
---|
125 | extern VBCLSERVICE g_SvcClipboard;
|
---|
126 | extern VBCLSERVICE g_SvcDisplayDRM;
|
---|
127 | extern VBCLSERVICE g_SvcDisplaySVGA;
|
---|
128 | extern VBCLSERVICE g_SvcDisplayLegacy;
|
---|
129 | # ifdef RT_OS_LINUX
|
---|
130 | extern VBCLSERVICE g_SvcDisplaySVGASession;
|
---|
131 | # endif
|
---|
132 | extern VBCLSERVICE g_SvcDragAndDrop;
|
---|
133 | extern VBCLSERVICE g_SvcHostVersion;
|
---|
134 | extern VBCLSERVICE g_SvcSeamless;
|
---|
135 | # ifdef VBOX_WITH_WAYLAND_ADDITIONS
|
---|
136 | extern VBCLSERVICE g_SvcWayland;
|
---|
137 | # endif
|
---|
138 |
|
---|
139 | extern unsigned g_cVerbosity;
|
---|
140 | extern bool g_fDaemonized;
|
---|
141 | RT_C_DECLS_END
|
---|
142 |
|
---|
143 | #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
|
---|