arm.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2009 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @author Christian Grothoff
  18. * @file arm/arm.h
  19. */
  20. #ifndef ARM_H
  21. #define ARM_H
  22. #include "gnunet_common.h"
  23. /**
  24. * This option will turn on the DEBUG loglevel for
  25. * all processes controlled by this ARM!
  26. */
  27. #define DEBUG_ARM GNUNET_EXTRA_LOGGING
  28. GNUNET_NETWORK_STRUCT_BEGIN
  29. /**
  30. * Status update from ARM to client.
  31. */
  32. struct GNUNET_ARM_StatusMessage
  33. {
  34. /**
  35. * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_STATUS.
  36. */
  37. struct GNUNET_MessageHeader header;
  38. /**
  39. * Status from the 'enum GNUNET_ARM_ServiceStatus'
  40. */
  41. uint32_t status;
  42. /* followed by a 0-terminated service name */
  43. };
  44. struct GNUNET_ARM_Message
  45. {
  46. /**
  47. * Reply to client, type is #GNUNET_MESSAGE_TYPE_ARM_RESULT or
  48. * #GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT.
  49. * OR
  50. * Request from client, type is #GNUNET_MESSAGE_TYPE_ARM_START or
  51. * #GNUNET_MESSAGE_TYPE_ARM_STOP.
  52. */
  53. struct GNUNET_MessageHeader header;
  54. /**
  55. * For alignment.
  56. */
  57. uint32_t reserved;
  58. /**
  59. * ID of a request that is being replied to.
  60. * OR
  61. * ID of a request that is being sent.
  62. */
  63. uint64_t request_id;
  64. /* For requests - followed by a 0-terminated service name */
  65. };
  66. /**
  67. * Reply from ARM to client.
  68. */
  69. struct GNUNET_ARM_ResultMessage
  70. {
  71. /**
  72. * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_RESULT, with an ID.
  73. */
  74. struct GNUNET_ARM_Message arm_msg;
  75. /**
  76. * Result from the `enum GNUNET_ARM_Result`
  77. */
  78. uint32_t result;
  79. };
  80. struct GNUNET_ARM_ServiceInfoMessage
  81. {
  82. /**
  83. * String pool index for the service's name.
  84. */
  85. uint16_t name_index;
  86. /**
  87. * String pool index for the service's binary.
  88. */
  89. uint16_t binary_index;
  90. /**
  91. * Last process exit status.
  92. */
  93. int16_t last_exit_status;
  94. /**
  95. * Padding.
  96. */
  97. uint16_t padding;
  98. /**
  99. * Status from the 'enum GNUNET_ARM_ServiceStatus'
  100. */
  101. uint32_t status;
  102. /**
  103. * Time when the service will be restarted, if applicable
  104. * to the current status.
  105. */
  106. struct GNUNET_TIME_AbsoluteNBO restart_at;
  107. /**
  108. * Time when the service was first started, if applicable.
  109. */
  110. struct GNUNET_TIME_AbsoluteNBO last_started_at;
  111. };
  112. /**
  113. * Reply from ARM to client for the
  114. * #GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count
  115. * '\0' terminated strings. header->size contains the
  116. * total size (including all strings).
  117. */
  118. struct GNUNET_ARM_ListResultMessage
  119. {
  120. /**
  121. * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT,
  122. * with an ID.
  123. */
  124. struct GNUNET_ARM_Message arm_msg;
  125. /**
  126. * Number of 'struct GNUNET_ARM_ServiceInfoMessage' that
  127. * are at the end of this message.
  128. */
  129. uint16_t count;
  130. /* struct GNUNET_ARM_ServiceInfoMessage[count]; */
  131. /* pool of 0-terminated strings */
  132. };
  133. GNUNET_NETWORK_STRUCT_END
  134. #endif