diff options
Diffstat (limited to 'src/seti/gnunet-service-seti_protocol.h')
-rw-r--r-- | src/seti/gnunet-service-seti_protocol.h | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/src/seti/gnunet-service-seti_protocol.h b/src/seti/gnunet-service-seti_protocol.h new file mode 100644 index 000000000..51968376e --- /dev/null +++ b/src/seti/gnunet-service-seti_protocol.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2013, 2014, 2020 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 | * @author Florian Dold | ||
22 | * @author Christian Grothoff | ||
23 | * @file seti/gnunet-service-seti_protocol.h | ||
24 | * @brief Peer-to-Peer messages for gnunet set | ||
25 | */ | ||
26 | #ifndef SETI_PROTOCOL_H | ||
27 | #define SETI_PROTOCOL_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_common.h" | ||
31 | |||
32 | |||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
34 | |||
35 | struct OperationRequestMessage | ||
36 | { | ||
37 | /** | ||
38 | * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST | ||
39 | */ | ||
40 | struct GNUNET_MessageHeader header; | ||
41 | |||
42 | /** | ||
43 | * For Intersection: my element count | ||
44 | */ | ||
45 | uint32_t element_count GNUNET_PACKED; | ||
46 | |||
47 | /** | ||
48 | * Application-specific identifier of the request. | ||
49 | */ | ||
50 | struct GNUNET_HashCode app_idX; | ||
51 | |||
52 | /* rest: optional message */ | ||
53 | }; | ||
54 | |||
55 | |||
56 | /** | ||
57 | * During intersection, the first (and possibly second) message | ||
58 | * send it the number of elements in the set, to allow the peers | ||
59 | * to decide who should start with the Bloom filter. | ||
60 | */ | ||
61 | struct IntersectionElementInfoMessage | ||
62 | { | ||
63 | /** | ||
64 | * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO | ||
65 | */ | ||
66 | struct GNUNET_MessageHeader header; | ||
67 | |||
68 | /** | ||
69 | * mutator used with this bloomfilter. | ||
70 | */ | ||
71 | uint32_t sender_element_count GNUNET_PACKED; | ||
72 | }; | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Bloom filter messages exchanged for set intersection calculation. | ||
77 | */ | ||
78 | struct BFMessage | ||
79 | { | ||
80 | /** | ||
81 | * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF | ||
82 | */ | ||
83 | struct GNUNET_MessageHeader header; | ||
84 | |||
85 | /** | ||
86 | * Number of elements the sender still has in the set. | ||
87 | */ | ||
88 | uint32_t sender_element_count GNUNET_PACKED; | ||
89 | |||
90 | /** | ||
91 | * XOR of all hashes over all elements remaining in the set. | ||
92 | * Used to determine termination. | ||
93 | */ | ||
94 | struct GNUNET_HashCode element_xor_hash; | ||
95 | |||
96 | /** | ||
97 | * Mutator used with this bloomfilter. | ||
98 | */ | ||
99 | uint32_t sender_mutator GNUNET_PACKED; | ||
100 | |||
101 | /** | ||
102 | * Total length of the bloomfilter data. | ||
103 | */ | ||
104 | uint32_t bloomfilter_total_length GNUNET_PACKED; | ||
105 | |||
106 | /** | ||
107 | * Number of bits (k-value) used in encoding the bloomfilter. | ||
108 | */ | ||
109 | uint32_t bits_per_element GNUNET_PACKED; | ||
110 | |||
111 | /** | ||
112 | * rest: the sender's bloomfilter | ||
113 | */ | ||
114 | }; | ||
115 | |||
116 | |||
117 | /** | ||
118 | * Last message, send to confirm the final set. Contains the element | ||
119 | * count as it is possible that the peer determined that we were done | ||
120 | * by getting the empty set, which in that case also needs to be | ||
121 | * communicated. | ||
122 | */ | ||
123 | struct IntersectionDoneMessage | ||
124 | { | ||
125 | /** | ||
126 | * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE | ||
127 | */ | ||
128 | struct GNUNET_MessageHeader header; | ||
129 | |||
130 | /** | ||
131 | * Final number of elements in intersection. | ||
132 | */ | ||
133 | uint32_t final_element_count GNUNET_PACKED; | ||
134 | |||
135 | /** | ||
136 | * XOR of all hashes over all elements remaining in the set. | ||
137 | */ | ||
138 | struct GNUNET_HashCode element_xor_hash; | ||
139 | }; | ||
140 | |||
141 | |||
142 | GNUNET_NETWORK_STRUCT_END | ||
143 | |||
144 | #endif | ||