VirtualBox

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

Last change on this file since 6139 was 6136, checked in by vboxsync, 17 years ago

daemon is prototyped in the header of course.

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