VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h@ 69083

Last change on this file since 69083 was 68660, checked in by vboxsync, 7 years ago

include/VBox/HostServices/*.h: Use VMMDevCoreTypes.h instead of VMMDev.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1/* $Id: VBoxServiceInternal.h 68660 2017-09-05 18:35:49Z vboxsync $ */
2/** @file
3 * VBoxService - Guest Additions Services.
4 */
5
6/*
7 * Copyright (C) 2007-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VBoxServiceInternal_h
19#define ___VBoxServiceInternal_h
20
21#include <stdio.h>
22#ifdef RT_OS_WINDOWS
23# include <iprt/win/windows.h>
24# include <process.h> /* Needed for file version information. */
25#endif
26
27#include <iprt/list.h>
28#include <iprt/critsect.h>
29#include <iprt/path.h> /* RTPATH_MAX */
30
31#include <VBox/VBoxGuestLib.h>
32#include <VBox/HostServices/GuestControlSvc.h>
33
34/**
35 * A service descriptor.
36 */
37typedef struct
38{
39 /** The short service name. */
40 const char *pszName;
41 /** The longer service name. */
42 const char *pszDescription;
43 /** The usage options stuff for the --help screen. */
44 const char *pszUsage;
45 /** The option descriptions for the --help screen. */
46 const char *pszOptions;
47
48 /**
49 * Called before parsing arguments.
50 * @returns VBox status code.
51 */
52 DECLCALLBACKMEMBER(int, pfnPreInit)(void);
53
54 /**
55 * Tries to parse the given command line option.
56 *
57 * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
58 * @param ppszShort If not NULL it points to the short option iterator. a short argument.
59 * If NULL examine argv[*pi].
60 * @param argc The argument count.
61 * @param argv The argument vector.
62 * @param pi The argument vector index. Update if any value(s) are eaten.
63 */
64 DECLCALLBACKMEMBER(int, pfnOption)(const char **ppszShort, int argc, char **argv, int *pi);
65
66 /**
67 * Called before parsing arguments.
68 * @returns VBox status code.
69 */
70 DECLCALLBACKMEMBER(int, pfnInit)(void);
71
72 /** Called from the worker thread.
73 *
74 * @returns VBox status code.
75 * @retval VINF_SUCCESS if exitting because *pfShutdown was set.
76 * @param pfShutdown Pointer to a per service termination flag to check
77 * before and after blocking.
78 */
79 DECLCALLBACKMEMBER(int, pfnWorker)(bool volatile *pfShutdown);
80
81 /**
82 * Stops a service.
83 */
84 DECLCALLBACKMEMBER(void, pfnStop)(void);
85
86 /**
87 * Does termination cleanups.
88 *
89 * @remarks This may be called even if pfnInit hasn't been called!
90 */
91 DECLCALLBACKMEMBER(void, pfnTerm)(void);
92} VBOXSERVICE;
93/** Pointer to a VBOXSERVICE. */
94typedef VBOXSERVICE *PVBOXSERVICE;
95/** Pointer to a const VBOXSERVICE. */
96typedef VBOXSERVICE const *PCVBOXSERVICE;
97
98/* Default call-backs for services which do not need special behaviour. */
99DECLCALLBACK(int) VGSvcDefaultPreInit(void);
100DECLCALLBACK(int) VGSvcDefaultOption(const char **ppszShort, int argc, char **argv, int *pi);
101DECLCALLBACK(int) VGSvcDefaultInit(void);
102DECLCALLBACK(void) VGSvcDefaultTerm(void);
103
104/** The service name.
105 * @note Used on windows to name the service as well as the global mutex. */
106#define VBOXSERVICE_NAME "VBoxService"
107
108#ifdef RT_OS_WINDOWS
109/** The friendly service name. */
110# define VBOXSERVICE_FRIENDLY_NAME "VirtualBox Guest Additions Service"
111/** The service description (only W2K+ atm) */
112# define VBOXSERVICE_DESCRIPTION "Manages VM runtime information, time synchronization, guest control execution and miscellaneous utilities for guest operating systems."
113/** The following constant may be defined by including NtStatus.h. */
114# define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
115#endif /* RT_OS_WINDOWS */
116
117#ifdef VBOX_WITH_GUEST_PROPS
118/**
119 * A guest property cache.
120 */
121typedef struct VBOXSERVICEVEPROPCACHE
122{
123 /** The client ID for HGCM communication. */
124 uint32_t uClientID;
125 /** Head in a list of VBOXSERVICEVEPROPCACHEENTRY nodes. */
126 RTLISTANCHOR NodeHead;
127 /** Critical section for thread-safe use. */
128 RTCRITSECT CritSect;
129} VBOXSERVICEVEPROPCACHE;
130/** Pointer to a guest property cache. */
131typedef VBOXSERVICEVEPROPCACHE *PVBOXSERVICEVEPROPCACHE;
132
133/**
134 * An entry in the property cache (VBOXSERVICEVEPROPCACHE).
135 */
136typedef struct VBOXSERVICEVEPROPCACHEENTRY
137{
138 /** Node to successor.
139 * @todo r=bird: This is not really the node to the successor, but
140 * rather the OUR node in the list. If it helps, remember that
141 * its a doubly linked list. */
142 RTLISTNODE NodeSucc;
143 /** Name (and full path) of guest property. */
144 char *pszName;
145 /** The last value stored (for reference). */
146 char *pszValue;
147 /** Reset value to write if property is temporary. If NULL, it will be
148 * deleted. */
149 char *pszValueReset;
150 /** Flags. */
151 uint32_t fFlags;
152} VBOXSERVICEVEPROPCACHEENTRY;
153/** Pointer to a cached guest property. */
154typedef VBOXSERVICEVEPROPCACHEENTRY *PVBOXSERVICEVEPROPCACHEENTRY;
155
156#endif /* VBOX_WITH_GUEST_PROPS */
157
158RT_C_DECLS_BEGIN
159
160extern char *g_pszProgName;
161extern unsigned g_cVerbosity;
162extern char g_szLogFile[RTPATH_MAX + 128];
163extern uint32_t g_DefaultInterval;
164extern VBOXSERVICE g_TimeSync;
165extern VBOXSERVICE g_Clipboard;
166extern VBOXSERVICE g_Control;
167extern VBOXSERVICE g_VMInfo;
168extern VBOXSERVICE g_CpuHotPlug;
169#ifdef VBOX_WITH_VBOXSERVICE_MANAGEMENT
170extern VBOXSERVICE g_MemBalloon;
171extern VBOXSERVICE g_VMStatistics;
172#endif
173#ifdef VBOX_WITH_VBOXSERVICE_PAGE_SHARING
174extern VBOXSERVICE g_PageSharing;
175#endif
176#ifdef VBOX_WITH_SHARED_FOLDERS
177extern VBOXSERVICE g_AutoMount;
178#endif
179#ifdef DEBUG
180extern RTCRITSECT g_csLog; /* For guest process stdout dumping. */
181#endif
182
183extern RTEXITCODE VGSvcSyntax(const char *pszFormat, ...);
184extern RTEXITCODE VGSvcError(const char *pszFormat, ...);
185extern void VGSvcVerbose(unsigned iLevel, const char *pszFormat, ...);
186extern int VGSvcLogCreate(const char *pszLogFile);
187extern void VGSvcLogDestroy(void);
188extern int VGSvcArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32,
189 uint32_t u32Min, uint32_t u32Max);
190
191/* Exposing the following bits because of windows: */
192extern int VGSvcStartServices(void);
193extern int VGSvcStopServices(void);
194extern void VGSvcMainWait(void);
195extern int VGSvcReportStatus(VBoxGuestFacilityStatus enmStatus);
196#ifdef RT_OS_WINDOWS
197extern RTEXITCODE VGSvcWinInstall(void);
198extern RTEXITCODE VGSvcWinUninstall(void);
199extern RTEXITCODE VGSvcWinEnterCtrlDispatcher(void);
200extern void VGSvcWinSetStopPendingStatus(uint32_t uCheckPoint);
201#endif
202
203#ifdef RT_OS_WINDOWS
204# ifdef VBOX_WITH_GUEST_PROPS
205extern int VGSvcVMInfoWinWriteUsers(PVBOXSERVICEVEPROPCACHE pCache, char **ppszUserList, uint32_t *pcUsersInList);
206extern int VGSvcVMInfoWinGetComponentVersions(uint32_t uClientID);
207# endif /* VBOX_WITH_GUEST_PROPS */
208#endif /* RT_OS_WINDOWS */
209
210#ifdef VBOX_WITH_VBOXSERVICE_MANAGEMENT
211extern uint32_t VGSvcBalloonQueryPages(uint32_t cbPage);
212#endif
213#if defined(VBOX_WITH_VBOXSERVICE_PAGE_SHARING)
214extern RTEXITCODE VGSvcPageSharingWorkerChild(void);
215#endif
216extern int VGSvcVMInfoSignal(void);
217
218RT_C_DECLS_END
219
220#endif
221
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