VirtualBox

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

Last change on this file since 96407 was 96407, checked in by vboxsync, 3 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1/* $Id: VBoxClient.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox additions user session daemon.
5 */
6
7/*
8 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.215389.xyz.
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/** Environment variable which is exported when in Wayland Desktop Environment. */
40#define VBCL_ENV_WAYLAND_DISPLAY "WAYLAND_DISPLAY"
41
42void VBClLogInfo(const char *pszFormat, ...);
43void VBClLogError(const char *pszFormat, ...);
44void VBClLogFatalError(const char *pszFormat, ...);
45void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
46
47int VBClLogCreate(const char *pszLogFile);
48void VBClLogSetLogPrefix(const char *pszPrefix);
49void VBClLogDestroy(void);
50
51/**
52 * Detect if user is running on Wayland by checking corresponding environment variable.
53 *
54 * @returns True if Wayland has been detected, False otherwise.
55 */
56extern bool VBClHasWayland(void);
57
58/** Call clean-up for the current service and exit. */
59extern void VBClShutdown(bool fExit = true);
60
61/**
62 * A service descriptor.
63 */
64typedef struct
65{
66 /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
67 const char *pszName;
68 /** The longer service name. */
69 const char *pszDesc;
70 /** Get the services default path to pidfile, relative to $HOME */
71 /** @todo Should this also have a component relative to the X server number?
72 */
73 const char *pszPidFilePath;
74 /** The usage options stuff for the --help screen. */
75 const char *pszUsage;
76 /** The option descriptions for the --help screen. */
77 const char *pszOptions;
78
79 /**
80 * Tries to parse the given command line option.
81 *
82 * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
83 * @param ppszShort If not NULL it points to the short option iterator. a short argument.
84 * If NULL examine argv[*pi].
85 * @param argc The argument count.
86 * @param argv The argument vector.
87 * @param pi The argument vector index. Update if any value(s) are eaten.
88 */
89 DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
90
91 /**
92 * Called before parsing arguments.
93 * @returns VBox status code, or
94 * VERR_NOT_AVAILABLE if service is supported on this platform in general but not available at the moment.
95 * VERR_NOT_SUPPORTED if service is not supported on this platform. */
96 DECLCALLBACKMEMBER(int, pfnInit,(void));
97
98 /** Called from the worker thread.
99 *
100 * @returns VBox status code.
101 * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
102 * @param pfShutdown Pointer to a per service termination flag to check
103 * before and after blocking.
104 */
105 DECLCALLBACKMEMBER(int, pfnWorker,(bool volatile *pfShutdown));
106
107 /**
108 * Asks the service to stop.
109 *
110 * @remarks Will be called from the signal handler.
111 */
112 DECLCALLBACKMEMBER(void, pfnStop,(void));
113
114 /**
115 * Does termination cleanups.
116 *
117 * @remarks This will be called even if pfnInit hasn't been called or pfnStop failed!
118 */
119 DECLCALLBACKMEMBER(int, pfnTerm,(void));
120} VBCLSERVICE;
121/** Pointer to a VBCLSERVICE. */
122typedef VBCLSERVICE *PVBCLSERVICE;
123/** Pointer to a const VBCLSERVICE. */
124typedef VBCLSERVICE const *PCVBCLSERVICE;
125
126RT_C_DECLS_BEGIN
127extern VBCLSERVICE g_SvcClipboard;
128extern VBCLSERVICE g_SvcDisplayDRM;
129extern VBCLSERVICE g_SvcDisplaySVGA;
130extern VBCLSERVICE g_SvcDisplayLegacy;
131# ifdef RT_OS_LINUX
132extern VBCLSERVICE g_SvcDisplaySVGASession;
133# endif
134extern VBCLSERVICE g_SvcDragAndDrop;
135extern VBCLSERVICE g_SvcHostVersion;
136extern VBCLSERVICE g_SvcSeamless;
137
138extern bool g_fDaemonized;
139RT_C_DECLS_END
140
141#endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
Note: See TracBrowser for help on using the repository browser.

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