VirtualBox

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

最後變更 在這個檔案從96875是 96875,由 vboxsync 提交於 2 年 前

Aditions: X11: Consolidate all the environment variables we use at one place, bugref:10134.

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

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