VirtualBox

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

Last change on this file since 100246 was 100246, checked in by vboxsync, 18 months ago

Additions: Linux: Added a skeleton for Wayland service, bugref:10194.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
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
41int VBClShowNotify(const char *pszHeader, const char *pszBody);
42
43void VBClLogInfo(const char *pszFormat, ...);
44void VBClLogError(const char *pszFormat, ...);
45void VBClLogFatalError(const char *pszFormat, ...);
46void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
47
48int VBClLogCreate(const char *pszLogFile);
49int VBClLogCreateEx(const char *pszLogFile, bool fPrintHeader);
50int VBClLogModify(const char *pszDest, unsigned uVerbosity);
51void VBClLogSetLogPrefix(const char *pszPrefix);
52void VBClLogDestroy(void);
53
54/** Call clean-up for the current service and exit. */
55extern void VBClShutdown(bool fExit = true);
56
57extern VBGHDISPLAYSERVERTYPE VBClGetDisplayServerType(void);
58
59/**
60 * A service descriptor.
61 */
62typedef 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. */
120typedef VBCLSERVICE *PVBCLSERVICE;
121/** Pointer to a const VBCLSERVICE. */
122typedef VBCLSERVICE const *PCVBCLSERVICE;
123
124RT_C_DECLS_BEGIN
125extern VBCLSERVICE g_SvcClipboard;
126extern VBCLSERVICE g_SvcDisplayDRM;
127extern VBCLSERVICE g_SvcDisplaySVGA;
128extern VBCLSERVICE g_SvcDisplayLegacy;
129# ifdef RT_OS_LINUX
130extern VBCLSERVICE g_SvcDisplaySVGASession;
131# endif
132extern VBCLSERVICE g_SvcDragAndDrop;
133extern VBCLSERVICE g_SvcHostVersion;
134extern VBCLSERVICE g_SvcSeamless;
135# ifdef VBOX_WITH_WAYLAND_ADDITIONS
136extern VBCLSERVICE g_SvcWayland;
137# endif
138
139extern unsigned g_cVerbosity;
140extern bool g_fDaemonized;
141RT_C_DECLS_END
142
143#endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
Note: See TracBrowser for help on using the repository browser.

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