multicast.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2012, 2013 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. 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. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17. /**
  18. * @file multicast/multicast.h
  19. * @brief multicast IPC messages
  20. * @author Christian Grothoff
  21. * @author Gabor X Toth
  22. */
  23. #ifndef MULTICAST_H
  24. #define MULTICAST_H
  25. GNUNET_NETWORK_STRUCT_BEGIN
  26. /**
  27. * Header of a join request sent to the origin or another member.
  28. */
  29. struct MulticastJoinRequestMessage
  30. {
  31. /**
  32. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST
  33. */
  34. struct GNUNET_MessageHeader header;
  35. /**
  36. * Always zero.
  37. */
  38. uint32_t reserved;
  39. /**
  40. * ECC signature of the rest of the fields of the join request.
  41. *
  42. * Signature must match the public key of the joining member.
  43. */
  44. struct GNUNET_CRYPTO_EcdsaSignature signature;
  45. /**
  46. * Purpose for the signature and size of the signed data.
  47. */
  48. struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
  49. /**
  50. * Public key of the target group.
  51. */
  52. struct GNUNET_CRYPTO_EddsaPublicKey group_key;
  53. /**
  54. * Public key of the joining member.
  55. */
  56. struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
  57. /**
  58. * Peer identity of the joining member.
  59. */
  60. struct GNUNET_PeerIdentity peer;
  61. /* Followed by struct GNUNET_MessageHeader join_message */
  62. };
  63. /**
  64. * Header of a join decision message sent to a peer requesting join.
  65. */
  66. struct MulticastJoinDecisionMessage
  67. {
  68. /**
  69. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
  70. */
  71. struct GNUNET_MessageHeader header;
  72. /**
  73. * #GNUNET_YES if the peer was admitted
  74. * #GNUNET_NO if entry was refused,
  75. * #GNUNET_SYSERR if the request could not be answered.
  76. */
  77. int32_t is_admitted;
  78. /**
  79. * Number of relays given.
  80. */
  81. uint32_t relay_count;
  82. /* Followed by relay_count peer identities */
  83. /* Followed by the join response message */
  84. };
  85. /**
  86. * Header added to a struct MulticastJoinDecisionMessage
  87. * when sent between the client and service.
  88. */
  89. struct MulticastJoinDecisionMessageHeader
  90. {
  91. /**
  92. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION
  93. */
  94. struct GNUNET_MessageHeader header;
  95. /**
  96. * C->S: Peer to send the join decision to.
  97. * S->C: Peer we received the join decision from.
  98. */
  99. struct GNUNET_PeerIdentity peer;
  100. /**
  101. * C->S: Public key of the member requesting join.
  102. * S->C: Unused.
  103. */
  104. struct GNUNET_CRYPTO_EcdsaPublicKey member_key;
  105. /* Followed by struct MulticastJoinDecisionMessage */
  106. };
  107. /**
  108. * Message sent from the client to the service to notify the service
  109. * about the result of a membership test.
  110. */
  111. struct MulticastMembershipTestResultMessage
  112. {
  113. /**
  114. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBERSHIP_TEST_RESULT
  115. */
  116. struct GNUNET_MessageHeader header;
  117. /**
  118. * Unique ID that identifies the associated membership test.
  119. */
  120. uint32_t uid;
  121. /**
  122. * #GNUNET_YES if the peer is a member
  123. * #GNUNET_NO if peer is not a member,
  124. * #GNUNET_SYSERR if the test could not be answered.
  125. */
  126. int32_t is_admitted;
  127. };
  128. /**
  129. * Message sent from the client to the service to give the service
  130. * a replayed message.
  131. */
  132. struct MulticastReplayResponseMessage
  133. {
  134. /**
  135. *
  136. */
  137. struct GNUNET_MessageHeader header;
  138. /**
  139. * Unique ID that identifies the associated replay session.
  140. */
  141. uint32_t uid;
  142. /**
  143. * An `enum GNUNET_MULTICAST_ReplayErrorCode` identifying issues (in NBO).
  144. */
  145. int32_t error_code;
  146. /* followed by replayed message */
  147. };
  148. /**
  149. * Message sent from the client to the service to notify the service
  150. * about the end of a replay session.
  151. */
  152. struct MulticastReplayEndMessage
  153. {
  154. /**
  155. *
  156. */
  157. struct GNUNET_MessageHeader header;
  158. /**
  159. * Unique ID that identifies the associated replay session.
  160. */
  161. uint32_t uid;
  162. };
  163. /**
  164. * Message sent from the client to the service to notify the service
  165. * about the starting of a multicast group with this peers as its origin.
  166. */
  167. struct MulticastOriginStartMessage
  168. {
  169. /**
  170. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START
  171. */
  172. struct GNUNET_MessageHeader header;
  173. /**
  174. * Always zero.
  175. */
  176. uint32_t reserved;
  177. /**
  178. * Private, non-ephemeral key for the multicast group.
  179. */
  180. struct GNUNET_CRYPTO_EddsaPrivateKey group_key;
  181. /**
  182. * Last fragment ID sent to the group, used to continue counting fragments if
  183. * we resume operating * a group.
  184. */
  185. uint64_t max_fragment_id;
  186. };
  187. struct MulticastMemberJoinMessage
  188. {
  189. /**
  190. * Type: GNUNET_MESSAGE_TYPE_MULTICAST_MEMBER_JOIN
  191. */
  192. struct GNUNET_MessageHeader header;
  193. uint32_t relay_count GNUNET_PACKED;
  194. struct GNUNET_CRYPTO_EddsaPublicKey group_key;
  195. struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
  196. struct GNUNET_PeerIdentity origin;
  197. /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
  198. /* Followed by struct GNUNET_MessageHeader join_msg */
  199. };
  200. #if NOT_USED
  201. /**
  202. * Message sent from the client to the service to broadcast to all group
  203. * members.
  204. */
  205. struct MulticastBroadcastMessage
  206. {
  207. /**
  208. *
  209. */
  210. struct GNUNET_MessageHeader header;
  211. /**
  212. * #GNUNET_OK normally, #GNUNET_SYSERR if the origin aborted the
  213. * transmission.
  214. */
  215. int32_t status;
  216. /**
  217. * Message ID.
  218. */
  219. uint64_t message_id;
  220. /**
  221. * Group generation.
  222. */
  223. uint64_t group_generation;
  224. /**
  225. * Total message size.
  226. */
  227. uint64_t total_size;
  228. };
  229. /**
  230. * Message sent from the client to the service to join a multicast group.
  231. */
  232. struct MulticastJoinMessage
  233. {
  234. /**
  235. *
  236. */
  237. struct GNUNET_MessageHeader header;
  238. /**
  239. * Number of relays we (think) we already know about.
  240. */
  241. uint32_t relay_count;
  242. /**
  243. * Public non-ephemeral key of the mutlicast group.
  244. */
  245. struct GNUNET_CRYPTO_EddsaPublicKey group_key;
  246. /**
  247. * Our private key for the group.
  248. */
  249. struct GNUNET_CRYPTO_EcdsaPrivateKey member_key;
  250. /* followed by 'relay_count' `struct GNUNET_PeerIdentity`s */
  251. };
  252. /**
  253. * Message sent from the client to the service OR the service to the
  254. * client asking for a message fragment to be replayed.
  255. */
  256. struct MulticastReplayRequestMessage
  257. {
  258. /**
  259. * The message type can be either
  260. * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST or
  261. * #GNUNET_MESSAGE_TYPE_MULTICAST_REPLAY_REQUEST_CANCEL.
  262. */
  263. struct GNUNET_MessageHeader header;
  264. /**
  265. * Replay request ID.
  266. */
  267. uint32_t uid;
  268. /**
  269. * ID of the message that is being requested.
  270. */
  271. uint64_t message_id;
  272. /**
  273. * Offset of the fragment that is being requested.
  274. */
  275. uint64_t fragment_offset;
  276. /**
  277. * Additional flags for the request.
  278. */
  279. uint64_t flags;
  280. };
  281. /**
  282. * Message sent from the client to the service to unicast to the group origin.
  283. */
  284. struct MulticastUnicastToOriginMessage
  285. {
  286. /**
  287. *
  288. */
  289. struct GNUNET_MessageHeader header;
  290. /**
  291. * Reserved (always 0).
  292. */
  293. uint32_t reserved;
  294. /**
  295. * Message ID.
  296. */
  297. uint64_t message_id;
  298. /**
  299. * Total message size.
  300. */
  301. uint64_t total_size;
  302. /* followed by payload */
  303. };
  304. /**
  305. * Message sent from the client to the service to
  306. * cancel unicast to the group origin.
  307. */
  308. struct MulticastUnicastToOriginCancelMessage
  309. {
  310. /**
  311. *
  312. */
  313. struct GNUNET_MessageHeader header;
  314. /**
  315. * Reserved (always 0).
  316. */
  317. uint32_t reserved;
  318. /**
  319. * Message ID.
  320. */
  321. uint64_t message_id;
  322. };
  323. #endif // NOT_USED
  324. GNUNET_NETWORK_STRUCT_END
  325. #endif
  326. /* end of multicast.h */