3 This file is part of GNUnet
4 Copyright (C) 2013-2017 GNUnet e.V.
6 GNUnet is free software: you can redistribute it and/or modify it
7 under the terms of the GNU Affero General Public License as published
8 by the Free Software Foundation, either version 3 of the License,
9 or (at your option) any later version.
11 GNUnet is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Affero General Public License for more details.
16 You should have received a copy of the GNU Affero General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @file set/gnunet-service-set_union.h
21 * @brief two-peer set operations
22 * @author Florian Dold
23 * @author Christian Grothoff
25 #ifndef GNUNET_SERVICE_SET_UNION_H
26 #define GNUNET_SERVICE_SET_UNION_H
28 #include "gnunet-service-set.h"
29 #include "gnunet-service-set_protocol.h"
33 * Handle a strata estimator from a remote peer
35 * @param cls the union operation
36 * @param msg the message
39 check_union_p2p_strata_estimator (void *cls,
40 const struct StrataEstimatorMessage *msg);
44 * Handle a strata estimator from a remote peer
46 * @param cls the union operation
47 * @param msg the message
50 handle_union_p2p_strata_estimator (void *cls,
51 const struct StrataEstimatorMessage *msg);
55 * Check an IBF message from a remote peer.
57 * Reassemble the IBF from multiple pieces, and
58 * process the whole IBF once possible.
60 * @param cls the union operation
61 * @param msg the header of the message
62 * @return #GNUNET_OK if @a msg is well-formed
65 check_union_p2p_ibf (void *cls,
66 const struct IBFMessage *msg);
70 * Handle an IBF message from a remote peer.
72 * Reassemble the IBF from multiple pieces, and
73 * process the whole IBF once possible.
75 * @param cls the union operation
76 * @param msg the header of the message
79 handle_union_p2p_ibf (void *cls,
80 const struct IBFMessage *msg);
84 * Check an element message from a remote peer.
86 * @param cls the union operation
87 * @param emsg the message
90 check_union_p2p_elements (void *cls,
91 const struct GNUNET_SET_ElementMessage *emsg);
95 * Handle an element message from a remote peer.
96 * Sent by the other peer either because we decoded an IBF and placed a demand,
97 * or because the other peer switched to full set transmission.
99 * @param cls the union operation
100 * @param emsg the message
103 handle_union_p2p_elements (void *cls,
104 const struct GNUNET_SET_ElementMessage *emsg);
108 * Check a full element message from a remote peer.
110 * @param cls the union operation
111 * @param emsg the message
114 check_union_p2p_full_element (void *cls,
115 const struct GNUNET_SET_ElementMessage *emsg);
119 * Handle an element message from a remote peer.
121 * @param cls the union operation
122 * @param emsg the message
125 handle_union_p2p_full_element (void *cls,
126 const struct GNUNET_SET_ElementMessage *emsg);
130 * Send offers (for GNUNET_Hash-es) in response
131 * to inquiries (for IBF_Key-s).
133 * @param cls the union operation
134 * @param msg the message
137 check_union_p2p_inquiry (void *cls,
138 const struct InquiryMessage *msg);
142 * Send offers (for GNUNET_Hash-es) in response
143 * to inquiries (for IBF_Key-s).
145 * @param cls the union operation
146 * @param msg the message
149 handle_union_p2p_inquiry (void *cls,
150 const struct InquiryMessage *msg);
155 * Handle a request for full set transmission.
157 * @parem cls closure, a set union operation
158 * @param mh the demand message
161 handle_union_p2p_request_full (void *cls,
162 const struct GNUNET_MessageHeader *mh);
167 * Handle a "full done" message.
169 * @parem cls closure, a set union operation
170 * @param mh the demand message
173 handle_union_p2p_full_done (void *cls,
174 const struct GNUNET_MessageHeader *mh);
178 * Check a demand by the other peer for elements based on a list
179 * of `struct GNUNET_HashCode`s.
181 * @parem cls closure, a set union operation
182 * @param mh the demand message
183 * @return #GNUNET_OK if @a mh is well-formed
186 check_union_p2p_demand (void *cls,
187 const struct GNUNET_MessageHeader *mh);
191 * Handle a demand by the other peer for elements based on a list
192 * of `struct GNUNET_HashCode`s.
194 * @parem cls closure, a set union operation
195 * @param mh the demand message
198 handle_union_p2p_demand (void *cls,
199 const struct GNUNET_MessageHeader *mh);
203 * Check offer (of `struct GNUNET_HashCode`s).
205 * @param cls the union operation
206 * @param mh the message
207 * @return #GNUNET_OK if @a mh is well-formed
210 check_union_p2p_offer (void *cls,
211 const struct GNUNET_MessageHeader *mh);
215 * Handle offers (of `struct GNUNET_HashCode`s) and
216 * respond with demands (of `struct GNUNET_HashCode`s).
218 * @param cls the union operation
219 * @param mh the message
222 handle_union_p2p_offer (void *cls,
223 const struct GNUNET_MessageHeader *mh);
227 * Handle a done message from a remote peer
229 * @param cls the union operation
230 * @param mh the message
233 handle_union_p2p_done (void *cls,
234 const struct GNUNET_MessageHeader *mh);
237 * Handle an over message from a remote peer
239 * @param cls the union operation
240 * @param mh the message
243 handle_union_p2p_over (void *cls,
244 const struct GNUNET_MessageHeader *mh);