diff options
author | Julius Bünger <buenger@mytum.de> | 2017-12-29 15:37:48 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2017-12-29 15:37:48 +0100 |
commit | f2b64da6fd07c3a20c8f202fa8920f9f2e96e51e (patch) | |
tree | 2d774cf2c02dc6b3d49e3fdcbe7eabc41512744f /src/rps/rps.h | |
parent | c6f178907d4f1ef53a53ed85e12521d07ba4d08e (diff) | |
download | gnunet-f2b64da6fd07c3a20c8f202fa8920f9f2e96e51e.tar.gz gnunet-f2b64da6fd07c3a20c8f202fa8920f9f2e96e51e.zip |
refactor rps code
Diffstat (limited to 'src/rps/rps.h')
-rw-r--r-- | src/rps/rps.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/rps/rps.h b/src/rps/rps.h index 3037e2190..f5cc2e8d1 100644 --- a/src/rps/rps.h +++ b/src/rps/rps.h | |||
@@ -175,4 +175,100 @@ struct GNUNET_RPS_CS_ActMaliciousMessage | |||
175 | }; | 175 | }; |
176 | #endif /* ENABLE_MALICIOUS */ | 176 | #endif /* ENABLE_MALICIOUS */ |
177 | 177 | ||
178 | |||
179 | /*********************************************************************** | ||
180 | * Defines from old gnunet-service-rps_peers.h | ||
181 | ***********************************************************************/ | ||
182 | |||
183 | /** | ||
184 | * Different flags indicating the status of another peer. | ||
185 | */ | ||
186 | enum Peers_PeerFlags | ||
187 | { | ||
188 | /** | ||
189 | * If we are waiting for a reply from that peer (sent a pull request). | ||
190 | */ | ||
191 | Peers_PULL_REPLY_PENDING = 0x01, | ||
192 | |||
193 | /* IN_OTHER_GOSSIP_LIST = 0x02, unneeded? */ | ||
194 | /* IN_OWN_SAMPLER_LIST = 0x04, unneeded? */ | ||
195 | /* IN_OWN_GOSSIP_LIST = 0x08, unneeded? */ | ||
196 | |||
197 | /** | ||
198 | * We set this bit when we know the peer is online. | ||
199 | */ | ||
200 | Peers_ONLINE = 0x20, | ||
201 | |||
202 | /** | ||
203 | * We set this bit when we are going to destroy the channel to this peer. | ||
204 | * When cleanup_channel is called, we know that we wanted to destroy it. | ||
205 | * Otherwise the channel to the other peer was destroyed. | ||
206 | */ | ||
207 | Peers_TO_DESTROY = 0x40, | ||
208 | }; | ||
209 | |||
210 | /** | ||
211 | * Keep track of the status of a channel. | ||
212 | * | ||
213 | * This is needed in order to know what to do with a channel when it's | ||
214 | * destroyed. | ||
215 | */ | ||
216 | enum Peers_ChannelFlags | ||
217 | { | ||
218 | /** | ||
219 | * We destroyed the channel because the other peer established a second one. | ||
220 | */ | ||
221 | Peers_CHANNEL_ESTABLISHED_TWICE = 0x1, | ||
222 | |||
223 | /** | ||
224 | * The channel was removed because it was not needed any more. This should be | ||
225 | * the sending channel. | ||
226 | */ | ||
227 | Peers_CHANNEL_CLEAN = 0x2, | ||
228 | |||
229 | /** | ||
230 | * We destroyed the channel because the other peer established a second one. | ||
231 | */ | ||
232 | Peers_CHANNEL_DESTROING = 0x4, | ||
233 | }; | ||
234 | |||
235 | |||
236 | /** | ||
237 | * @brief The role of a channel. Sending or receiving. | ||
238 | */ | ||
239 | enum Peers_ChannelRole | ||
240 | { | ||
241 | /** | ||
242 | * Channel is used for sending | ||
243 | */ | ||
244 | Peers_CHANNEL_ROLE_SENDING = 0x01, | ||
245 | |||
246 | /** | ||
247 | * Channel is used for receiving | ||
248 | */ | ||
249 | Peers_CHANNEL_ROLE_RECEIVING = 0x02, | ||
250 | }; | ||
251 | |||
252 | /** | ||
253 | * @brief Functions of this type can be used to be stored at a peer for later execution. | ||
254 | * | ||
255 | * @param cls closure | ||
256 | * @param peer peer to execute function on | ||
257 | */ | ||
258 | typedef void (* PeerOp) (void *cls, const struct GNUNET_PeerIdentity *peer); | ||
259 | |||
260 | /** | ||
261 | * @brief Iterator over valid peers. | ||
262 | * | ||
263 | * @param cls closure | ||
264 | * @param peer current public peer id | ||
265 | * @return #GNUNET_YES if we should continue to | ||
266 | * iterate, | ||
267 | * #GNUNET_NO if not. | ||
268 | */ | ||
269 | typedef int | ||
270 | (*PeersIterator) (void *cls, | ||
271 | const struct GNUNET_PeerIdentity *peer); | ||
272 | |||
273 | |||
178 | GNUNET_NETWORK_STRUCT_END | 274 | GNUNET_NETWORK_STRUCT_END |