[55401] | 1 | /* $Id: VBoxClient.h 100246 2023-06-22 10:55:10Z 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 |
|
---|
[97732] | 41 | int VBClShowNotify(const char *pszHeader, const char *pszBody);
|
---|
| 42 |
|
---|
[81040] | 43 | void VBClLogInfo(const char *pszFormat, ...);
|
---|
| 44 | void VBClLogError(const char *pszFormat, ...);
|
---|
| 45 | void VBClLogFatalError(const char *pszFormat, ...);
|
---|
[86871] | 46 | void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
|
---|
| 47 |
|
---|
| 48 | int VBClLogCreate(const char *pszLogFile);
|
---|
[99658] | 49 | int VBClLogCreateEx(const char *pszLogFile, bool fPrintHeader);
|
---|
[99689] | 50 | int VBClLogModify(const char *pszDest, unsigned uVerbosity);
|
---|
[93220] | 51 | void VBClLogSetLogPrefix(const char *pszPrefix);
|
---|
[84501] | 52 | void VBClLogDestroy(void);
|
---|
[52231] | 53 |
|
---|
[52562] | 54 | /** Call clean-up for the current service and exit. */
|
---|
[86871] | 55 | extern void VBClShutdown(bool fExit = true);
|
---|
[18360] | 56 |
|
---|
[99620] | 57 | extern VBGHDISPLAYSERVERTYPE VBClGetDisplayServerType(void);
|
---|
[99585] | 58 |
|
---|
[86871] | 59 | /**
|
---|
| 60 | * A service descriptor.
|
---|
| 61 | */
|
---|
| 62 | typedef struct
|
---|
[18360] | 63 | {
|
---|
[86871] | 64 | /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
|
---|
| 65 | const char *pszName;
|
---|
| 66 | /** The longer service name. */
|
---|
| 67 | const char *pszDesc;
|
---|
[67755] | 68 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
[50431] | 69 | /** @todo Should this also have a component relative to the X server number?
|
---|
| 70 | */
|
---|
[98474] | 71 | const char *pszPidFilePathTemplate;
|
---|
[86871] | 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.
|
---|
[50431] | 86 | */
|
---|
[86871] | 87 | DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
|
---|
[18360] | 88 |
|
---|
[86871] | 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));
|
---|
[52562] | 95 |
|
---|
[86871] | 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));
|
---|
[52562] | 104 |
|
---|
[86871] | 105 | /**
|
---|
| 106 | * Asks the service to stop.
|
---|
| 107 | *
|
---|
| 108 | * @remarks Will be called from the signal handler.
|
---|
| 109 | */
|
---|
| 110 | DECLCALLBACKMEMBER(void, pfnStop,(void));
|
---|
[18360] | 111 |
|
---|
[86871] | 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;
|
---|
[94306] | 128 | extern VBCLSERVICE g_SvcDisplayLegacy;
|
---|
[93385] | 129 | # ifdef RT_OS_LINUX
|
---|
[93220] | 130 | extern VBCLSERVICE g_SvcDisplaySVGASession;
|
---|
[93385] | 131 | # endif
|
---|
[86871] | 132 | extern VBCLSERVICE g_SvcDragAndDrop;
|
---|
| 133 | extern VBCLSERVICE g_SvcHostVersion;
|
---|
| 134 | extern VBCLSERVICE g_SvcSeamless;
|
---|
[100246] | 135 | # ifdef VBOX_WITH_WAYLAND_ADDITIONS
|
---|
| 136 | extern VBCLSERVICE g_SvcWayland;
|
---|
| 137 | # endif
|
---|
[86871] | 138 |
|
---|
[97732] | 139 | extern unsigned g_cVerbosity;
|
---|
[86871] | 140 | extern bool g_fDaemonized;
|
---|
| 141 | RT_C_DECLS_END
|
---|
| 142 |
|
---|
[76563] | 143 | #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
|
---|