2 This file is part of GNUnet
3 Copyright (C) 2013-2017 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
21 * @file set/gnunet-service-set_union.h
22 * @brief two-peer set operations
23 * @author Florian Dold
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_SET_UNION_H
27 #define GNUNET_SERVICE_SET_UNION_H
29 #include "gnunet-service-set.h"
30 #include "gnunet-service-set_protocol.h"
34 * Handle a strata estimator from a remote peer
36 * @param cls the union operation
37 * @param msg the message
40 check_union_p2p_strata_estimator (void *cls,
41 const struct StrataEstimatorMessage *msg);
45 * Handle a strata estimator from a remote peer
47 * @param cls the union operation
48 * @param msg the message
51 handle_union_p2p_strata_estimator (void *cls,
52 const struct StrataEstimatorMessage *msg);
56 * Check an IBF message from a remote peer.
58 * Reassemble the IBF from multiple pieces, and
59 * process the whole IBF once possible.
61 * @param cls the union operation
62 * @param msg the header of the message
63 * @return #GNUNET_OK if @a msg is well-formed
66 check_union_p2p_ibf (void *cls,
67 const struct IBFMessage *msg);
71 * Handle an IBF message from a remote peer.
73 * Reassemble the IBF from multiple pieces, and
74 * process the whole IBF once possible.
76 * @param cls the union operation
77 * @param msg the header of the message
80 handle_union_p2p_ibf (void *cls,
81 const struct IBFMessage *msg);
85 * Check an element message from a remote peer.
87 * @param cls the union operation
88 * @param emsg the message
91 check_union_p2p_elements (void *cls,
92 const struct GNUNET_SET_ElementMessage *emsg);
96 * Handle an element message from a remote peer.
97 * Sent by the other peer either because we decoded an IBF and placed a demand,
98 * or because the other peer switched to full set transmission.
100 * @param cls the union operation
101 * @param emsg the message
104 handle_union_p2p_elements (void *cls,
105 const struct GNUNET_SET_ElementMessage *emsg);
109 * Check a full element message from a remote peer.
111 * @param cls the union operation
112 * @param emsg the message
115 check_union_p2p_full_element (void *cls,
116 const struct GNUNET_SET_ElementMessage *emsg);
120 * Handle an element message from a remote peer.
122 * @param cls the union operation
123 * @param emsg the message
126 handle_union_p2p_full_element (void *cls,
127 const struct GNUNET_SET_ElementMessage *emsg);
131 * Send offers (for GNUNET_Hash-es) in response
132 * to inquiries (for IBF_Key-s).
134 * @param cls the union operation
135 * @param msg the message
138 check_union_p2p_inquiry (void *cls,
139 const struct InquiryMessage *msg);
143 * Send offers (for GNUNET_Hash-es) in response
144 * to inquiries (for IBF_Key-s).
146 * @param cls the union operation
147 * @param msg the message
150 handle_union_p2p_inquiry (void *cls,
151 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);
166 * Handle a "full done" message.
168 * @parem cls closure, a set union operation
169 * @param mh the demand message
172 handle_union_p2p_full_done (void *cls,
173 const struct GNUNET_MessageHeader *mh);
177 * Check a demand by the other peer for elements based on a list
178 * of `struct GNUNET_HashCode`s.
180 * @parem cls closure, a set union operation
181 * @param mh the demand message
182 * @return #GNUNET_OK if @a mh is well-formed
185 check_union_p2p_demand (void *cls,
186 const struct GNUNET_MessageHeader *mh);
190 * Handle a demand by the other peer for elements based on a list
191 * of `struct GNUNET_HashCode`s.
193 * @parem cls closure, a set union operation
194 * @param mh the demand message
197 handle_union_p2p_demand (void *cls,
198 const struct GNUNET_MessageHeader *mh);
202 * Check offer (of `struct GNUNET_HashCode`s).
204 * @param cls the union operation
205 * @param mh the message
206 * @return #GNUNET_OK if @a mh is well-formed
209 check_union_p2p_offer (void *cls,
210 const struct GNUNET_MessageHeader *mh);
214 * Handle offers (of `struct GNUNET_HashCode`s) and
215 * respond with demands (of `struct GNUNET_HashCode`s).
217 * @param cls the union operation
218 * @param mh the message
221 handle_union_p2p_offer (void *cls,
222 const struct GNUNET_MessageHeader *mh);
226 * Handle a done message from a remote peer
228 * @param cls the union operation
229 * @param mh the message
232 handle_union_p2p_done (void *cls,
233 const struct GNUNET_MessageHeader *mh);
236 * Handle an over message from a remote peer
238 * @param cls the union operation
239 * @param mh the message
242 handle_union_p2p_over (void *cls,
243 const struct GNUNET_MessageHeader *mh);