2 This file is part of GNUnet.
3 Copyright (C) 2013, 2014 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 * @author Florian Dold
22 * @author Christian Grothoff
23 * @file set/gnunet-service-set_protocol.h
24 * @brief Peer-to-Peer messages for gnunet set
26 #ifndef SET_PROTOCOL_H
27 #define SET_PROTOCOL_H
30 #include "gnunet_common.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
35 struct OperationRequestMessage {
37 * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
39 struct GNUNET_MessageHeader header;
42 * Operation to request, values from `enum GNUNET_SET_OperationType`
44 uint32_t operation GNUNET_PACKED;
47 * For Intersection: my element count
49 uint32_t element_count GNUNET_PACKED;
52 * Application-specific identifier of the request.
54 struct GNUNET_HashCode app_idX;
56 /* rest: optional message */
61 * Message containing buckets of an invertible bloom filter.
63 * If an IBF has too many buckets for an IBF message,
64 * it is split into multiple messages.
68 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
70 struct GNUNET_MessageHeader header;
73 * Order of the whole ibf, where
74 * num_buckets = 2^order
86 uint16_t reserved2 GNUNET_PACKED;
89 * Offset of the strata in the rest of the message
91 uint32_t offset GNUNET_PACKED;
94 * Salt used when hashing elements for this IBF.
96 uint32_t salt GNUNET_PACKED;
102 struct InquiryMessage {
104 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
106 struct GNUNET_MessageHeader header;
109 * Salt used when hashing elements for this inquiry.
111 uint32_t salt GNUNET_PACKED;
114 * Reserved, set to 0.
116 uint32_t reserved GNUNET_PACKED;
118 /* rest: inquiry IBF keys */
123 * During intersection, the first (and possibly second) message
124 * send it the number of elements in the set, to allow the peers
125 * to decide who should start with the Bloom filter.
127 struct IntersectionElementInfoMessage {
129 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO
131 struct GNUNET_MessageHeader header;
134 * mutator used with this bloomfilter.
136 uint32_t sender_element_count GNUNET_PACKED;
141 * Bloom filter messages exchanged for set intersection calculation.
145 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
147 struct GNUNET_MessageHeader header;
150 * Number of elements the sender still has in the set.
152 uint32_t sender_element_count GNUNET_PACKED;
155 * XOR of all hashes over all elements remaining in the set.
156 * Used to determine termination.
158 struct GNUNET_HashCode element_xor_hash;
161 * Mutator used with this bloomfilter.
163 uint32_t sender_mutator GNUNET_PACKED;
166 * Total length of the bloomfilter data.
168 uint32_t bloomfilter_total_length GNUNET_PACKED;
171 * Number of bits (k-value) used in encoding the bloomfilter.
173 uint32_t bits_per_element GNUNET_PACKED;
176 * rest: the sender's bloomfilter
182 * Last message, send to confirm the final set. Contains the element
183 * count as it is possible that the peer determined that we were done
184 * by getting the empty set, which in that case also needs to be
187 struct IntersectionDoneMessage {
189 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
191 struct GNUNET_MessageHeader header;
194 * Final number of elements in intersection.
196 uint32_t final_element_count GNUNET_PACKED;
199 * XOR of all hashes over all elements remaining in the set.
201 struct GNUNET_HashCode element_xor_hash;
206 * Strata estimator together with the peer's overall set size.
208 struct StrataEstimatorMessage {
210 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE(C)
212 struct GNUNET_MessageHeader header;
217 GNUNET_NETWORK_STRUCT_END