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