Factor out some Dinit client functions tp a new header (dinit-client.h).
[oweals/dinit.git] / src / includes / service-constants.h
1 #ifndef SERVICE_CONSTANTS_H
2 #define SERVICE_CONSTANTS_H
3
4 /* Service states */
5 enum class service_state_t {
6     STOPPED,    // service is not running.
7     STARTING,   // service is starting, and will start (or fail to start) in time.
8     STARTED,    // service is running,
9     STOPPING    // service script is stopping and will stop.
10 };
11
12 /* Service types */
13 enum class service_type_t {
14     DUMMY,      // Dummy service, used to detect cyclice dependencies
15     PROCESS,    // Service runs as a process, and can be stopped by
16                 // sending the process a signal (usually SIGTERM)
17     BGPROCESS,  // Service runs as a process which "daemonizes" to run in the
18                 // "background".
19     SCRIPTED,   // Service requires an external command to start,
20                 // and a second command to stop
21     INTERNAL    // Internal service, runs no external process
22 };
23
24 /* Service events */
25 enum class service_event_t {
26     STARTED,           // Service was started (reached STARTED state)
27     STOPPED,           // Service was stopped (reached STOPPED state)
28     FAILEDSTART,       // Service failed to start (possibly due to dependency failing)
29     STARTCANCELLED,    // Service was set to be started but a stop was requested
30     STOPCANCELLED      // Service was set to be stopped but a start was requested
31 };
32
33 /* Shutdown types */
34 enum class shutdown_type_t {
35     CONTINUE,          // Continue normal boot sequence (used after single-user shell)
36     HALT,              // Halt system without powering down
37     POWEROFF,          // Power off system
38     REBOOT             // Reboot system
39 };
40
41 #endif