1/*
2 * winservice.h : Public definitions for Windows Service support
3 *
4 * ====================================================================
5 *    Licensed to the Apache Software Foundation (ASF) under one
6 *    or more contributor license agreements.  See the NOTICE file
7 *    distributed with this work for additional information
8 *    regarding copyright ownership.  The ASF licenses this file
9 *    to you under the Apache License, Version 2.0 (the
10 *    "License"); you may not use this file except in compliance
11 *    with the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 *    Unless required by applicable law or agreed to in writing,
16 *    software distributed under the License is distributed on an
17 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 *    KIND, either express or implied.  See the License for the
19 *    specific language governing permissions and limitations
20 *    under the License.
21 * ====================================================================
22 */
23
24#ifndef WINSERVICE_H
25#define WINSERVICE_H
26
27#ifdef __cplusplus
28extern "C" {
29#endif /* __cplusplus */
30
31
32#ifdef WIN32
33
34/* Connects to the Windows Service Control Manager and allows this
35   process to run as a service.  This function can only succeed if the
36   process was started by the SCM, not directly by a user.  After this
37   call succeeds, the service should perform whatever work it needs to
38   start the service, and then the service should call
39   winservice_running() (if no errors occurred) or winservice_stop()
40   (if something failed during startup). */
41svn_error_t *winservice_start(void);
42
43/* Notifies the SCM that the service is now running.  The caller must
44   already have called winservice_start successfully. */
45void winservice_running(void);
46
47/* This function is called by the SCM in an arbitrary thread when the
48   SCM wants the service to stop.  The implementation of this function
49   can return immediately; all that is necessary is that the service
50   eventually stop in response. */
51void winservice_notify_stop(void);
52
53/* Evaluates to TRUE if the SCM has requested that the service stop.
54   This allows for the service to poll, in addition to being notified
55   in the winservice_notify_stop callback. */
56svn_boolean_t winservice_is_stopping(void);
57
58#endif /* WIN32 */
59
60#ifdef __cplusplus
61}
62#endif /* __cplusplus */
63
64#endif /* WINSERVICE_H */
65