GNUnet  0.11.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
68 
69 
79 typedef void (*GNUNET_RPS_NotifyReadySingleInfoCB) (void *cls,
80  const struct
82  double probability,
83  uint32_t num_observed);
84 
85 
92 struct GNUNET_RPS_Handle *
94 
95 
102 void
104  const char *shared_value);
105 
106 
113 void
115  const char *shared_value);
116 
117 
133 GNUNET_RPS_request_peers (struct GNUNET_RPS_Handle *h, uint32_t n,
135  void *cls);
136 
137 
149  void *cls);
150 
151 
159 void
160 GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint32_t n,
161  const struct GNUNET_PeerIdentity *ids);
162 
168 void
170 
171 
177 void
180 
181 
182 #if ENABLE_MALICIOUS
183 
197 void
198 GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
199  uint32_t type,
200  uint32_t num_peers,
201  const struct GNUNET_PeerIdentity *ids,
202  const struct GNUNET_PeerIdentity *target_peer);
203 
204 #endif /* ENABLE_MALICIOUS */
205 
206 /* Get internals for debugging/profiling purposes */
207 
217 void
219  uint32_t num_updates,
221  void *cls);
222 
223 
233  GNUNET_RPS_NotifyReadyCB stream_input_cb,
234  void *cls);
235 
236 
242 void
244 
245 
251 void
253 
254 
255 #if 0 /* keep Emacsens' auto-indent happy */
256 {
257 #endif
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif
263  /* 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:950
Handle for a request to get peers from biased stream of ids.
Definition: rps_api.c:41
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
GNUNET_RPS_NotifyReadyCB ready_cb
The callback to be called when we receive an answer.
Definition: rps_api.c:190
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:1036
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:461
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:598
void GNUNET_RPS_disconnect(struct GNUNET_RPS_Handle *h)
Disconnect from the rps service.
Definition: rps_api.c:1263
Handler to handle requests from a client.
Definition: rps_api.c:78
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
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:927
struct GNUNET_RPS_Handle * GNUNET_RPS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the rps service.
Definition: rps_api.c:843
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:1231
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:995
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.
Handler for a single request from a client.
Definition: rps_api.c:212
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:238
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:1200
configuration data
Definition: configuration.c:85
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:503
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:904
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Handler for a single request from a client.
Definition: rps_api.c:159
void(* GNUNET_RPS_NotifyReadyCB)(void *cls, uint64_t num_peers, const struct GNUNET_PeerIdentity *peers)
Callback called when requested random peers are available.