diff options
Diffstat (limited to 'src/include/gnunet_arm_service.h')
-rw-r--r-- | src/include/gnunet_arm_service.h | 84 |
1 files changed, 78 insertions, 6 deletions
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index faf89128f..32355a3e5 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h | |||
@@ -70,7 +70,7 @@ enum GNUNET_ARM_RequestStatus { | |||
70 | /** | 70 | /** |
71 | * Statuses of services. | 71 | * Statuses of services. |
72 | */ | 72 | */ |
73 | enum GNUNET_ARM_ServiceStatus { | 73 | enum GNUNET_ARM_ServiceMonitorStatus { |
74 | /** | 74 | /** |
75 | * Dummy message. | 75 | * Dummy message. |
76 | */ | 76 | */ |
@@ -150,6 +150,78 @@ enum GNUNET_ARM_Result { | |||
150 | 150 | ||
151 | 151 | ||
152 | /** | 152 | /** |
153 | * Status of a service managed by ARM. | ||
154 | */ | ||
155 | enum GNUNET_ARM_ServiceStatus | ||
156 | { | ||
157 | /** | ||
158 | * Service is stopped. | ||
159 | */ | ||
160 | GNUNET_ARM_SERVICE_STATUS_STOPPED = 0, | ||
161 | |||
162 | /** | ||
163 | * Service has been started and is currently running. | ||
164 | */ | ||
165 | GNUNET_ARM_SERVICE_STATUS_STARTED = 1, | ||
166 | |||
167 | /** | ||
168 | * The service has previously failed, and | ||
169 | * will be restarted. | ||
170 | */ | ||
171 | GNUNET_ARM_SERVICE_STATUS_FAILED = 2, | ||
172 | |||
173 | /** | ||
174 | * The service was started, but then exited normally. | ||
175 | */ | ||
176 | GNUNET_ARM_SERVICE_STATUS_FINISHED = 3, | ||
177 | |||
178 | /** | ||
179 | * The service was started, and we're currently waiting | ||
180 | * for it to be stopped. | ||
181 | */ | ||
182 | GNUNET_ARM_SERVICE_STATUS_STOPPING = 4, | ||
183 | }; | ||
184 | |||
185 | |||
186 | /** | ||
187 | * Information about a service managed by ARM. | ||
188 | */ | ||
189 | struct GNUNET_ARM_ServiceInfo | ||
190 | { | ||
191 | /** | ||
192 | * The current status of the service. | ||
193 | */ | ||
194 | enum GNUNET_ARM_ServiceStatus status; | ||
195 | |||
196 | /** | ||
197 | * The name of the service. | ||
198 | */ | ||
199 | const char *name; | ||
200 | |||
201 | /** | ||
202 | * The binary used to execute the service. | ||
203 | */ | ||
204 | const char *binary; | ||
205 | |||
206 | /** | ||
207 | * Time when the sevice will be restarted, if applicable | ||
208 | * to the current status. | ||
209 | */ | ||
210 | struct GNUNET_TIME_Absolute restart_at; | ||
211 | |||
212 | /** | ||
213 | * Time when the sevice was first started, if applicable. | ||
214 | */ | ||
215 | struct GNUNET_TIME_Absolute last_started_at; | ||
216 | |||
217 | /** | ||
218 | * Last process exit status. | ||
219 | */ | ||
220 | int last_exit_status; | ||
221 | }; | ||
222 | |||
223 | |||
224 | /** | ||
153 | * Handle for interacting with ARM. | 225 | * Handle for interacting with ARM. |
154 | */ | 226 | */ |
155 | struct GNUNET_ARM_Handle; | 227 | struct GNUNET_ARM_Handle; |
@@ -197,13 +269,13 @@ typedef void | |||
197 | * @param cls closure | 269 | * @param cls closure |
198 | * @param rs status of the request | 270 | * @param rs status of the request |
199 | * @param count number of strings in the list | 271 | * @param count number of strings in the list |
200 | * @param list list of running services | 272 | * @param list list of services managed by arm |
201 | */ | 273 | */ |
202 | typedef void | 274 | typedef void |
203 | (*GNUNET_ARM_ServiceListCallback) (void *cls, | 275 | (*GNUNET_ARM_ServiceListCallback) (void *cls, |
204 | enum GNUNET_ARM_RequestStatus rs, | 276 | enum GNUNET_ARM_RequestStatus rs, |
205 | unsigned int count, | 277 | unsigned int count, |
206 | const char *const*list); | 278 | const struct GNUNET_ARM_ServiceInfo *list); |
207 | 279 | ||
208 | 280 | ||
209 | /** | 281 | /** |
@@ -309,9 +381,9 @@ struct GNUNET_ARM_MonitorHandle; | |||
309 | * @param status status of the service | 381 | * @param status status of the service |
310 | */ | 382 | */ |
311 | typedef void | 383 | typedef void |
312 | (*GNUNET_ARM_ServiceStatusCallback) (void *cls, | 384 | (*GNUNET_ARM_ServiceMonitorCallback) (void *cls, |
313 | const char *service, | 385 | const char *service, |
314 | enum GNUNET_ARM_ServiceStatus status); | 386 | enum GNUNET_ARM_ServiceMonitorStatus status); |
315 | 387 | ||
316 | 388 | ||
317 | /** | 389 | /** |
@@ -327,7 +399,7 @@ typedef void | |||
327 | */ | 399 | */ |
328 | struct GNUNET_ARM_MonitorHandle * | 400 | struct GNUNET_ARM_MonitorHandle * |
329 | GNUNET_ARM_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, | 401 | GNUNET_ARM_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, |
330 | GNUNET_ARM_ServiceStatusCallback cont, | 402 | GNUNET_ARM_ServiceMonitorCallback cont, |
331 | void *cont_cls); | 403 | void *cont_cls); |
332 | 404 | ||
333 | 405 | ||