No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

304 líneas
6.4 KiB

  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2012, 2013 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. * @file multicast/multicast.h
  18. * @brief multicast IPC messages
  19. * @author Christian Grothoff
  20. * @author Gabor X Toth
  21. */
  22. #ifndef MULTICAST_H
  23. #define MULTICAST_H
  24. #include <gnunet/platform.h>
  25. #include "gnunet_multicast_service.h"
  26. GNUNET_NETWORK_STRUCT_BEGIN
  27. /**
  28. * Header of a join request sent to the origin or another member.
  29. */
  30. struct MulticastJoinRequestMessage
  31. {
  32. /**
  33. * Purpose for the signature and size of the signed data.
  34. */
  35. struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
  36. /**
  37. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST
  38. */
  39. struct GNUNET_MessageHeader header;
  40. /**
  41. * Always zero.
  42. */
  43. uint32_t reserved;
  44. /**
  45. * ECC signature of the rest of the fields of the join request.
  46. *
  47. * Signature must match the public key of the joining member.
  48. */
  49. struct GNUNET_CRYPTO_EcdsaSignature signature;
  50. /**
  51. * Public key of the target group.
  52. */
  53. struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
  54. /**
  55. * Public key of the joining member.
  56. */
  57. struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key;
  58. /**
  59. * Peer identity of the joining member.
  60. */
  61. struct GNUNET_PeerIdentity peer;
  62. /* Followed by struct GNUNET_MessageHeader join_message */
  63. };
  64. /**
  65. * Header of a join decision message sent to a peer requesting join.
  66. */
  67. struct MulticastJoinDecisionMessage
  68. {
  69. /**
  70. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
  71. */
  72. struct GNUNET_MessageHeader header;
  73. /**
  74. * #GNUNET_YES if the peer was admitted
  75. * #GNUNET_NO if entry was refused,
  76. * #GNUNET_SYSERR if the request could not be answered.
  77. */
  78. int32_t is_admitted;
  79. /**
  80. * Number of relays given.
  81. */
  82. uint32_t relay_count;
  83. /* Followed by relay_count peer identities */
  84. /* Followed by the join response message */
  85. };
  86. /**
  87. * Header added to a struct MulticastJoinDecisionMessage
  88. * when sent between the client and service.
  89. */
  90. struct MulticastJoinDecisionMessageHeader
  91. {
  92. /**
  93. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
  94. */
  95. struct GNUNET_MessageHeader header;
  96. /**
  97. * C->S: Peer to send the join decision to.
  98. * S->C: Peer we received the join decision from.
  99. */
  100. struct GNUNET_PeerIdentity peer;
  101. /**
  102. * C->S: Public key of the member requesting join.
  103. * S->C: Unused.
  104. */
  105. struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key;
  106. /* Followed by struct MulticastJoinDecisionMessage */
  107. };
  108. /**
  109. * Message sent from the client to the service to notify the service
  110. * about the result of a membership test.
  111. */
  112. struct MulticastMembershipTestResultMessage
  113. {
  114. /**
  115. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBERSHIP_TEST_RESULT
  116. */
  117. struct GNUNET_MessageHeader header;
  118. /**
  119. * Unique ID that identifies the associated membership test.
  120. */
  121. uint32_t uid;
  122. /**
  123. * #GNUNET_YES if the peer is a member
  124. * #GNUNET_NO if peer is not a member,
  125. * #GNUNET_SYSERR if the test could not be answered.
  126. */
  127. int32_t is_admitted;
  128. };
  129. /**
  130. * Message sent from the client to the service OR the service to the
  131. * client asking for a message fragment to be replayed.
  132. */
  133. struct MulticastReplayRequestMessage
  134. {
  135. /**
  136. * The message type should be
  137. * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST.
  138. */
  139. struct GNUNET_MessageHeader header;
  140. /**
  141. * S->C: Public key of the member requesting replay.
  142. * C->S: Unused.
  143. */
  144. struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key;
  145. /**
  146. * ID of the message that is being requested.
  147. */
  148. uint64_t fragment_id;
  149. /**
  150. * ID of the message that is being requested.
  151. */
  152. uint64_t message_id;
  153. /**
  154. * Offset of the fragment that is being requested.
  155. */
  156. uint64_t fragment_offset;
  157. /**
  158. * Additional flags for the request.
  159. */
  160. uint64_t flags;
  161. /**
  162. * Replay request ID.
  163. */
  164. uint32_t uid;
  165. };
  166. /**
  167. * Message sent from the client to the service to give the service
  168. * a replayed message.
  169. */
  170. struct MulticastReplayResponseMessage
  171. {
  172. /**
  173. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_RESPONSE
  174. * or GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_RESPONSE_END
  175. */
  176. struct GNUNET_MessageHeader header;
  177. /**
  178. * ID of the message that is being requested.
  179. */
  180. uint64_t fragment_id;
  181. /**
  182. * ID of the message that is being requested.
  183. */
  184. uint64_t message_id;
  185. /**
  186. * Offset of the fragment that is being requested.
  187. */
  188. uint64_t fragment_offset;
  189. /**
  190. * Additional flags for the request.
  191. */
  192. uint64_t flags;
  193. /**
  194. * An `enum GNUNET_MULTICAST_ReplayErrorCode` identifying issues (in NBO).
  195. */
  196. int32_t error_code;
  197. /* followed by replayed message */
  198. };
  199. /**
  200. * Message sent from the client to the service to notify the service
  201. * about the starting of a multicast group with this peers as its origin.
  202. */
  203. struct MulticastOriginStartMessage
  204. {
  205. /**
  206. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START
  207. */
  208. struct GNUNET_MessageHeader header;
  209. /**
  210. * Always zero.
  211. */
  212. uint32_t reserved;
  213. /**
  214. * Private, non-ephemeral key for the multicast group.
  215. */
  216. struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
  217. /**
  218. * Last fragment ID sent to the group, used to continue counting fragments if
  219. * we resume operating * a group.
  220. */
  221. uint64_t max_fragment_id;
  222. };
  223. struct MulticastMemberJoinMessage
  224. {
  225. /**
  226. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBER_JOIN
  227. */
  228. struct GNUNET_MessageHeader header;
  229. uint32_t relay_count GNUNET_PACKED;
  230. struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
  231. struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
  232. struct GNUNET_PeerIdentity origin;
  233. /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
  234. /* Followed by struct GNUNET_MessageHeader join_msg */
  235. };
  236. GNUNET_NETWORK_STRUCT_END
  237. #endif
  238. /* end of multicast.h */