GNUnet  0.11.x
rps.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012-2013 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  */
26 #include "gnunet_rps_service.h"
27 
31 #define GNUNET_RPS_CADET_PORT 31337
32 
33 
35 
36 /***********************************************************************
37 * P2P Messages
38 ***********************************************************************/
39 
44 {
49 
54 
55  /* Followed by num_peers * GNUNET_PeerIdentity */
56 };
57 
58 
59 /***********************************************************************
60 * Client-Service Messages
61 ***********************************************************************/
62 
67 {
72 
77 
78  /* Followed by num_peers * GNUNET_PeerIdentity */
79 };
80 
81 #if ENABLE_MALICIOUS
85 struct GNUNET_RPS_CS_ActMaliciousMessage
86 {
90  struct GNUNET_MessageHeader header;
91 
96  struct GNUNET_PeerIdentity attacked_peer;
97 
105  uint32_t type GNUNET_PACKED;
106 
110  uint32_t num_peers GNUNET_PACKED;
111 
112  /* Followed by num_peers * GNUNET_PeerIdentity when the type of malicious
113  behaviour is 1 */
114 };
115 #endif /* ENABLE_MALICIOUS */
116 
117 
122 {
127 
132 
137 
142 };
143 
144 
149 {
154 
159 };
160 
161 
162 /* Debug messages */
163 
169 {
174 
180 };
181 
186 {
191 
195  uint32_t id GNUNET_PACKED;
196 
201 };
202 /* Followed by num_peers * GNUNET_PeerIdentity */
203 
209 {
214 };
215 
220 {
225 
230 
231  // TODO maybe source of peer (pull/push list, peerinfo, ...)
232 
233  /* Followed by num_peers * GNUNET_PeerIdentity */
234 };
235 
237 
238 /***********************************************************************
239 * Defines from old gnunet-service-rps_peers.h
240 ***********************************************************************/
241 
246 {
251 
252  /* IN_OTHER_GOSSIP_LIST = 0x02, unneeded? */
253  /* IN_OWN_SAMPLER_LIST = 0x04, unneeded? */
254  /* IN_OWN_GOSSIP_LIST = 0x08, unneeded? */
255 
259  Peers_ONLINE = 0x20,
260 
267 };
268 
276 {
281 
287 
292 };
293 
294 
299 {
304 
309 };
310 
317 typedef void (*PeerOp) (void *cls, const struct GNUNET_PeerIdentity *peer);
318 
328 typedef int
329 (*PeersIterator) (void *cls,
330  const struct GNUNET_PeerIdentity *peer);
331 
332 
static unsigned int num_peers
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
int(* PeersIterator)(void *cls, const struct GNUNET_PeerIdentity *peer)
Iterator over valid peers.
Definition: rps.h:329
struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
Peers_ChannelFlags
Keep track of the status of a channel.
Definition: rps.h:276
@ Peers_CHANNEL_CLEAN
The channel was removed because it was not needed any more.
Definition: rps.h:286
@ Peers_CHANNEL_DESTROING
We destroyed the channel because the other peer established a second one.
Definition: rps.h:291
@ Peers_CHANNEL_ESTABLISHED_TWICE
We destroyed the channel because the other peer established a second one.
Definition: rps.h:280
Peers_ChannelRole
The role of a channel.
Definition: rps.h:299
@ Peers_CHANNEL_ROLE_RECEIVING
Channel is used for receiving.
Definition: rps.h:308
@ Peers_CHANNEL_ROLE_SENDING
Channel is used for sending.
Definition: rps.h:303
void(* PeerOp)(void *cls, const struct GNUNET_PeerIdentity *peer)
Functions of this type can be used to be stored at a peer for later execution.
Definition: rps.h:317
Peers_PeerFlags
Different flags indicating the status of another peer.
Definition: rps.h:246
@ Peers_TO_DESTROY
We set this bit when we are going to destroy the channel to this peer.
Definition: rps.h:266
@ Peers_ONLINE
We set this bit when we know the peer is online.
Definition: rps.h:259
@ Peers_PULL_REPLY_PENDING
If we are waiting for a reply from that peer (sent a pull request).
Definition: rps.h:250
A 512-bit hashcode.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Message from service to client containing peer from biased stream.
Definition: rps.h:220
uint64_t num_peers
Number of peers.
Definition: rps.h:229
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:224
Message from client to service indicating that clients wants to get stream of biased peers.
Definition: rps.h:209
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:213
Message from service to client containing current update of view.
Definition: rps.h:186
uint64_t num_peers
Number of peers in the view.
Definition: rps.h:200
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:190
Message from client to service indicating that clients wants to get updates of the view.
Definition: rps.h:169
uint32_t num_updates
Number of updates 0 for sending updates until cancellation.
Definition: rps.h:179
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:173
Message from client to service with seed of peers.
Definition: rps.h:67
uint32_t num_peers
Number of peers.
Definition: rps.h:76
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:71
Message from client to service telling it to start a new sub.
Definition: rps.h:122
struct GNUNET_HashCode hash
Length of the shared value represented as string.
Definition: rps.h:141
struct GNUNET_TIME_RelativeNBO round_interval
Mean interval between two rounds.
Definition: rps.h:136
uint32_t reserved
For alignment.
Definition: rps.h:131
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:126
Message from client to service telling it to stop a new sub.
Definition: rps.h:149
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:153
struct GNUNET_HashCode hash
Length of the shared value represented as string.
Definition: rps.h:158
P2P Message to send PeerIDs to other peer.
Definition: rps.h:44
uint32_t num_peers
Number of PeerIDs sent.
Definition: rps.h:53
struct GNUNET_MessageHeader header
Header including size and type in NBO.
Definition: rps.h:48
Handle for the service.
Time for relative time used by GNUnet, in microseconds and in network byte order.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.