summaryrefslogtreecommitdiff
path: root/service.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-23 01:52:57 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-23 01:52:57 +0100
commit5cb5a6ffc33667c93e9bc3572534dcaa684046e3 (patch)
tree51e8b6260d56027c4d610ff6db5882737101a809 /service.h
parentcd2dbd7df9f1b8c46386b2898523aec3dd4578fd (diff)
first attempt in implementinging execution logic
Diffstat (limited to 'service.h')
-rw-r--r--service.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/service.h b/service.h
new file mode 100644
index 0000000000..d7f2c708dd
--- /dev/null
+++ b/service.h
@@ -0,0 +1,65 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
+#ifndef fooservicehfoo
+#define fooservicehfoo
+
+typedef struct Service Service;
+
+#include "name.h"
+#include "socket.h"
+#include "timer.h"
+
+typedef enum ServiceState {
+ SERVICE_DEAD,
+ SERVICE_START_PRE,
+ SERVICE_START,
+ SERVICE_START_POST,
+ SERVICE_RUNNING,
+ SERVICE_RELOAD_PRE,
+ SERVICE_RELOAD,
+ SERVICE_RELOAD_POST,
+ SERVICE_STOP_PRE,
+ SERVICE_STOP,
+ SERVICE_SIGTERM,
+ SERVICE_SIGKILL,
+ SERVICE_STOP_POST,
+ SERVICE_MAINTAINANCE,
+ _SERVICE_STATE_MAX,
+} ServiceState;
+
+typedef enum ServiceMode {
+ SERVICE_ONCE,
+ SERVICE_RESTART
+} ServiceMode;
+
+typedef enum ServiceExecCommand {
+ SERVICE_EXEC_START_PRE,
+ SERVICE_EXEC_START,
+ SERVICE_EXEC_START_POST,
+ SERVICE_EXEC_RELOAD_PRE,
+ SERVICE_EXEC_RELOAD,
+ SERVICE_EXEC_RELOAD_POST,
+ SERVICE_EXEC_STOP_PRE,
+ SERVICE_EXEC_STOP,
+ SERVICE_EXEC_STOP_POST,
+ _SERVICE_EXEC_MAX
+} ServiceExecCommand;
+
+struct Service {
+ Meta meta;
+
+ ServiceState state;
+ ServiceMode mode;
+
+ ExecCommand* exec_command[_SERVICE_EXEC_MAX];
+ ExecContext exec_context;
+
+ pid_t service_pid, control_pid;
+
+ Socket *socket;
+ Timer *timer;
+};
+
+const NameVTable service_vtable;
+
+#endif