[55401] | 1 | /* $Id: VBoxClient.h 101878 2023-11-06 15:36:24Z vboxsync $ */
|
---|
[18360] | 2 | /** @file
|
---|
| 3 | *
|
---|
| 4 | * VirtualBox additions user session daemon.
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | /*
|
---|
[98103] | 8 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[18360] | 9 | *
|
---|
[96407] | 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
|
---|
[18360] | 27 | */
|
---|
| 28 |
|
---|
[76563] | 29 | #ifndef GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
| 30 | #define GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
[76535] | 31 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 32 | # pragma once
|
---|
| 33 | #endif
|
---|
[18360] | 34 |
|
---|
[52231] | 35 | #include <VBox/log.h>
|
---|
[25346] | 36 | #include <iprt/cpp/utils.h>
|
---|
[52231] | 37 | #include <iprt/string.h>
|
---|
[18360] | 38 |
|
---|
[99620] | 39 | #include <VBox/GuestHost/DisplayServerType.h>
|
---|
[93551] | 40 |
|
---|
[101878] | 41 | /** A shortcut to log callback entering. */
|
---|
| 42 | #define VBCL_LOG_CALLBACK VBClLogVerbose(3, "%s\n", __func__)
|
---|
| 43 |
|
---|
[97732] | 44 | int VBClShowNotify(const char *pszHeader, const char *pszBody);
|
---|
| 45 |
|
---|
[81040] | 46 | void VBClLogInfo(const char *pszFormat, ...);
|
---|
| 47 | void VBClLogError(const char *pszFormat, ...);
|
---|
| 48 | void VBClLogFatalError(const char *pszFormat, ...);
|
---|
[86871] | 49 | void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
|
---|
| 50 |
|
---|
| 51 | int VBClLogCreate(const char *pszLogFile);
|
---|
[99658] | 52 | int VBClLogCreateEx(const char *pszLogFile, bool fPrintHeader);
|
---|
[99689] | 53 | int VBClLogModify(const char *pszDest, unsigned uVerbosity);
|
---|
[93220] | 54 | void VBClLogSetLogPrefix(const char *pszPrefix);
|
---|
[84501] | 55 | void VBClLogDestroy(void);
|
---|
[52231] | 56 |
|
---|
[52562] | 57 | /** Call clean-up for the current service and exit. */
|
---|
[86871] | 58 | extern void VBClShutdown(bool fExit = true);
|
---|
[18360] | 59 |
|
---|
[99620] | 60 | extern VBGHDISPLAYSERVERTYPE VBClGetDisplayServerType(void);
|
---|
[99585] | 61 |
|
---|
[86871] | 62 | /**
|
---|
| 63 | * A service descriptor.
|
---|
| 64 | */
|
---|
| 65 | typedef struct
|
---|
[18360] | 66 | {
|
---|
[86871] | 67 | /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
|
---|
| 68 | const char *pszName;
|
---|
| 69 | /** The longer service name. */
|
---|
| 70 | const char *pszDesc;
|
---|
[67755] | 71 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
[50431] | 72 | /** @todo Should this also have a component relative to the X server number?
|
---|
| 73 | */
|
---|
[98474] | 74 | const char *pszPidFilePathTemplate;
|
---|
[86871] | 75 | /** The usage options stuff for the --help screen. */
|
---|
| 76 | const char *pszUsage;
|
---|
| 77 | /** The option descriptions for the --help screen. */
|
---|
| 78 | const char *pszOptions;
|
---|
| 79 |
|
---|
| 80 | /**
|
---|
| 81 | * Tries to parse the given command line option.
|
---|
| 82 | *
|
---|
| 83 | * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
|
---|
| 84 | * @param ppszShort If not NULL it points to the short option iterator. a short argument.
|
---|
| 85 | * If NULL examine argv[*pi].
|
---|
| 86 | * @param argc The argument count.
|
---|
| 87 | * @param argv The argument vector.
|
---|
| 88 | * @param pi The argument vector index. Update if any value(s) are eaten.
|
---|
[50431] | 89 | */
|
---|
[86871] | 90 | DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
|
---|
[18360] | 91 |
|
---|
[86871] | 92 | /**
|
---|
| 93 | * Called before parsing arguments.
|
---|
| 94 | * @returns VBox status code, or
|
---|
| 95 | * VERR_NOT_AVAILABLE if service is supported on this platform in general but not available at the moment.
|
---|
| 96 | * VERR_NOT_SUPPORTED if service is not supported on this platform. */
|
---|
| 97 | DECLCALLBACKMEMBER(int, pfnInit,(void));
|
---|
[52562] | 98 |
|
---|
[86871] | 99 | /** Called from the worker thread.
|
---|
| 100 | *
|
---|
| 101 | * @returns VBox status code.
|
---|
| 102 | * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
|
---|
| 103 | * @param pfShutdown Pointer to a per service termination flag to check
|
---|
| 104 | * before and after blocking.
|
---|
| 105 | */
|
---|
| 106 | DECLCALLBACKMEMBER(int, pfnWorker,(bool volatile *pfShutdown));
|
---|
[52562] | 107 |
|
---|
[86871] | 108 | /**
|
---|
| 109 | * Asks the service to stop.
|
---|
| 110 | *
|
---|
| 111 | * @remarks Will be called from the signal handler.
|
---|
| 112 | */
|
---|
| 113 | DECLCALLBACKMEMBER(void, pfnStop,(void));
|
---|
[18360] | 114 |
|
---|
[86871] | 115 | /**
|
---|
| 116 | * Does termination cleanups.
|
---|
| 117 | *
|
---|
| 118 | * @remarks This will be called even if pfnInit hasn't been called or pfnStop failed!
|
---|
| 119 | */
|
---|
| 120 | DECLCALLBACKMEMBER(int, pfnTerm,(void));
|
---|
| 121 | } VBCLSERVICE;
|
---|
| 122 | /** Pointer to a VBCLSERVICE. */
|
---|
| 123 | typedef VBCLSERVICE *PVBCLSERVICE;
|
---|
| 124 | /** Pointer to a const VBCLSERVICE. */
|
---|
| 125 | typedef VBCLSERVICE const *PCVBCLSERVICE;
|
---|
| 126 |
|
---|
| 127 | RT_C_DECLS_BEGIN
|
---|
| 128 | extern VBCLSERVICE g_SvcClipboard;
|
---|
| 129 | extern VBCLSERVICE g_SvcDisplayDRM;
|
---|
| 130 | extern VBCLSERVICE g_SvcDisplaySVGA;
|
---|
[94306] | 131 | extern VBCLSERVICE g_SvcDisplayLegacy;
|
---|
[93385] | 132 | # ifdef RT_OS_LINUX
|
---|
[93220] | 133 | extern VBCLSERVICE g_SvcDisplaySVGASession;
|
---|
[93385] | 134 | # endif
|
---|
[86871] | 135 | extern VBCLSERVICE g_SvcDragAndDrop;
|
---|
| 136 | extern VBCLSERVICE g_SvcHostVersion;
|
---|
| 137 | extern VBCLSERVICE g_SvcSeamless;
|
---|
[100246] | 138 | # ifdef VBOX_WITH_WAYLAND_ADDITIONS
|
---|
| 139 | extern VBCLSERVICE g_SvcWayland;
|
---|
| 140 | # endif
|
---|
[86871] | 141 |
|
---|
[97732] | 142 | extern unsigned g_cVerbosity;
|
---|
[86871] | 143 | extern bool g_fDaemonized;
|
---|
| 144 | RT_C_DECLS_END
|
---|
| 145 |
|
---|
[76563] | 146 | #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
|
---|