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/>.
19 * @author Florian Dold
20 * @author Christian Grothoff
21 * @file set/gnunet-service-set_protocol.h
22 * @brief Peer-to-Peer messages for gnunet set
24 #ifndef SET_PROTOCOL_H
25 #define SET_PROTOCOL_H
28 #include "gnunet_common.h"
31 GNUNET_NETWORK_STRUCT_BEGIN
33 struct OperationRequestMessage
36 * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
38 struct GNUNET_MessageHeader header;
41 * Operation to request, values from `enum GNUNET_SET_OperationType`
43 uint32_t operation GNUNET_PACKED;
46 * For Intersection: my element count
48 uint32_t element_count GNUNET_PACKED;
51 * Application-specific identifier of the request.
53 struct GNUNET_HashCode app_idX;
55 /* rest: optional message */
60 * Message containing buckets of an invertible bloom filter.
62 * If an IBF has too many buckets for an IBF message,
63 * 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
105 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
107 struct GNUNET_MessageHeader header;
110 * Salt used when hashing elements for this inquiry.
112 uint32_t salt GNUNET_PACKED;
115 * Reserved, set to 0.
117 uint32_t reserved GNUNET_PACKED;
119 /* rest: inquiry IBF keys */
124 * During intersection, the first (and possibly second) message
125 * send it the number of elements in the set, to allow the peers
126 * to decide who should start with the Bloom filter.
128 struct IntersectionElementInfoMessage
131 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO
133 struct GNUNET_MessageHeader header;
136 * mutator used with this bloomfilter.
138 uint32_t sender_element_count GNUNET_PACKED;
144 * Bloom filter messages exchanged for set intersection calculation.
149 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
151 struct GNUNET_MessageHeader header;
154 * Number of elements the sender still has in the set.
156 uint32_t sender_element_count GNUNET_PACKED;
159 * XOR of all hashes over all elements remaining in the set.
160 * Used to determine termination.
162 struct GNUNET_HashCode element_xor_hash;
165 * Mutator used with this bloomfilter.
167 uint32_t sender_mutator GNUNET_PACKED;
170 * Total length of the bloomfilter data.
172 uint32_t bloomfilter_total_length GNUNET_PACKED;
175 * Number of bits (k-value) used in encoding the bloomfilter.
177 uint32_t bits_per_element GNUNET_PACKED;
180 * rest: the sender's bloomfilter
186 * Last message, send to confirm the final set. Contains the element
187 * count as it is possible that the peer determined that we were done
188 * by getting the empty set, which in that case also needs to be
191 struct IntersectionDoneMessage
194 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
196 struct GNUNET_MessageHeader header;
199 * Final number of elements in intersection.
201 uint32_t final_element_count GNUNET_PACKED;
204 * XOR of all hashes over all elements remaining in the set.
206 struct GNUNET_HashCode element_xor_hash;
211 * Strata estimator together with the peer's overall set size.
213 struct StrataEstimatorMessage
216 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE(C)
218 struct GNUNET_MessageHeader header;
223 GNUNET_NETWORK_STRUCT_END