control-cmds.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #ifndef DINIT_CONTROL_CMDS_H_INCLUDED
  2. #define DINIT_CONTROL_CMDS_H_INCLUDED 1
  3. #include <control-datatypes.h>
  4. // Dinit control command packet types
  5. // Requests:
  6. enum class cp_cmd : dinit_cptypes::cp_cmd_t {
  7. // Query protocol version:
  8. QUERYVERSION = 0,
  9. // Find (but don't load) a service:
  10. FINDSERVICE = 1,
  11. // Find or load a service:
  12. LOADSERVICE = 2,
  13. // Start or stop a service:
  14. STARTSERVICE = 3,
  15. STOPSERVICE = 4,
  16. WAKESERVICE = 5,
  17. RELEASESERVICE = 6,
  18. UNPINSERVICE = 7,
  19. // List services:
  20. LISTSERVICES = 8,
  21. // Unload a service:
  22. UNLOADSERVICE = 9,
  23. // Shutdown:
  24. SHUTDOWN = 10,
  25. // followed by 1-byte shutdown type
  26. // Add/remove dependency to existing service:
  27. ADD_DEP = 11,
  28. REM_DEP = 12,
  29. // Query service load path / mechanism:
  30. QUERY_LOAD_MECH = 13,
  31. // Add a waits for dependency from one service to another, and start the dependency:
  32. ENABLESERVICE = 14,
  33. // Find the name of a service (from a handle)
  34. QUERYSERVICENAME = 15,
  35. // Reload a service:
  36. RELOADSERVICE = 16,
  37. // Export a set of environment variables into activation environment:
  38. SETENV = 17,
  39. // Query status of an individual service
  40. SERVICESTATUS = 18,
  41. // Set trigger value for triggered services
  42. SETTRIGGER = 19,
  43. // Retrieve buffered output
  44. CATLOG = 20,
  45. // Send Signal to process
  46. SIGNAL = 21,
  47. // Query service description directory
  48. QUERYSERVICEDSCDIR = 22,
  49. // "Close" a service handle
  50. CLOSEHANDLE = 23,
  51. // Retrieve complete environment
  52. GETALLENV = 24,
  53. };
  54. // Replies:
  55. enum class cp_rply : dinit_cptypes::cp_rply_t {
  56. // Reply: ACK/NAK to request
  57. ACK = 50,
  58. NAK = 51,
  59. // Request was bad (connection will be closed)
  60. BADREQ = 52,
  61. // Connection being closed due to out-of-memory condition
  62. OOM = 53,
  63. // Start service replies:
  64. SERVICELOADERR = 54,
  65. SERVICEOOM = 55, // couldn't start due to out-of-memory
  66. // Not (any longer?) used
  67. //SSISSUED = 56, // service start/stop was issued (includes 4-byte service handle)
  68. //SSREDUNDANT = 57, // service was already started/stopped (or for stop, not loaded)
  69. // Query version response:
  70. CPVERSION = 58,
  71. // Service record loaded/found
  72. SERVICERECORD = 59,
  73. // 1-byte service state, followed by 4-byte service handle, followed by 1-byte service target state
  74. // Couldn't find/load service
  75. NOSERVICE = 60,
  76. // Service is already started/stopped
  77. ALREADYSS = 61,
  78. // Information on a service / list complete:
  79. SVCINFO = 62,
  80. LISTDONE = 63,
  81. // Service loader information:
  82. LOADER_MECH = 64,
  83. // Dependent services prevent stopping/restarting. Includes size_t count, handle_t * N handles.
  84. DEPENDENTS = 65,
  85. // Service name:
  86. SERVICENAME = 66,
  87. // Service is pinned stopped/started:
  88. PINNEDSTOPPED = 67,
  89. PINNEDSTARTED = 68,
  90. // Shutdown is in progress, can't start/restart/wake service:
  91. SHUTTINGDOWN = 69,
  92. // Service status:
  93. SERVICESTATUS = 70,
  94. // Service description error:
  95. SERVICE_DESC_ERR = 71,
  96. // Service load error (general):
  97. SERVICE_LOAD_ERR = 72,
  98. // Service log:
  99. SERVICE_LOG = 73,
  100. // Signal replies:
  101. SIGNAL_NOPID = 74,
  102. SIGNAL_BADSIG = 75,
  103. SIGNAL_KILLERR = 76,
  104. // Service description directory:
  105. SVCDSCDIR = 77,
  106. // Retrieve complete environment
  107. ALLENV = 78,
  108. };
  109. // Information (out-of-band):
  110. enum class cp_info : dinit_cptypes::cp_info_t {
  111. // Service event occurred (4-byte service handle, 1 byte event code)
  112. SERVICEEVENT = 100,
  113. };
  114. #endif