Control protocol: implement QUERYSERVICENAME to get name from handle
[oweals/dinit.git] / src / includes / control-cmds.h
1 // Dinit control command packet types
2
3 // Requests:
4
5 // Query protocol version:
6 constexpr static int DINIT_CP_QUERYVERSION = 0;
7
8 // Find (but don't load) a service:
9 constexpr static int DINIT_CP_FINDSERVICE = 1;
10
11 // Find or load a service:
12 constexpr static int DINIT_CP_LOADSERVICE = 2;
13
14 // Start or stop a service:
15 constexpr static int DINIT_CP_STARTSERVICE = 3;
16 constexpr static int DINIT_CP_STOPSERVICE  = 4;
17 constexpr static int DINIT_CP_WAKESERVICE = 5;
18 constexpr static int DINIT_CP_RELEASESERVICE = 6;
19
20 constexpr static int DINIT_CP_UNPINSERVICE = 7;
21
22 // List services:
23 constexpr static int DINIT_CP_LISTSERVICES = 8;
24
25 // Unload a service:
26 constexpr static int DINIT_CP_UNLOADSERVICE = 9;
27
28 // Shutdown:
29 constexpr static int DINIT_CP_SHUTDOWN = 10;
30  // followed by 1-byte shutdown type
31
32 // Add/remove dependency to existing service:
33 constexpr static int DINIT_CP_ADD_DEP = 11;
34 constexpr static int DINIT_CP_REM_DEP = 12;
35
36 // Query service load path / mechanism:
37 constexpr static int DINIT_CP_QUERY_LOAD_MECH = 13;
38
39 // Add a waits for dependency from one service to another, and start the dependency:
40 constexpr static int DINIT_CP_ENABLESERVICE = 14;
41
42 // Find the name of a service (from a handle)
43 constexpr static int DINIT_CP_QUERYSERVICENAME = 15;
44
45 // Replies:
46
47 // Reply: ACK/NAK to request
48 constexpr static int DINIT_RP_ACK = 50;
49 constexpr static int DINIT_RP_NAK = 51;
50
51 // Request was bad (connection will be closed)
52 constexpr static int DINIT_RP_BADREQ = 52;
53
54 // Connection being closed due to out-of-memory condition
55 constexpr static int DINIT_RP_OOM = 53;
56
57 // Start service replies:
58 constexpr static int DINIT_RP_SERVICELOADERR = 54;
59 constexpr static int DINIT_RP_SERVICEOOM = 55; // couldn't start due to out-of-memory
60
61 constexpr static int DINIT_RP_SSISSUED = 56;  // service start/stop was issued (includes 4-byte service handle)
62 constexpr static int DINIT_RP_SSREDUNDANT = 57;  // service was already started/stopped (or for stop, not loaded)
63
64 // Query version response:
65 constexpr static int DINIT_RP_CPVERSION = 58;
66
67 // Service record loaded/found
68 constexpr static int DINIT_RP_SERVICERECORD = 59;
69 //     followed by 4-byte service handle, 1-byte service state
70
71 // Couldn't find/load service
72 constexpr static int DINIT_RP_NOSERVICE = 60;
73
74 // Service is already started/stopped
75 constexpr static int DINIT_RP_ALREADYSS = 61;
76
77 // Information on a service / list complete:
78 constexpr static int DINIT_RP_SVCINFO = 62;
79 constexpr static int DINIT_RP_LISTDONE = 63;
80
81 // Service loader information:
82 constexpr static int DINIT_RP_LOADER_MECH = 64;
83
84 // Dependent services prevent stopping/restarting. Includes size_t count, handle_t * N handles.
85 constexpr static int DINIT_RP_DEPENDENTS = 65;
86
87 // Service name:
88 constexpr static int DINIT_RP_SERVICENAME = 66;
89
90 // Information:
91
92 // Service event occurred (4-byte service handle, 1 byte event code)
93 constexpr static int DINIT_IP_SERVICEEVENT = 100;