5a929a37e3459a512dde93a7d18cfd4e2b627827
[oweals/gnunet.git] / src / include / gnunet_arm_service.h
1 /*
2       This file is part of GNUnet
3       (C) 2009 Christian Grothoff (and other contributing authors)
4
5       GNUnet is free software; you can redistribute it and/or modify
6       it under the terms of the GNU General Public License as published
7       by the Free Software Foundation; either version 2, or (at your
8       option) any later version.
9
10       GNUnet is distributed in the hope that it will be useful, but
11       WITHOUT ANY WARRANTY; without even the implied warranty of
12       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13       General Public License for more details.
14
15       You should have received a copy of the GNU General Public License
16       along with GNUnet; see the file COPYING.  If not, write to the
17       Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18       Boston, MA 02111-1307, USA.
19  */
20
21 /**
22  * @file include/gnunet_arm_service.h
23  * @brief API to access gnunet-arm
24  * @author Christian Grothoff
25  */
26
27 #ifndef GNUNET_ARM_SERVICE_H
28 #define GNUNET_ARM_SERVICE_H
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #if 0                           /* keep Emacsens' auto-indent happy */
34 }
35 #endif
36 #endif
37
38 #include "gnunet_configuration_lib.h"
39 #include "gnunet_scheduler_lib.h"
40 #include "gnunet_time_lib.h"
41
42 /**
43  * Version of the arm API.
44  */
45 #define GNUNET_ARM_VERSION 0x00000000
46
47
48 /**
49  * Callback function invoked when operation is complete.
50  *
51  * @param cls closure
52  * @param success GNUNET_YES if we think the service is running
53  *                GNUNET_NO if we think the service is stopped
54  *                GNUNET_SYSERR if we think ARM was not running or
55  *                          if the service status is unknown
56  */
57 typedef void (*GNUNET_ARM_Callback) (void *cls, int success);
58
59
60 /**
61  * Start a service.
62  *
63  * @param service_name name of the service
64  * @param cfg configuration to use (needed to contact ARM;
65  *        the ARM service may internally use a different
66  *        configuration to determine how to start the service).
67  * @param sched scheduler to use
68  * @param timeout how long to wait before failing for good
69  * @param cb callback to invoke when service is ready
70  * @param cb_cls closure for callback
71  */
72 void
73 GNUNET_ARM_start_service (const char *service_name,
74                           struct GNUNET_CONFIGURATION_Handle *cfg,
75                           struct GNUNET_SCHEDULER_Handle *sched,
76                           struct GNUNET_TIME_Relative timeout,
77                           GNUNET_ARM_Callback cb, void *cb_cls);
78
79
80 /**
81  * Stop a service.
82  *
83  * @param service_name name of the service
84  * @param cfg configuration to use (needed to contact ARM;
85  *        the ARM service may internally use a different
86  *        configuration to determine how to start the service).
87  * @param sched scheduler to use
88  * @param timeout how long to wait before failing for good
89  * @param cb callback to invoke when service is ready
90  * @param cb_cls closure for callback
91  */
92 void
93 GNUNET_ARM_stop_service (const char *service_name,
94                          struct GNUNET_CONFIGURATION_Handle *cfg,
95                          struct GNUNET_SCHEDULER_Handle *sched,
96                          struct GNUNET_TIME_Relative timeout,
97                          GNUNET_ARM_Callback cb, void *cb_cls);
98
99
100
101 #if 0                           /* keep Emacsens' auto-indent happy */
102 {
103 #endif
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif