OmniEvents
Main Page
Namespaces
Classes
Files
File List
File Members
daemon_windows.h
Go to the documentation of this file.
1
// Package : omniEvents
2
// daemon_windows.h Created : 2004/07/30
3
// Author : Alex Tingle
4
//
5
// Copyright (C) 2004 Alex Tingle.
6
//
7
// This file is part of the omniEvents application.
8
//
9
// omniEvents is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
13
//
14
// omniEvents is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
18
//
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
//
23
24
#ifndef OMNIEVENTS__DAEMON_WINDOWS_H
25
#define OMNIEVENTS__DAEMON_WINDOWS_H
26
27
#ifndef __WIN32__
28
# error("This file is only intended for Windows.")
29
#endif
30
31
#include <windows.h>
32
#include <winsvc.h>
33
#include <iostream>
34
35
namespace
OmniEvents {
36
40
class
Service
41
{
42
public
:
43
Service
();
44
~Service
();
45
46
void
start
(
int
& argc,
char
**& argv);
47
48
void
tracefile
(
const
char
* val);
49
void
pidfile
(
const
char
* val);
50
void
foreground
(
bool
val);
51
53
void
daemonize
();
54
56
void
runningOk
();
57
59
void
shutdown
();
60
61
// Callbacks.
62
64
static
void
log
(
const
char
* message);
65
67
static
void
ctrlHandler
(DWORD controlCode);
68
69
private
:
70
char
*
_tracefile
;
71
const
char
*
_regSubKey
;
72
bool
_serviceRunning
;
73
int
_callCount
;
74
char
*
_parameters
;
75
char
**
_argv
;
76
std::ostream*
_logstream
;
77
SERVICE_STATUS_HANDLE
_serviceStatusHandle
;
78
79
void
Service::setArgcArgv
(
int
& argc,
char
**& argv);
80
void
install
(
int
argc,
char
** argv)
const
;
81
void
uninstall
()
const
;
82
84
void
readParameters
();
86
void
writeParameters
(
int
argc,
char
** argv)
const
;
87
88
bool
Service::setServiceStatus
(
89
DWORD currentState,
90
DWORD win32ExitCode,
91
DWORD serviceSpecificExitCode,
92
DWORD checkPoint,
93
DWORD waitHint
94
);
95
96
};
// class Service
97
98
}
// end namespace OmniEvents
99
100
#endif // OMNIEVENTS__DAEMON_WINDOWS_H
101
src
daemon_windows.h
Generated on Thu Mar 20 2014 02:01:28 for OmniEvents by
1.8.1.2