gnunet-service-set_union.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. This file is part of GNUnet
  3. Copyright (C) 2013-2017 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 set/gnunet-service-set_union.h
  18. * @brief two-peer set operations
  19. * @author Florian Dold
  20. * @author Christian Grothoff
  21. */
  22. #ifndef GNUNET_SERVICE_SET_UNION_H
  23. #define GNUNET_SERVICE_SET_UNION_H
  24. #include "gnunet-service-set.h"
  25. #include "gnunet-service-set_protocol.h"
  26. /**
  27. * Handle a strata estimator from a remote peer
  28. *
  29. * @param cls the union operation
  30. * @param msg the message
  31. */
  32. int
  33. check_union_p2p_strata_estimator (void *cls,
  34. const struct StrataEstimatorMessage *msg);
  35. /**
  36. * Handle a strata estimator from a remote peer
  37. *
  38. * @param cls the union operation
  39. * @param msg the message
  40. */
  41. void
  42. handle_union_p2p_strata_estimator (void *cls,
  43. const struct StrataEstimatorMessage *msg);
  44. /**
  45. * Check an IBF message from a remote peer.
  46. *
  47. * Reassemble the IBF from multiple pieces, and
  48. * process the whole IBF once possible.
  49. *
  50. * @param cls the union operation
  51. * @param msg the header of the message
  52. * @return #GNUNET_OK if @a msg is well-formed
  53. */
  54. int
  55. check_union_p2p_ibf (void *cls,
  56. const struct IBFMessage *msg);
  57. /**
  58. * Handle an IBF message from a remote peer.
  59. *
  60. * Reassemble the IBF from multiple pieces, and
  61. * process the whole IBF once possible.
  62. *
  63. * @param cls the union operation
  64. * @param msg the header of the message
  65. */
  66. void
  67. handle_union_p2p_ibf (void *cls,
  68. const struct IBFMessage *msg);
  69. /**
  70. * Check an element message from a remote peer.
  71. *
  72. * @param cls the union operation
  73. * @param emsg the message
  74. */
  75. int
  76. check_union_p2p_elements (void *cls,
  77. const struct GNUNET_SET_ElementMessage *emsg);
  78. /**
  79. * Handle an element message from a remote peer.
  80. * Sent by the other peer either because we decoded an IBF and placed a demand,
  81. * or because the other peer switched to full set transmission.
  82. *
  83. * @param cls the union operation
  84. * @param emsg the message
  85. */
  86. void
  87. handle_union_p2p_elements (void *cls,
  88. const struct GNUNET_SET_ElementMessage *emsg);
  89. /**
  90. * Check a full element message from a remote peer.
  91. *
  92. * @param cls the union operation
  93. * @param emsg the message
  94. */
  95. int
  96. check_union_p2p_full_element (void *cls,
  97. const struct GNUNET_SET_ElementMessage *emsg);
  98. /**
  99. * Handle an element message from a remote peer.
  100. *
  101. * @param cls the union operation
  102. * @param emsg the message
  103. */
  104. void
  105. handle_union_p2p_full_element (void *cls,
  106. const struct GNUNET_SET_ElementMessage *emsg);
  107. /**
  108. * Send offers (for GNUNET_Hash-es) in response
  109. * to inquiries (for IBF_Key-s).
  110. *
  111. * @param cls the union operation
  112. * @param msg the message
  113. */
  114. int
  115. check_union_p2p_inquiry (void *cls,
  116. const struct InquiryMessage *msg);
  117. /**
  118. * Send offers (for GNUNET_Hash-es) in response
  119. * to inquiries (for IBF_Key-s).
  120. *
  121. * @param cls the union operation
  122. * @param msg the message
  123. */
  124. void
  125. handle_union_p2p_inquiry (void *cls,
  126. const struct InquiryMessage *msg);
  127. /**
  128. * Handle a request for full set transmission.
  129. *
  130. * @parem cls closure, a set union operation
  131. * @param mh the demand message
  132. */
  133. void
  134. handle_union_p2p_request_full (void *cls,
  135. const struct GNUNET_MessageHeader *mh);
  136. /**
  137. * Handle a "full done" message.
  138. *
  139. * @parem cls closure, a set union operation
  140. * @param mh the demand message
  141. */
  142. void
  143. handle_union_p2p_full_done (void *cls,
  144. const struct GNUNET_MessageHeader *mh);
  145. /**
  146. * Check a demand by the other peer for elements based on a list
  147. * of `struct GNUNET_HashCode`s.
  148. *
  149. * @parem cls closure, a set union operation
  150. * @param mh the demand message
  151. * @return #GNUNET_OK if @a mh is well-formed
  152. */
  153. int
  154. check_union_p2p_demand (void *cls,
  155. const struct GNUNET_MessageHeader *mh);
  156. /**
  157. * Handle a demand by the other peer for elements based on a list
  158. * of `struct GNUNET_HashCode`s.
  159. *
  160. * @parem cls closure, a set union operation
  161. * @param mh the demand message
  162. */
  163. void
  164. handle_union_p2p_demand (void *cls,
  165. const struct GNUNET_MessageHeader *mh);
  166. /**
  167. * Check offer (of `struct GNUNET_HashCode`s).
  168. *
  169. * @param cls the union operation
  170. * @param mh the message
  171. * @return #GNUNET_OK if @a mh is well-formed
  172. */
  173. int
  174. check_union_p2p_offer (void *cls,
  175. const struct GNUNET_MessageHeader *mh);
  176. /**
  177. * Handle offers (of `struct GNUNET_HashCode`s) and
  178. * respond with demands (of `struct GNUNET_HashCode`s).
  179. *
  180. * @param cls the union operation
  181. * @param mh the message
  182. */
  183. void
  184. handle_union_p2p_offer (void *cls,
  185. const struct GNUNET_MessageHeader *mh);
  186. /**
  187. * Handle a done message from a remote peer
  188. *
  189. * @param cls the union operation
  190. * @param mh the message
  191. */
  192. void
  193. handle_union_p2p_done (void *cls,
  194. const struct GNUNET_MessageHeader *mh);
  195. /**
  196. * Handle an over message from a remote peer
  197. *
  198. * @param cls the union operation
  199. * @param mh the message
  200. */
  201. void
  202. handle_union_p2p_over (void *cls,
  203. const struct GNUNET_MessageHeader *mh);
  204. #endif