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