1 | /* $Id: VBoxClient.h 86871 2020-11-12 10:15:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VirtualBox additions user session daemon.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
20 | #define GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h
|
---|
21 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
22 | # pragma once
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include <VBox/log.h>
|
---|
26 | #include <iprt/cpp/utils.h>
|
---|
27 | #include <iprt/string.h>
|
---|
28 |
|
---|
29 | void VBClLogInfo(const char *pszFormat, ...);
|
---|
30 | void VBClLogError(const char *pszFormat, ...);
|
---|
31 | void VBClLogFatalError(const char *pszFormat, ...);
|
---|
32 | void VBClLogVerbose(unsigned iLevel, const char *pszFormat, ...);
|
---|
33 |
|
---|
34 | int VBClLogCreate(const char *pszLogFile);
|
---|
35 | void VBClLogDestroy(void);
|
---|
36 |
|
---|
37 | /** Call clean-up for the current service and exit. */
|
---|
38 | extern void VBClShutdown(bool fExit = true);
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * A service descriptor.
|
---|
42 | */
|
---|
43 | typedef struct
|
---|
44 | {
|
---|
45 | /** The short service name. 16 chars maximum (RTTHREAD_NAME_LEN). */
|
---|
46 | const char *pszName;
|
---|
47 | /** The longer service name. */
|
---|
48 | const char *pszDesc;
|
---|
49 | /** Get the services default path to pidfile, relative to $HOME */
|
---|
50 | /** @todo Should this also have a component relative to the X server number?
|
---|
51 | */
|
---|
52 | const char *pszPidFilePath;
|
---|
53 | /** The usage options stuff for the --help screen. */
|
---|
54 | const char *pszUsage;
|
---|
55 | /** The option descriptions for the --help screen. */
|
---|
56 | const char *pszOptions;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Tries to parse the given command line option.
|
---|
60 | *
|
---|
61 | * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
|
---|
62 | * @param ppszShort If not NULL it points to the short option iterator. a short argument.
|
---|
63 | * If NULL examine argv[*pi].
|
---|
64 | * @param argc The argument count.
|
---|
65 | * @param argv The argument vector.
|
---|
66 | * @param pi The argument vector index. Update if any value(s) are eaten.
|
---|
67 | */
|
---|
68 | DECLCALLBACKMEMBER(int, pfnOption,(const char **ppszShort, int argc, char **argv, int *pi));
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Called before parsing arguments.
|
---|
72 | * @returns VBox status code, or
|
---|
73 | * VERR_NOT_AVAILABLE if service is supported on this platform in general but not available at the moment.
|
---|
74 | * VERR_NOT_SUPPORTED if service is not supported on this platform. */
|
---|
75 | DECLCALLBACKMEMBER(int, pfnInit,(void));
|
---|
76 |
|
---|
77 | /** Called from the worker thread.
|
---|
78 | *
|
---|
79 | * @returns VBox status code.
|
---|
80 | * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
|
---|
81 | * @param pfShutdown Pointer to a per service termination flag to check
|
---|
82 | * before and after blocking.
|
---|
83 | */
|
---|
84 | DECLCALLBACKMEMBER(int, pfnWorker,(bool volatile *pfShutdown));
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Asks the service to stop.
|
---|
88 | *
|
---|
89 | * @remarks Will be called from the signal handler.
|
---|
90 | */
|
---|
91 | DECLCALLBACKMEMBER(void, pfnStop,(void));
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Does termination cleanups.
|
---|
95 | *
|
---|
96 | * @remarks This will be called even if pfnInit hasn't been called or pfnStop failed!
|
---|
97 | */
|
---|
98 | DECLCALLBACKMEMBER(int, pfnTerm,(void));
|
---|
99 | } VBCLSERVICE;
|
---|
100 | /** Pointer to a VBCLSERVICE. */
|
---|
101 | typedef VBCLSERVICE *PVBCLSERVICE;
|
---|
102 | /** Pointer to a const VBCLSERVICE. */
|
---|
103 | typedef VBCLSERVICE const *PCVBCLSERVICE;
|
---|
104 |
|
---|
105 | RT_C_DECLS_BEGIN
|
---|
106 | extern VBCLSERVICE g_SvcClipboard;
|
---|
107 | extern VBCLSERVICE g_SvcDisplayDRM;
|
---|
108 | extern VBCLSERVICE g_SvcDisplaySVGA;
|
---|
109 | extern VBCLSERVICE g_SvcDragAndDrop;
|
---|
110 | extern VBCLSERVICE g_SvcHostVersion;
|
---|
111 | extern VBCLSERVICE g_SvcSeamless;
|
---|
112 |
|
---|
113 | extern bool g_fDaemonized;
|
---|
114 | RT_C_DECLS_END
|
---|
115 |
|
---|
116 | #endif /* !GA_INCLUDED_SRC_x11_VBoxClient_VBoxClient_h */
|
---|