GNUnet  0.10.x
gnunet_rps_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C)
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 
31 #ifndef GNUNET_RPS_SERVICE_H
32 #define GNUNET_RPS_SERVICE_H
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #if 0 /* keep Emacsens' auto-indent happy */
38 }
39 #endif
40 #endif
41 
45 #define GNUNET_RPS_VERSION 0x00000000
46 
50 struct GNUNET_RPS_Handle;
51 
56 
64 typedef void (* GNUNET_RPS_NotifyReadyCB) (void *cls,
65  uint64_t num_peers,
66  const struct GNUNET_PeerIdentity *peers);
67 
68 
78 typedef void (* GNUNET_RPS_NotifyReadySingleInfoCB) (void *cls,
79  const struct GNUNET_PeerIdentity *peer,
80  double probability,
81  uint32_t num_observed);
82 
83 
90 struct GNUNET_RPS_Handle *
92 
93 
100 void
102  const char *shared_value);
103 
104 
111 void
113  const char *shared_value);
114 
115 
131 GNUNET_RPS_request_peers(struct GNUNET_RPS_Handle *h, uint32_t n,
133  void *cls);
134 
135 
147  void *cls);
148 
149 
157 void
158 GNUNET_RPS_seed_ids(struct GNUNET_RPS_Handle *h, uint32_t n,
159  const struct GNUNET_PeerIdentity * ids);
160 
166 void
168 
169 
175 void
178 
179 
180 #if ENABLE_MALICIOUS
181 
195 void
196 GNUNET_RPS_act_malicious(struct GNUNET_RPS_Handle *h,
197  uint32_t type,
198  uint32_t num_peers,
199  const struct GNUNET_PeerIdentity *ids,
200  const struct GNUNET_PeerIdentity *target_peer);
201 #endif /* ENABLE_MALICIOUS */
202 
203 /* Get internals for debugging/profiling purposes */
204 
214 void
216  uint32_t num_updates,
218  void *cls);
219 
220 
230  GNUNET_RPS_NotifyReadyCB stream_input_cb,
231  void *cls);
232 
233 
239 void
241 
242 
248 void
250 
251 
252 #if 0 /* keep Emacsens' auto-indent happy */
253 {
254 #endif
255 #ifdef __cplusplus
256 }
257 #endif
258 
259 #endif
260  /* end of group */
struct GNUNET_RPS_Request_Handle * GNUNET_RPS_request_peers(struct GNUNET_RPS_Handle *h, uint32_t n, GNUNET_RPS_NotifyReadyCB ready_cb, void *cls)
Request n random peers.
Definition: rps_api.c:942
Handle for a request to get peers from biased stream of ids.
Definition: rps_api.c:41
GNUNET_RPS_NotifyReadyCB ready_cb
The callback to be called when we receive an answer.
Definition: rps_api.c:187
void GNUNET_RPS_seed_ids(struct GNUNET_RPS_Handle *h, uint32_t n, const struct GNUNET_PeerIdentity *ids)
Seed rps service with peerIDs.
Definition: rps_api.c:1028
void GNUNET_RPS_view_request(struct GNUNET_RPS_Handle *rps_handle, uint32_t num_updates, GNUNET_RPS_NotifyReadyCB view_update_cb, void *cls)
Request updates of view.
Definition: rps_api.c:456
void(* GNUNET_RPS_NotifyReadyCB)(void *cls, uint64_t num_peers, const struct GNUNET_PeerIdentity *peers)
Callback called when requested random peers are available.
static struct GNUNET_RPS_Handle * rps_handle
RPS handle.
Definition: gnunet-rps.c:36
void GNUNET_RPS_stream_cancel(struct GNUNET_RPS_StreamRequestHandle *srh)
Cancel a specific request for updates from the biased peer stream.
Definition: rps_api.c:593
void GNUNET_RPS_disconnect(struct GNUNET_RPS_Handle *h)
Disconnect from the rps service.
Definition: rps_api.c:1249
Handler to handle requests from a client.
Definition: rps_api.c:77
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
void GNUNET_RPS_sub_stop(struct GNUNET_RPS_Handle *h, const char *shared_value)
Stop a sub with the given shared value.
Definition: rps_api.c:919
struct GNUNET_RPS_Handle * GNUNET_RPS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the rps service.
Definition: rps_api.c:835
void GNUNET_RPS_request_single_info_cancel(struct GNUNET_RPS_Request_Handle_Single_Info *rhs)
Cancle an issued single info request.
Definition: rps_api.c:1217
static struct GNUNET_CONTAINER_MultiPeerMap * ids
GNUNET_PeerIdentity -> CadetPeer.
void view_update_cb(void *cls, uint64_t view_size, const struct GNUNET_PeerIdentity *peers)
struct GNUNET_RPS_Request_Handle_Single_Info * GNUNET_RPS_request_peer_info(struct GNUNET_RPS_Handle *rps_handle, GNUNET_RPS_NotifyReadySingleInfoCB ready_cb, void *cls)
Request one random peer, getting additional information.
Definition: rps_api.c:987
Handler for a single request from a client.
Definition: rps_api.c:209
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
static unsigned int num_peers
static struct GNUNET_PeerIdentity * target_peer
ID of the targeted peer.
GNUNET_RPS_NotifyReadySingleInfoCB ready_cb
The callback to be called when we receive an answer.
Definition: rps_api.c:234
The identity of the host (wraps the signing key of the peer).
void GNUNET_RPS_request_cancel(struct GNUNET_RPS_Request_Handle *rh)
Cancle an issued request.
Definition: rps_api.c:1186
configuration data
Definition: configuration.c:83
static struct CadetPeer * peers
Operation to get peer ids.
struct GNUNET_RPS_StreamRequestHandle * GNUNET_RPS_stream_request(struct GNUNET_RPS_Handle *rps_handle, GNUNET_RPS_NotifyReadyCB stream_input_cb, void *cls)
Request biased stream of peers that are being put into the sampler.
Definition: rps_api.c:498
void GNUNET_RPS_sub_start(struct GNUNET_RPS_Handle *h, const char *shared_value)
Start a sub with the given shared value.
Definition: rps_api.c:896
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Handler for a single request from a client.
Definition: rps_api.c:157
void(* GNUNET_RPS_NotifyReadySingleInfoCB)(void *cls, const struct GNUNET_PeerIdentity *peer, double probability, uint32_t num_observed)
Callback called when requested random peer with additional information is available.