1 | /* $Id: VBoxClient.h 99585 2023-05-03 15:12:56Z 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/Log.h>
|
---|
40 | #include <VBox/GuestHost/SessionType.h>
|
---|
41 |
|
---|
42 | int VBClShowNotify(const char *pszHeader, const char *pszBody);
|
---|
43 |
|
---|
44 | void VBClLogInfo(const char *pszFormat, ...);
|
---|
45 | void VBClLogError(const char *pszFormat, ...);
|
---|
46 | void VBClLogFatalError(const char *pszFormat, ...);
|
---|
47 | void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
|
---|
48 |
|
---|
49 | int VBClLogCreate(const char *pszLogFile);
|
---|
50 | void VBClLogSetLogPrefix(const char *pszPrefix);
|
---|
51 | void VBClLogDestroy(void);
|
---|
52 |
|
---|
53 | /** Call clean-up for the current service and exit. */
|
---|
54 | extern void VBClShutdown(bool fExit = true);
|
---|
55 |
|
---|
56 | extern VBGHSESSIONTYPE VBClGetSessionType(void);
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * A service descriptor.
|
---|
60 | */
|
---|
61 | typedef struct
|
---|
62 | {
|
---|
63 | /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
|
---|
64 | const char *pszName;
|
---|
65 | /** The longer service name. */
|
---|
66 | const char *pszDesc;
|
---|
67 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
68 | /** @todo Should this also have a component relative to the X server number?
|
---|
69 | */
|
---|
70 | const char *pszPidFilePathTemplate;
|
---|
71 | /** The usage options stuff for the --help screen. */
|
---|
72 | const char *pszUsage;
|
---|
73 | /** The option descriptions for the --help screen. */
|
---|
74 | const char *pszOptions;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Tries to parse the given command line option.
|
---|
78 | *
|
---|
79 | * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
|
---|
80 | * @param ppszShort If not NULL it points to the short option iterator. a short argument.
|
---|
81 | * If NULL examine argv[*pi].
|
---|
82 | * @param argc The argument count.
|
---|
83 | * @param argv The argument vector.
|
---|
84 | * @param pi The argument vector index. Update if any value(s) are eaten.
|
---|
85 | */
|
---|
86 | DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Called before parsing arguments.
|
---|
90 | * @returns VBox status code, or
|
---|
91 | * VERR_NOT_AVAILABLE if service is supported on this platform in general but not available at the moment.
|
---|
92 | * VERR_NOT_SUPPORTED if service is not supported on this platform. */
|
---|
93 | DECLCALLBACKMEMBER(int, pfnInit,(void));
|
---|
94 |
|
---|
95 | /** Called from the worker thread.
|
---|
96 | *
|
---|
97 | * @returns VBox status code.
|
---|
98 | * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
|
---|
99 | * @param pfShutdown Pointer to a per service termination flag to check
|
---|
100 | * before and after blocking.
|
---|
101 | */
|
---|
102 | DECLCALLBACKMEMBER(int, pfnWorker,(bool volatile *pfShutdown));
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Asks the service to stop.
|
---|
106 | *
|
---|
107 | * @remarks Will be called from the signal handler.
|
---|
108 | */
|
---|
109 | DECLCALLBACKMEMBER(void, pfnStop,(void));
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Does termination cleanups.
|
---|
113 | *
|
---|
114 | * @remarks This will be called even if pfnInit hasn't been called or pfnStop failed!
|
---|
115 | */
|
---|
116 | DECLCALLBACKMEMBER(int, pfnTerm,(void));
|
---|
117 | } VBCLSERVICE;
|
---|
118 | /** Pointer to a VBCLSERVICE. */
|
---|
119 | typedef VBCLSERVICE *PVBCLSERVICE;
|
---|
120 | /** Pointer to a const VBCLSERVICE. */
|
---|
121 | typedef VBCLSERVICE const *PCVBCLSERVICE;
|
---|
122 |
|
---|
123 | RT_C_DECLS_BEGIN
|
---|
124 | extern VBCLSERVICE g_SvcClipboard;
|
---|
125 | extern VBCLSERVICE g_SvcDisplayDRM;
|
---|
126 | extern VBCLSERVICE g_SvcDisplaySVGA;
|
---|
127 | extern VBCLSERVICE g_SvcDisplayLegacy;
|
---|
128 | # ifdef RT_OS_LINUX
|
---|
129 | extern VBCLSERVICE g_SvcDisplaySVGASession;
|
---|
130 | # endif
|
---|
131 | extern VBCLSERVICE g_SvcDragAndDrop;
|
---|
132 | extern VBCLSERVICE g_SvcHostVersion;
|
---|
133 | extern VBCLSERVICE g_SvcSeamless;
|
---|
134 |
|
---|
135 | extern unsigned g_cVerbosity;
|
---|
136 | extern bool g_fDaemonized;
|
---|
137 | RT_C_DECLS_END
|
---|
138 |
|
---|
139 | #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
|
---|