1 | /* $Id: VBoxServiceInternal.h 8155 2008-04-18 15:16:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxService - Guest Additions Services.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___VBoxServiceInternal_h
|
---|
23 | #define ___VBoxServiceInternal_h
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * A service descriptor.
|
---|
27 | */
|
---|
28 | typedef struct
|
---|
29 | {
|
---|
30 | /** The short service name. */
|
---|
31 | const char *pszName;
|
---|
32 | /** The longer service name. */
|
---|
33 | const char *pszDescription;
|
---|
34 | /** The usage options stuff for the --help screen. */
|
---|
35 | const char *pszUsage;
|
---|
36 | /** The option descriptions for the --help screen. */
|
---|
37 | const char *pszOptions;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Called before parsing arguments.
|
---|
41 | * @returns VBox status code.
|
---|
42 | */
|
---|
43 | DECLCALLBACKMEMBER(int, pfnPreInit)(void);
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Tries to parse the given command line option.
|
---|
47 | *
|
---|
48 | * @returns 0 if we parsed, -1 if it didn't and anything else means exit.
|
---|
49 | * @param ppszShort If not NULL it points to the short option iterator. a short argument.
|
---|
50 | * If NULL examine argv[*pi].
|
---|
51 | * @param argc The argument count.
|
---|
52 | * @param argv The argument vector.
|
---|
53 | * @param pi The argument vector index. Update if any value(s) are eaten.
|
---|
54 | */
|
---|
55 | DECLCALLBACKMEMBER(int, pfnOption)(const char **ppszShort, int argc, char **argv, int *pi);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Called before parsing arguments.
|
---|
59 | * @returns VBox status code.
|
---|
60 | */
|
---|
61 | DECLCALLBACKMEMBER(int, pfnInit)(void);
|
---|
62 |
|
---|
63 | /** Called from the worker thread.
|
---|
64 | *
|
---|
65 | * @returns VBox status code.
|
---|
66 | * @retval VINF_SUCCESS if exitting because *pfTerminate was set.
|
---|
67 | * @param pfTerminate Pointer to a per service termination flag to check
|
---|
68 | * before and after blocking.
|
---|
69 | */
|
---|
70 | DECLCALLBACKMEMBER(int, pfnWorker)(bool volatile *pfTerminate);
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Stop an service.
|
---|
74 | */
|
---|
75 | DECLCALLBACKMEMBER(void, pfnStop)(void);
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Does termination cleanups.
|
---|
79 | */
|
---|
80 | DECLCALLBACKMEMBER(void, pfnTerm)(void);
|
---|
81 | } VBOXSERVICE;
|
---|
82 | /** Pointer to a VBOXSERVICE. */
|
---|
83 | typedef VBOXSERVICE *PVBOXSERVICE;
|
---|
84 | /** Pointer to a const VBOXSERVICE. */
|
---|
85 | typedef VBOXSERVICE const *PCVBOXSERVICE;
|
---|
86 |
|
---|
87 |
|
---|
88 | __BEGIN_DECLS
|
---|
89 |
|
---|
90 | extern char *g_pszProgName;
|
---|
91 | extern int g_cVerbosity;
|
---|
92 | extern uint32_t g_DefaultInterval;
|
---|
93 |
|
---|
94 | extern int VBoxServiceSyntax(const char *pszFormat, ...);
|
---|
95 | extern int VBoxServiceError(const char *pszFormat, ...);
|
---|
96 | extern void VBoxServiceVerbose(int iLevel, const char *pszFormat, ...);
|
---|
97 | extern int VBoxServiceArgUInt32(int argc, char **argv, const char *psz, int *pi, uint32_t *pu32, uint32_t u32Min, uint32_t u32Max);
|
---|
98 |
|
---|
99 | extern VBOXSERVICE g_TimeSync;
|
---|
100 | extern VBOXSERVICE g_Clipboard;
|
---|
101 | extern VBOXSERVICE g_Control;
|
---|
102 |
|
---|
103 | __END_DECLS
|
---|
104 |
|
---|
105 | #endif
|
---|
106 |
|
---|