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 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.
16 * @author Florian Dold
17 * @author Christian Grothoff
18 * @file set/gnunet-service-set_protocol.h
19 * @brief Peer-to-Peer messages for gnunet set
21 #ifndef SET_PROTOCOL_H
22 #define SET_PROTOCOL_H
25 #include "gnunet_common.h"
28 GNUNET_NETWORK_STRUCT_BEGIN
30 struct OperationRequestMessage
33 * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
35 struct GNUNET_MessageHeader header;
38 * Operation to request, values from `enum GNUNET_SET_OperationType`
40 uint32_t operation GNUNET_PACKED;
43 * For Intersection: my element count
45 uint32_t element_count GNUNET_PACKED;
48 * Application-specific identifier of the request.
50 struct GNUNET_HashCode app_idX;
52 /* rest: optional message */
57 * Message containing buckets of an invertible bloom filter.
59 * If an IBF has too many buckets for an IBF message,
60 * it is split into multiple messages.
65 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
67 struct GNUNET_MessageHeader header;
70 * Order of the whole ibf, where
71 * num_buckets = 2^order
83 uint16_t reserved2 GNUNET_PACKED;
86 * Offset of the strata in the rest of the message
88 uint32_t offset GNUNET_PACKED;
91 * Salt used when hashing elements for this IBF.
93 uint32_t salt GNUNET_PACKED;
102 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
104 struct GNUNET_MessageHeader header;
107 * Salt used when hashing elements for this inquiry.
109 uint32_t salt GNUNET_PACKED;
112 * Reserved, set to 0.
114 uint32_t reserved GNUNET_PACKED;
116 /* rest: inquiry IBF keys */
121 * During intersection, the first (and possibly second) message
122 * send it the number of elements in the set, to allow the peers
123 * to decide who should start with the Bloom filter.
125 struct IntersectionElementInfoMessage
128 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO
130 struct GNUNET_MessageHeader header;
133 * mutator used with this bloomfilter.
135 uint32_t sender_element_count GNUNET_PACKED;
141 * Bloom filter messages exchanged for set intersection calculation.
146 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
148 struct GNUNET_MessageHeader header;
151 * Number of elements the sender still has in the set.
153 uint32_t sender_element_count GNUNET_PACKED;
156 * XOR of all hashes over all elements remaining in the set.
157 * Used to determine termination.
159 struct GNUNET_HashCode element_xor_hash;
162 * Mutator used with this bloomfilter.
164 uint32_t sender_mutator GNUNET_PACKED;
167 * Total length of the bloomfilter data.
169 uint32_t bloomfilter_total_length GNUNET_PACKED;
172 * Number of bits (k-value) used in encoding the bloomfilter.
174 uint32_t bits_per_element GNUNET_PACKED;
177 * rest: the sender's bloomfilter
183 * Last message, send to confirm the final set. Contains the element
184 * count as it is possible that the peer determined that we were done
185 * by getting the empty set, which in that case also needs to be
188 struct IntersectionDoneMessage
191 * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
193 struct GNUNET_MessageHeader header;
196 * Final number of elements in intersection.
198 uint32_t final_element_count GNUNET_PACKED;
201 * XOR of all hashes over all elements remaining in the set.
203 struct GNUNET_HashCode element_xor_hash;
208 * Strata estimator together with the peer's overall set size.
210 struct StrataEstimatorMessage
213 * Type: #GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE(C)
215 struct GNUNET_MessageHeader header;
220 GNUNET_NETWORK_STRUCT_END